From 27a9a302a7d7e1894732535a8eb61f3460637b24 Mon Sep 17 00:00:00 2001 From: pkaras Date: Thu, 6 Jun 2019 07:28:05 +0200 Subject: deleting namespace and permission implementation Change-Id: If9e3dc12da186cfee42ae0816e39ba868cb82ad5 Issue-ID: DMAAP-1217 Signed-off-by: piotr.karas --- .../onap/dmaap/dbcapi/aaf/AafServiceImplTest.java | 41 ++++++++++++++++++++++ .../dbcapi/service/AafTopicSetupServiceTest.java | 4 +-- 2 files changed, 43 insertions(+), 2 deletions(-) (limited to 'src/test/java/org/onap') 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 fd70a16..69b320a 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/aaf/AafServiceImplTest.java @@ -33,6 +33,7 @@ import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.then; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verifyZeroInteractions; @RunWith(JUnitParamsRunner.class) @@ -165,4 +166,44 @@ public class AafServiceImplTest { assertEquals(aafServiceReturnedCode, status); } + + @Test + public void shouldDeletePermission() { + DmaapPerm perm = new DmaapPerm("permName", "type", "action"); + + int status = aafService.delPerm(perm, false); + + then(aafConnection).should().delAaf(any(AafEmpty.class), eq(AAF_URL + "authz/perm/permName/type/action")); + assertEquals(OK, status); + } + + @Test + public void shouldDeletePermissionWithForce() { + DmaapPerm perm = new DmaapPerm("permName", "type", "action"); + + int status = aafService.delPerm(perm, true); + + then(aafConnection).should().delAaf(any(AafEmpty.class), eq(AAF_URL + "authz/perm/permName/type/action?force=true")); + assertEquals(OK, status); + } + + @Test + public void shouldDeleteNamespace() { + AafNamespace ns = new AafNamespace("nsName", "ident"); + + int status = aafService.delNamespace(ns, false); + + then(aafConnection).should().delAaf(any(AafEmpty.class), eq(AAF_URL + "authz/ns/nsName")); + assertEquals(OK, status); + } + + @Test + public void shouldDeleteNamespaceWithForce() { + AafNamespace ns = new AafNamespace("nsName", "ident"); + + int status = aafService.delNamespace(ns, true); + + then(aafConnection).should().delAaf(any(AafEmpty.class), eq(AAF_URL + "authz/ns/nsName?force=true")); + assertEquals(OK, status); + } } \ No newline at end of file diff --git a/src/test/java/org/onap/dmaap/dbcapi/service/AafTopicSetupServiceTest.java b/src/test/java/org/onap/dmaap/dbcapi/service/AafTopicSetupServiceTest.java index 1317b97..8fd8c6f 100644 --- a/src/test/java/org/onap/dmaap/dbcapi/service/AafTopicSetupServiceTest.java +++ b/src/test/java/org/onap/dmaap/dbcapi/service/AafTopicSetupServiceTest.java @@ -336,7 +336,7 @@ public class AafTopicSetupServiceTest { } @Override - public int delPerm(DmaapPerm perm) { + public int delPerm(DmaapPerm perm, boolean force) { removedPerms.add(perm); return removePermStatus; } @@ -370,7 +370,7 @@ public class AafTopicSetupServiceTest { } @Override - public int delNamespace(AafNamespace namespace) { + public int delNamespace(AafNamespace namespace, boolean force) { this.removedNamespace = namespace; return removeNamespaceStatus; } -- cgit 1.2.3-korg