use delete level property in AafTopicSetupService
[dmaap/dbcapi.git] / src / test / java / org / onap / dmaap / dbcapi / aaf / AafServiceImplTest.java
index 69b320a..efce4a2 100644 (file)
@@ -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