summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java12
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java12
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java8
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java4
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java10
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java6
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/TestExceptions.java17
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java4
8 files changed, 45 insertions, 28 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java b/main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java
index 6459d6bb..8e8b9b61 100644
--- a/main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java
+++ b/main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java
@@ -1,6 +1,7 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +39,15 @@ public class PolicyPapException extends Exception {
}
/**
+ * Instantiates a new policy pap exception with a caused by exception.
+ *
+ * @param exp the exception that caused this exception to be thrown
+ */
+ public PolicyPapException(final Exception exp) {
+ super(exp);
+ }
+
+ /**
* Instantiates a new policy pap exception with a message and a caused by exception.
*
* @param message the message
diff --git a/main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java b/main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java
index e1df1b16..95b941f6 100644
--- a/main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java
+++ b/main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java
@@ -1,6 +1,7 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +39,15 @@ public class PolicyPapRuntimeException extends RuntimeException {
}
/**
+ * Instantiates a new policy pap runtime exception with a caused by exception.
+ *
+ * @param exp the exception that caused this exception to be thrown
+ */
+ public PolicyPapRuntimeException(final Exception exp) {
+ super(exp);
+ }
+
+ /**
* Instantiates a new policy pap runtime exception with a message and a caused by exception.
*
* @param message the message
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java
index 16716117..e377c7ca 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java
@@ -87,7 +87,7 @@ public class PdpGroupDeleteControllerV1 extends PapRestControllerV1 {
}
/**
- * Deletes a PDP group.
+ * Deletes a particular version of a PDP group.
*
* @param requestId request ID used in ONAP logging
* @param groupName name of the PDP group to be deleted
@@ -162,7 +162,7 @@ public class PdpGroupDeleteControllerV1 extends PapRestControllerV1 {
@ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)})
// @formatter:on
- public Response deletePolicies(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
+ public Response deletePolicy(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
@ApiParam(value = "PDP Policy Name", required = true) @PathParam("name") String policyName) {
Pair<Status, PdpGroupDeleteResponse> pair = provider.deletePolicy(policyName, null);
@@ -172,7 +172,7 @@ public class PdpGroupDeleteControllerV1 extends PapRestControllerV1 {
}
/**
- * Deletes a PDP policy.
+ * Deletes a specific version of a PDP policy.
*
* @param requestId request ID used in ONAP logging
* @param policyName name of the PDP Policy to be deleted
@@ -204,7 +204,7 @@ public class PdpGroupDeleteControllerV1 extends PapRestControllerV1 {
@ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)})
// @formatter:on
- public Response deletePoliciesVersion(
+ public Response deletePolicyVersion(
@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
@ApiParam(value = "PDP Policy Name", required = true) @PathParam("name") String policyName,
@ApiParam(value = "PDP Policy Version", required = true) @PathParam("version") String version) {
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java
index f9619df3..2a1d240d 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java
@@ -57,10 +57,10 @@ public class PdpGroupDeleteProvider {
}
/**
- * Deletes a PDP group.
+ * Deletes a PDP policy.
*
* @param policyId id of the policy to be deleted
- * @param version group version to delete; may be {@code null} if the group has only
+ * @param version policy version to delete; may be {@code null} if the policy has only
* one version
* @return a pair containing the status and the response
*/
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java
index a0a2ee8f..3de39465 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java
@@ -35,8 +35,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.models.pap.concepts.PdpGroup;
import org.onap.policy.models.pap.concepts.PdpGroupDeployResponse;
+import org.onap.policy.models.pap.concepts.PdpGroups;
import org.onap.policy.models.pap.concepts.PdpPolicies;
/**
@@ -50,13 +50,13 @@ public class PdpGroupDeployControllerV1 extends PapRestControllerV1 {
* Deploys or updates a PDP group.
*
* @param requestId request ID used in ONAP logging
- * @param group PDP group configuration
+ * @param groups PDP group configuration
* @return a response
*/
// @formatter:off
@POST
@Path("pdps")
- @ApiOperation(value = "Deploy or update PDP Group",
+ @ApiOperation(value = "Deploy or update PDP Groups",
notes = "Deploys or updates a PDP Group, returning optional error details",
response = PdpGroupDeployResponse.class,
tags = {"Policy Administration (PAP) API"},
@@ -79,9 +79,9 @@ public class PdpGroupDeployControllerV1 extends PapRestControllerV1 {
// @formatter:on
public Response deployGroup(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId,
- @ApiParam(value = "PDP Group Configuration", required = true) PdpGroup group) {
+ @ApiParam(value = "List of PDP Group Configuration", required = true) PdpGroups groups) {
- Pair<Status, PdpGroupDeployResponse> pair = provider.deployGroup(group);
+ Pair<Status, PdpGroupDeployResponse> pair = provider.deployGroup(groups);
return addLoggingHeaders(addVersionControlHeaders(Response.status(pair.getLeft())), requestId)
.entity(pair.getRight()).build();
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java
index e8ea357b..a6424fce 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java
@@ -22,8 +22,8 @@ package org.onap.policy.pap.main.rest;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.models.pap.concepts.PdpGroup;
import org.onap.policy.models.pap.concepts.PdpGroupDeployResponse;
+import org.onap.policy.models.pap.concepts.PdpGroups;
import org.onap.policy.models.pap.concepts.PdpPolicies;
/**
@@ -34,10 +34,10 @@ public class PdpGroupDeployProvider {
/**
* Deploys or updates a PDP group.
*
- * @param group PDP group configuration
+ * @param groups PDP group configuration
* @return a pair containing the status and the response
*/
- public Pair<Response.Status, PdpGroupDeployResponse> deployGroup(PdpGroup group) {
+ public Pair<Response.Status, PdpGroupDeployResponse> deployGroup(PdpGroups groups) {
/*
* TODO Lock for updates - return error if already locked.
diff --git a/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java b/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
index b45cdab7..9e3cda9c 100644
--- a/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
+++ b/main/src/test/java/org/onap/policy/pap/main/TestExceptions.java
@@ -1,6 +1,7 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +21,10 @@
package org.onap.policy.pap.main;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-
import org.junit.Test;
+import org.onap.policy.common.utils.test.ExceptionsTester;
+import org.onap.policy.pap.main.PolicyPapException;
+import org.onap.policy.pap.main.PolicyPapRuntimeException;
/**
* Class to perform unit test of {@link PolicyPapException PolicyPapRuntimeException}}.
@@ -35,10 +35,7 @@ public class TestExceptions {
@Test
public void test() {
- assertNotNull(new PolicyPapException("Message"));
- assertNotNull(new PolicyPapException("Message", new IOException()));
-
- assertNotNull(new PolicyPapRuntimeException("Message"));
- assertNotNull(new PolicyPapRuntimeException("Message", new IOException()));
+ new ExceptionsTester().test(PolicyPapException.class);
+ new ExceptionsTester().test(PolicyPapRuntimeException.class);
}
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java
index 0384bf7e..dd4fe937 100644
--- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java
+++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java
@@ -82,7 +82,7 @@ public class TestPdpGroupDeleteControllerV1 extends CommonPapRestServer {
}
@Test
- public void testDeletePolicies() throws Exception {
+ public void testDeletePolicy() throws Exception {
String uri = DELETE_POLICIES_ENDPOINT + "/my-name";
Invocation.Builder invocationBuilder = sendRequest(uri);
@@ -101,7 +101,7 @@ public class TestPdpGroupDeleteControllerV1 extends CommonPapRestServer {
}
@Test
- public void testDeletePoliciesVersion() throws Exception {
+ public void testDeletePolicyVersion() throws Exception {
String uri = DELETE_POLICIES_ENDPOINT + "/my-name/versions/3";
Invocation.Builder invocationBuilder = sendRequest(uri);