Skip to content

Commit

Permalink
MAT-7842 hapi fhir update
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-cecilialiu committed Dec 5, 2024
1 parent ea7f962 commit c75c96d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<version>3.4.0</version>
<relativePath></relativePath>
<!-- lookup parent from repository -->
</parent>
Expand Down Expand Up @@ -107,7 +107,7 @@
<dependency>
<groupId>gov.cms.madie</groupId>
<artifactId>madie-rest-commons</artifactId>
<version>0.0.6-SNAPSHOT</version>
<version>0.0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ public void testUpdateAccessControl() {
when(cqlLibraryService.updateAccessControlList(anyString(), any()))
.thenReturn(aclSpecifications);

ResponseEntity<List<AclSpecification>> output = cqlLibraryController.updateAccessControl(request, "1", aclOperation, "key");
ResponseEntity<List<AclSpecification>> output =
cqlLibraryController.updateAccessControl(request, "1", aclOperation, "key");

verify(cqlLibraryService, times(1)).updateAccessControlList(anyString(), any());
assertThat(output.getBody(), equalTo(aclSpecifications));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void testUpdateAccessControlListWithNoLibrary() {

Exception ex =
assertThrows(
ResourceNotFoundException.class, () -> cqlLibraryService.updateAccessControlList(library.getId(), aclOperation));
ResourceNotFoundException.class,
() -> cqlLibraryService.updateAccessControlList(library.getId(), aclOperation));
assertEquals(ex.getMessage(), "Library does not exist: " + library.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void testGrantOperationNoLibrarySetFound() {

Exception ex =
assertThrows(
ResourceNotFoundException.class, () -> librarySetService.updateLibrarySetAcls(librarySetId, aclOperation));
ResourceNotFoundException.class,
() -> librarySetService.updateLibrarySetAcls(librarySetId, aclOperation));
assertEquals(ex.getMessage(), "Could not find resource LibrarySet with id: " + librarySetId);
}

Expand All @@ -94,18 +95,17 @@ public void testGrantOperationAsFirstNewAcl() {

@Test
public void testGrantOperationAsFirstNewAclWithNoAclsInLibrarySet() {
LibrarySet librarySetWithNoAcls = LibrarySet.builder()
.librarySetId("1")
.owner("user-1")
.build();
LibrarySet librarySetWithNoAcls =
LibrarySet.builder().librarySetId("1").owner("user-1").build();
AclSpecification aclSpec = new AclSpecification();
aclSpec.setUserId("john_1");
aclSpec.setRoles(Set.of(RoleEnum.SHARED_WITH));
AclOperation aclOperation =
AclOperation.builder().acls(List.of(aclSpec)).action(AclOperation.AclAction.GRANT).build();
LibrarySet updatedLibrarySet =
LibrarySet.builder().librarySetId("1").owner("john_1").acls(List.of(aclSpec)).build();
when(librarySetRepository.findByLibrarySetId(anyString())).thenReturn(Optional.of(librarySetWithNoAcls));
when(librarySetRepository.findByLibrarySetId(anyString()))
.thenReturn(Optional.of(librarySetWithNoAcls));
when(librarySetRepository.save(any(LibrarySet.class))).thenReturn(updatedLibrarySet);

LibrarySet librarySet = librarySetService.updateLibrarySetAcls("1", aclOperation);
Expand Down

0 comments on commit c75c96d

Please sign in to comment.