Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
add implementation for users list
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinSi96 committed Dec 19, 2023
1 parent 6a3b9d3 commit bef7284
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 6 deletions.
76 changes: 76 additions & 0 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4555,6 +4555,82 @@
} ]
}
},
"/scheduler/users" : {
"post" : {
"tags" : [ "scheduler" ],
"summary" : "startUsers",
"description" : "${swagger.ms-core.scheduler.api.start.users}",
"operationId" : "startUsersUsingPOST",
"parameters" : [ {
"name" : "size",
"in" : "query",
"description" : "size",
"required" : false,
"style" : "form",
"schema" : {
"type" : "integer",
"format" : "int32"
}
}, {
"name" : "productsFilter",
"in" : "query",
"description" : "productsFilter",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "userId",
"in" : "path",
"description" : "userId",
"required" : true,
"style" : "simple",
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"200" : {
"description" : "OK"
},
"400" : {
"description" : "Bad Request",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"404" : {
"description" : "Not Found",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
},
"409" : {
"description" : "Conflict",
"content" : {
"application/problem+json" : {
"schema" : {
"$ref" : "#/components/schemas/Problem"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ "global" ]
} ]
}
},
"/tokens/products/{productId}" : {
"get" : {
"tags" : [ "Token", "external-v2" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,16 @@ private void regenerateUserNotifications(Optional<String> userId){
else {
do {
List<OnboardedUser> users = userConnector.findAll(page, page_size_api.orElse(USER_PAGE_SIZE));

sendDataLakeUserNotifications(users, productId);
page += 1;
if (users.size() < USER_PAGE_SIZE) {
nextPage = false;
log.debug("[KAFKA] USER TOTAL NUMBER {}", page * USER_PAGE_SIZE + users.size());
}
}while(nextPage);
}
page_size_api = Optional.empty();
schedulerConfig.setScheduler(false);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ void getInstitutionUsers() {
User user = new User();
user.setId("id");
when(userConnector.findByInstitutionId(any())).thenReturn(List.of(userInfo));
when(userRegistryConnector.getUserByInternalId(any(), true)).thenReturn(user);
when(userRegistryConnector.getUserByInternalId(any(), anyBoolean())).thenReturn(user);
List<UserInfo> userInfos = institutionServiceImpl.getInstitutionUsers("test");
assertNotNull(userInfos);
assertFalse(userInfos.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ void testRetrieveUserFromUserRegistry() {
user.setId("42");
user.setName(certifiedField2);
user.setWorkContacts(new HashMap<>());
when(userRegistryConnector.getUserByInternalId( any(), true)).thenReturn(user);
when(userRegistryConnector.getUserByInternalId( any(), anyBoolean())).thenReturn(user);
assertSame(user, userServiceImpl.retrieveUserFromUserRegistry("42"));
verify(userRegistryConnector).getUserByInternalId( any(), true);
verify(userRegistryConnector).getUserByInternalId( user.getId(), true);
}

/**
Expand Down Expand Up @@ -420,7 +420,7 @@ void retrievePersonOk(){
CertifiedField<String> certMail = new CertifiedField<>();
certMail.setValue("[email protected]");
user.setEmail(certMail);
when(userRegistryConnector.getUserByInternalId(any(), true)).thenReturn(user);
when(userRegistryConnector.getUserByInternalId(any(), anyBoolean())).thenReturn(user);
Map<String, WorkContact> map = new HashMap<>();
WorkContact contact = new WorkContact();
CertifiedField<String> mail = new CertifiedField<>();
Expand Down Expand Up @@ -461,7 +461,7 @@ void retrievePersonOkWithoutProductFilter(){
contact.setEmail(mail);
map.put("id", contact);
user.setWorkContacts(map);
when(userRegistryConnector.getUserByInternalId(any(), true)).thenReturn(user);
when(userRegistryConnector.getUserByInternalId(any(), anyBoolean())).thenReturn(user);

User response = userServiceImpl.retrievePerson("userId",null, null);

Expand Down

0 comments on commit bef7284

Please sign in to comment.