aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java')
-rw-r--r--src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java45
1 files changed, 22 insertions, 23 deletions
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
@@ -114,16 +114,6 @@ public class AafServiceImplTest {
}
@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);
DmaapPerm perm = new DmaapPerm("perm", "type", "action");
@@ -135,17 +125,6 @@ public class AafServiceImplTest {
}
@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) {
given(aafConnection.postAaf(any(AafObject.class), anyString())).willReturn(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