summaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-05-21 15:46:50 +0200
committerburdziak <olaf.burdziakowski@nokia.com>2018-06-25 14:26:26 +0200
commitbb06037b182a69b37601e918db099740cdbfea72 (patch)
treea8cd1d23d3cca7679cbe54efa2741ffb09736035 /auth
parentc8f8273a200559f87b883767758e4bda446dadfe (diff)
Fixes sonar issues in API_Artifact
Added missing negation Change-Id: I7d1e3c848d9ea8e93459d542402d2a99e4fa1216 Issue-ID: AAF-301 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/api/API_Artifact.java11
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/mapper/Mapper2_0.java2
2 files changed, 6 insertions, 7 deletions
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<Void> 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<Void> 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<Void> 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<Void> 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<BaseRequest,CertInfo,Artifacts,Error> {
*/
@Override
public Result<CertInfo> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException {
- if(in.isOK()) {
+ if(!in.isOK()) {
CertResp cin = in.value;
CertInfo cout = newInstance(API.CERT);
cout.setPrivatekey(cin.privateString());