aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorpkaras <piotr.karas@nokia.com>2019-06-05 15:39:45 +0200
committerPiotr Karaƛ <piotr.karas@nokia.com>2019-06-06 05:54:39 +0000
commit12d3560c7219af8d75ba9bab3b70b283252fe39d (patch)
treee9cb8eafba961a5d2592b63e65116ec03423b748 /src/main
parentc52d9c91d54f7e8b0500cebba00255b3e6b08c13 (diff)
AafServiceImpl junits
Change-Id: Icd8536a934e8657be956592583bb527a492cc8f6 Issue-ID: DMAAP-1217 Signed-off-by: piotr.karas <piotr.karas@nokia.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dmaap/dbcapi/aaf/AafServiceImpl.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafServiceImpl.java b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafServiceImpl.java
index 49810f3..edce4f0 100644
--- a/src/main/java/org/onap/dmaap/dbcapi/aaf/AafServiceImpl.java
+++ b/src/main/java/org/onap/dmaap/dbcapi/aaf/AafServiceImpl.java
@@ -25,10 +25,12 @@ import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
public class AafServiceImpl extends BaseLoggingClass implements AafService {
- private String aafUrl;
- private String identity;
- private boolean useAAF;
- private AafConnection aafConnection;
+ private static final int CREATED = 201;
+ private static final int OK = 200;
+ private final String aafUrl;
+ private final String identity;
+ private final boolean useAAF;
+ private final AafConnection aafConnection;
AafServiceImpl(boolean useAaf, String aafUrl, String identity, AafConnection aafConnection) {
this.useAAF = useAaf;
@@ -45,47 +47,47 @@ public class AafServiceImpl extends BaseLoggingClass implements AafService {
@Override
public int addPerm(DmaapPerm perm) {
logger.info("entry: addPerm() ");
- return doPost(perm, "authz/perm", 201);
+ return doPost(perm, "authz/perm", CREATED);
}
@Override
public int delPerm(DmaapPerm perm) {
- return 200;
+ return OK;
}
@Override
public int addGrant(DmaapGrant grant) {
logger.info("entry: addGrant() ");
- return doPost(grant, "authz/role/perm", 201);
+ return doPost(grant, "authz/role/perm", CREATED);
}
@Override
public int addUserRole(AafUserRole ur) {
logger.info("entry: addUserRole() ");
- return doPost(ur, "authz/userRole", 201);
+ return doPost(ur, "authz/userRole", CREATED);
}
@Override
public int delGrant(DmaapGrant grant) {
logger.info("entry: delGrant() ");
- return doDelete(grant, "authz/role/:" + grant.getRole() + "/perm", 200);
+ return doDelete(grant, "authz/role/:" + grant.getRole() + "/perm", OK);
}
@Override
public int addRole(AafRole role) {
logger.info("entry: addRole() ");
- return doPost(role, "authz/role", 201);
+ return doPost(role, "authz/role", CREATED);
}
@Override
public int addNamespace(AafNamespace ns) {
logger.info("entry: addNamespace() ");
- return doPost(ns, "authz/ns", 201);
+ return doPost(ns, "authz/ns", CREATED);
}
@Override
public int delNamespace(AafNamespace ns) {
- return 200;
+ return OK;
}
private int doPost(AafObject obj, String uri, int expect) {
@@ -136,7 +138,7 @@ public class AafServiceImpl extends BaseLoggingClass implements AafService {
case 404:
logger.warn("Object not found...ignore");
break;
- case 200:
+ case OK:
logger.info("expected response");
break;
default: