Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
lincmba committed Jul 16, 2024
1 parent c288cc6 commit 6be6b28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ public Bundle handleNonIdentifierRequest(
List<String> selectedSyncLocations = extractSyncLocations(syncLocationsParam);
String practitionerId = verifiedJwt.getSubject();
List<String> userRoles = JwtUtils.getUserRolesFromJWT(verifiedJwt);
String syncStrategy = getSyncStrategyFromJwtToken(verifiedJwt);
String applicationId = JwtUtils.getApplicationIdFromJWT(verifiedJwt);
String syncStrategy = getSyncStrategyByAppId(applicationId);

if (Constants.LIST.equals(mode)) {
if (Constants.SyncStrategy.RELATED_ENTITY_LOCATION.equalsIgnoreCase(syncStrategy)
Expand Down Expand Up @@ -241,11 +242,8 @@ public Bundle handleNonIdentifierRequest(
}
}

public String getSyncStrategyFromJwtToken(DecodedJWT verifiedJwt) {
String applicationId = JwtUtils.getApplicationIdFromJWT(verifiedJwt);

public String getSyncStrategyByAppId(String applicationId) {
String syncStrategy;

if (CacheHelper.INSTANCE.skipCache()) {
syncStrategy = getSyncStrategy(applicationId);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void testHandleNonIdentifierRequestListModePaginatesLocations() {
.getDescendants(Mockito.anyString(), Mockito.any(), Mockito.any());
Mockito.doReturn(Constants.SyncStrategy.RELATED_ENTITY_LOCATION)
.when(mockLocationHierarchyEndpointHelper)
.getSyncStrategyFromJwtToken(mockDecodedJWT);
.getSyncStrategyByAppId(Mockito.any());

mockJwtUtils
.when(() -> JwtUtils.getUserRolesFromJWT(any(DecodedJWT.class)))
Expand Down

0 comments on commit 6be6b28

Please sign in to comment.