X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdbcapi.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Faaf%2FAafServiceImplTest.java;fp=src%2Ftest%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdbcapi%2Faaf%2FAafServiceImplTest.java;h=efce4a20e56e6fdb9bd5d32a63d25ebb584a186d;hp=69b320a4afe2754fd653f275c74bd3571c23fce5;hb=392df8b9b82da9a700e1b7368e4d5b03de2a6067;hpb=27a9a302a7d7e1894732535a8eb61f3460637b24 diff --git a/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java b/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java index 69b320a..efce4a2 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java @@ -113,16 +113,6 @@ public class AafServiceImplTest { 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); @@ -134,17 +124,6 @@ public class AafServiceImplTest { 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) { @@ -160,9 +139,9 @@ public class AafServiceImplTest { @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); } @@ -206,4 +185,24 @@ public class AafServiceImplTest { 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