Merge "Update INFO.yaml file"
authorPamela Dragosh <pdragosh@research.att.com>
Sat, 16 Mar 2019 14:56:13 +0000 (14:56 +0000)
committerGerrit Code Review <gerrit@onap.org>
Sat, 16 Mar 2019 14:56:13 +0000 (14:56 +0000)
main/src/main/java/org/onap/policy/pap/main/PolicyPapException.java
main/src/main/java/org/onap/policy/pap/main/PolicyPapRuntimeException.java
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/TestExceptions.java
main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeleteControllerV1.java

index 6459d6b..8e8b9b6 100644 (file)
@@ -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.
@@ -37,6 +38,15 @@ public class PolicyPapException extends Exception {
         super(message);
     }
 
+    /**
+     * 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.
      *
index e1df1b1..95b941f 100644 (file)
@@ -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.
@@ -37,6 +38,15 @@ public class PolicyPapRuntimeException extends RuntimeException {
         super(message);
     }
 
+    /**
+     * 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.
      *
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 b45cdab..9e3cda9 100644 (file)
@@ -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.
 
 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);
     }
 }
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);