From bb06037b182a69b37601e918db099740cdbfea72 Mon Sep 17 00:00:00 2001 From: burdziak Date: Mon, 21 May 2018 15:46:50 +0200 Subject: Fixes sonar issues in API_Artifact Added missing negation Change-Id: I7d1e3c848d9ea8e93459d542402d2a99e4fa1216 Issue-ID: AAF-301 Signed-off-by: burdziak --- .../src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java | 11 +++++------ .../src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'auth/auth-certman') diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java index 5c067ce1..134ad7c5 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java @@ -40,16 +40,15 @@ import org.onap.aaf.auth.rserv.HttpMethods; */ public class API_Artifact { private static final String GET_ARTIFACTS = "Get Artifacts"; - + private static final String CERT_ARTIFACTS = "/cert/artifacts"; /** * Normal Init level APIs * * @param cmAPI - * @param facade * @throws Exception */ public static void init(final AAF_CM cmAPI) throws Exception { - cmAPI.route(HttpMethods.POST, "/cert/artifacts", API.ARTIFACTS, new Code(cmAPI,"Create Artifacts") { + cmAPI.route(HttpMethods.POST, CERT_ARTIFACTS, API.ARTIFACTS, new Code(cmAPI,"Create Artifacts") { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.createArtifacts(trans, req, resp); @@ -64,7 +63,7 @@ public class API_Artifact { /** * Use Query Params to get Artifacts by Machine or MechID */ - cmAPI.route(HttpMethods.GET, "/cert/artifacts", API.ARTIFACTS, new Code(cmAPI,GET_ARTIFACTS) { + cmAPI.route(HttpMethods.GET, CERT_ARTIFACTS, API.ARTIFACTS, new Code(cmAPI,GET_ARTIFACTS) { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.readArtifacts(trans, req, resp); @@ -91,7 +90,7 @@ public class API_Artifact { }); - cmAPI.route(HttpMethods.PUT, "/cert/artifacts", API.ARTIFACTS, new Code(cmAPI,"Update Artifacts") { + cmAPI.route(HttpMethods.PUT, CERT_ARTIFACTS, API.ARTIFACTS, new Code(cmAPI,"Update Artifacts") { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.updateArtifacts(trans, req, resp); @@ -117,7 +116,7 @@ public class API_Artifact { }); - cmAPI.route(HttpMethods.DELETE, "/cert/artifacts", API.VOID, new Code(cmAPI,"Delete Artifacts") { + cmAPI.route(HttpMethods.DELETE, CERT_ARTIFACTS, API.VOID, new Code(cmAPI,"Delete Artifacts") { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { Result r = context.deleteArtifacts(trans, req, resp); diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java index 13123bdf..a5e831ed 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java @@ -100,7 +100,7 @@ public class Mapper2_0 implements Mapper { */ @Override public Result toCert(AuthzTrans trans, Result in, boolean withTrustChain) throws IOException { - if(in.isOK()) { + if(!in.isOK()) { CertResp cin = in.value; CertInfo cout = newInstance(API.CERT); cout.setPrivatekey(cin.privateString()); -- cgit 1.2.3-korg