File tree Expand file tree Collapse file tree
main/java/com/hubsante/hub
test/java/com/hubsante/hub/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public class Constants {
3434 public static final String DISPATCHED_MESSAGE = "dispatch.message" ;
3535 public static final String USE_CASE_TAG = "use_case" ;
3636 public static final String UNKNOWN = "unknown" ;
37+ public static final boolean DEFAULT_DIRECT_CISU_PREFERENCE = false ;
3738 public static final String FR_HEALTH_PREFIX = "fr.health" ;
3839 public static final String FR_FIRE_PREFIX = "fr.fire" ;
3940 public static final String FR_CISU_PREFIX = "fr.cisu" ;
Original file line number Diff line number Diff line change 1515 */
1616package com .hubsante .hub .service ;
1717
18+ import static com .hubsante .hub .config .Constants .DEFAULT_DIRECT_CISU_PREFERENCE ;
1819import static com .hubsante .hub .config .Constants .UNKNOWN ;
1920
2021import com .hubsante .hub .config .LogConstants ;
@@ -178,6 +179,14 @@ public Boolean isClientUseXml(String clientId) {
178179 return clientProperties .useXml ();
179180 }
180181
182+ public boolean isClientDirectCisu (String clientId ) {
183+ ClientProperties clientProperties = get (clientId );
184+
185+ return clientProperties != null
186+ ? clientProperties .directCisu ()
187+ : DEFAULT_DIRECT_CISU_PREFERENCE ;
188+ }
189+
181190 public List <String > getClientInhibitedUseCases (String clientId ) {
182191 ClientProperties clientProperties = get (clientId );
183192 if (clientProperties == null ) {
Original file line number Diff line number Diff line change 2020import static com .hubsante .hub .utils .MessageUtils .*;
2121
2222import com .hubsante .hub .config .HubConfiguration ;
23- import com .hubsante .hub .model .ClientProperties ;
2423import com .hubsante .model .edxl .EdxlMessage ;
2524import java .util .Arrays ;
2625import lombok .extern .slf4j .Slf4j ;
2726
2827@ Slf4j
2928public class ConversionUtils {
3029
31- private static final boolean DEFAULT_DIRECT_CISU_PREFERENCE = false ;
32-
3330 public static String buildExchangeDestination (String sourceVHost , String targetVHost ) {
3431 return TRANSFER_EXCHANGE_PREFIX + sourceVHost + "_to_" + targetVHost ;
3532 }
@@ -139,13 +136,6 @@ public static boolean isDirectCisuForHealthActor(
139136 String senderId = edxlMessage .getSenderID ();
140137 String healthActor = senderId .startsWith (HEALTH_PREFIX ) ? senderId : recipientId ;
141138
142- ClientProperties healthActorProperties =
143- hubConfig .getClientPropertiesRegistry ().get (healthActor );
144- boolean directCisuPreference =
145- healthActorProperties != null
146- ? healthActorProperties .directCisu ()
147- : DEFAULT_DIRECT_CISU_PREFERENCE ;
148-
149- return directCisuPreference ;
139+ return hubConfig .getClientPropertiesRegistry ().isClientDirectCisu (healthActor );
150140 }
151141}
Original file line number Diff line number Diff line change @@ -303,7 +303,7 @@ void testGetTargetVersion() {
303303
304304 // Direct Cisu cases
305305 when (hubConfig .getVhost ()).thenReturn ("15-nexsis_v1.9" );
306- when (clientPropertiesRegistry .get ("fr.health.samuDirectCisu" ). directCisu ( ))
306+ when (clientPropertiesRegistry .isClientDirectCisu ("fr.health.samuDirectCisu" ))
307307 .thenReturn (true );
308308 when (edxlMessage .getSenderID ()).thenReturn ("fr.health.samuDirectCisu" );
309309 mockedMessageUtils
@@ -360,11 +360,11 @@ void testIsDirectCisuForHealthActor() {
360360 .thenReturn ("fr.fire.sdisZ" );
361361
362362 // Health actor in direct CISU preferences - true
363- when (clientPropertiesRegistry .get ("fr.health.samuA" ). directCisu ( )).thenReturn (true );
363+ when (clientPropertiesRegistry .isClientDirectCisu ("fr.health.samuA" )).thenReturn (true );
364364 assertTrue (ConversionUtils .isDirectCisuForHealthActor (hubConfig , edxlMessage ));
365365
366366 // Health actor in direct CISU preferences - false
367- when (clientPropertiesRegistry .get ("fr.health.samuA" ). directCisu ( )).thenReturn (false );
367+ when (clientPropertiesRegistry .isClientDirectCisu ("fr.health.samuA" )).thenReturn (false );
368368 assertFalse (ConversionUtils .isDirectCisuForHealthActor (hubConfig , edxlMessage ));
369369
370370 // Health actor not in direct CISU preferences
You can’t perform that action at this time.
0 commit comments