assertEquals(CREATED, status);
}
- @Test
- public void shouldDeleteDmaapGrant() {
- DmaapGrant grant = new DmaapGrant(new DmaapPerm("perm", "type", "action"), "roles");
-
- int status = aafService.delGrant(grant);
-
- then(aafConnection).should().delAaf(grant, AAF_URL + "authz/role/:" + grant.getRole() + "/perm");
- assertEquals(OK, status);
- }
-
@Test
public void shouldNotConnectToAafDuringCreate() {
aafService = new AafServiceImpl(false, AAF_URL, IDENTITY, aafConnection);
assertEquals(CREATED, status);
}
- @Test
- public void shouldNotConnectToAafDuringDelete() {
- aafService = new AafServiceImpl(false, AAF_URL, IDENTITY, aafConnection);
- DmaapGrant grant = new DmaapGrant(new DmaapPerm("perm", "type", "action"), "roles");
-
- int status = aafService.delGrant(grant);
-
- verifyZeroInteractions(aafConnection);
- assertEquals(OK, status);
- }
-
@Test
@Parameters({"401", "403", "409", "200", "500"})
public void shouldHandleErrorDuringCreate(int aafServiceReturnedCode) {
@Parameters({"401", "403", "404", "200", "500"})
public void shouldHandleErrorDuringDelete(int aafServiceReturnedCode) {
given(aafConnection.delAaf(any(AafObject.class), anyString())).willReturn(aafServiceReturnedCode);
- DmaapGrant grant = new DmaapGrant(new DmaapPerm("perm", "type", "action"), "roles");
+ DmaapPerm perm = new DmaapPerm("perm", "type", "action");
- int status = aafService.delGrant(grant);
+ int status = aafService.delPerm(perm, false);
assertEquals(aafServiceReturnedCode, status);
}
then(aafConnection).should().delAaf(any(AafEmpty.class), eq(AAF_URL + "authz/ns/nsName?force=true"));
assertEquals(OK, status);
}
+
+ @Test
+ public void shouldReturnExpectedCodeDuringPostWhenUseAffIsSetToFalse() {
+ aafService = new AafServiceImpl(false, AAF_URL, IDENTITY, aafConnection);
+ DmaapPerm perm = new DmaapPerm("perm", "type", "action");
+
+ int status = aafService.addPerm(perm);
+
+ assertEquals(CREATED, status);
+ }
+
+ @Test
+ public void shouldReturnExpectedCodeDuringDeleteWhenUseAffIsSetToFalse() {
+ aafService = new AafServiceImpl(false, AAF_URL, IDENTITY, aafConnection);
+ DmaapPerm perm = new DmaapPerm("perm", "type", "action");
+
+ int status = aafService.delPerm(perm, false);
+
+ assertEquals(OK, status);
+ }
}
\ No newline at end of file