Updates to PDP deploy/undeploy per Ram's comments 11/82311/5
authorJim Hahn <jrh3@att.com>
Fri, 15 Mar 2019 17:23:57 +0000 (13:23 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 15 Mar 2019 18:23:10 +0000 (14:23 -0400)
Change-Id: Ic038ec8571cb50918c5f0d63602112ca05233629
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteControllerV1.java
main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeleteProvider.java
main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployControllerV1.java
main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupDeployProvider.java
main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java

index 1671611..e377c7c 100644 (file)
@@ -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) {
index f9619df..2a1d240 100644 (file)
@@ -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
      */
index a0a2ee8..3de3946 100644 (file)
@@ -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();
index e8ea357..a6424fc 100644 (file)
@@ -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.
index 0384bf7..dd4fe93 100644 (file)
@@ -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);