Removing plugin dependency from distribution main 01/63101/2
authorramverma <ram.krishna.verma@ericsson.com>
Mon, 27 Aug 2018 16:31:03 +0000 (17:31 +0100)
committerramverma <ram.krishna.verma@ericsson.com>
Tue, 28 Aug 2018 10:06:26 +0000 (11:06 +0100)
* Removing plugin dependency from main. Ideally main should not be
dependent on plugins.
* Creating dummy handler, decoder, forwarder classes for test cases in
main.
* Combined few json test files.
* Added more test cases.

Change-Id: Id75e21d5d403febd9ac2b059661e17663d638dc2
Issue-ID: POLICY-1035
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
29 files changed:
main/pom.xml
main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterGroup.java
main/src/test/java/org/onap/policy/distribution/main/parameters/TestDistributionParameterHandler.java
main/src/test/java/org/onap/policy/distribution/main/parameters/TestPluginHandlerParameters.java
main/src/test/java/org/onap/policy/distribution/main/startstop/TestDistributionActivator.java
main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java [new file with mode: 0644]
main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarder.java [new file with mode: 0644]
main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandler.java [new file with mode: 0644]
main/src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt [new file with mode: 0644]
main/src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt [new file with mode: 0644]
main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt [new file with mode: 0644]
main/src/test/resources/parameters/DistributionConfigParameters.json
main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyDecoder.json
main/src/test/resources/parameters/DistributionConfigParameters_EmptyPolicyForwarder.json
main/src/test/resources/parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json [moved from main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json with 65% similarity]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidName.json
main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json [moved from main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json with 78% similarity]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerParameters.json [moved from main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerUser.json with 73% similarity]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json [deleted file]
main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyDecoder.json
main/src/test/resources/parameters/DistributionConfigParameters_NoPolicyForwarder.json
main/src/test/resources/parameters/MinimumParameters.json

index 2b00e32..fdaebbd 100644 (file)
     <dependencies>
         <dependency>
             <groupId>org.onap.policy.distribution</groupId>
-            <artifactId>reception-plugins</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.distribution</groupId>
-            <artifactId>forwarding-plugins</artifactId>
+            <artifactId>reception</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
index 62ad067..ac58b83 100644 (file)
@@ -43,18 +43,17 @@ public class CommonTestData {
     private static final int REST_SERVER_PORT = 6969;
     private static final String REST_SERVER_HOST = "0.0.0.0";
     public static final String DISTRIBUTION_GROUP_NAME = "SDCDistributionGroup";
-    public static final String DECODER_TYPE = "TOSCA";
-    public static final String DECODER_CLASS_NAME =
-            "org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx";
-    public static final String FORWARDER_TYPE = "PAPEngine";
+    public static final String DECODER_TYPE = "DummyDecoder";
+    public static final String DECODER_CLASS_NAME = "org.onap.policy.distribution.main.testclasses.DummyDecoder";
+    public static final String FORWARDER_TYPE = "DummyForwarder";
     public static final String FORWARDER_CLASS_NAME =
-            "org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder";
-    public static final String RECEPTION_HANDLER_TYPE = "SDC";
+            "org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder";
+    public static final String RECEPTION_HANDLER_TYPE = "DummyReceptionHandler";
     public static final String RECEPTION_HANDLER_CLASS_NAME =
-            "org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler";
-    public static final String SDC_RECEPTION_HANDLER_KEY = "SDCReceptionHandler";
-    public static final String PAP_ENGINE_FORWARDER_KEY = "PAPEngineForwarder";
-    public static final String TOSCA_DECODER_KEY = "TOSCADecoder";
+            "org.onap.policy.distribution.main.testclasses.DummyReceptionHandler";
+    public static final String DUMMY_RECEPTION_HANDLER_KEY = "DummyReceptionHandler";
+    public static final String DUMMY_ENGINE_FORWARDER_KEY = "DummyForwarder";
+    public static final String DUMMY_DECODER_KEY = "DummyDecoder";
 
     /**
      * Returns an instance of ReceptionHandlerParameters for test cases.
@@ -89,7 +88,7 @@ public class CommonTestData {
             final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
             final ReceptionHandlerParameters rhParameters = new ReceptionHandlerParameters(RECEPTION_HANDLER_TYPE,
                     RECEPTION_HANDLER_CLASS_NAME, pssdConfiguration, pHParameters);
-            receptionHandlerParameters.put(SDC_RECEPTION_HANDLER_KEY, rhParameters);
+            receptionHandlerParameters.put(DUMMY_RECEPTION_HANDLER_KEY, rhParameters);
         }
         return receptionHandlerParameters;
     }
@@ -145,7 +144,7 @@ public class CommonTestData {
         if (!isEmpty) {
             final PolicyForwarderParameters pFParameters =
                     new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME);
-            policyForwarders.put(PAP_ENGINE_FORWARDER_KEY, pFParameters);
+            policyForwarders.put(DUMMY_ENGINE_FORWARDER_KEY, pFParameters);
         }
         return policyForwarders;
     }
@@ -160,7 +159,7 @@ public class CommonTestData {
         final Map<String, PolicyDecoderParameters> policyDecoders = new HashMap<String, PolicyDecoderParameters>();
         if (!isEmpty) {
             final PolicyDecoderParameters pDParameters = new PolicyDecoderParameters(DECODER_TYPE, DECODER_CLASS_NAME);
-            policyDecoders.put(TOSCA_DECODER_KEY, pDParameters);
+            policyDecoders.put(DUMMY_DECODER_KEY, pDParameters);
         }
         return policyDecoders;
     }
index f6ed0f9..6d5135e 100644 (file)
@@ -56,16 +56,18 @@ public class TestDistributionParameterGroup {
         assertEquals(restServerParameters.getPassword(),
                 distributionParameters.getRestServerParameters().getPassword());
         assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, distributionParameters.getName());
-        assertEquals(receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+        assertEquals(
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerType());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerClassName(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
+                        .getReceptionHandlerClassName(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerClassName());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getPluginHandlerParameters());
     }
 
@@ -80,16 +82,18 @@ public class TestDistributionParameterGroup {
         final GroupValidationResult validationResult = distributionParameters.validate();
         assertFalse(validationResult.isValid());
         assertEquals(null, distributionParameters.getName());
-        assertEquals(receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+        assertEquals(
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerType());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerClassName(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
+                        .getReceptionHandlerClassName(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerClassName());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getPluginHandlerParameters());
         assertTrue(validationResult.getResult().contains(
                 "field \"name\" type \"java.lang.String\" value \"null\" INVALID, " + "must be a non-blank string"));
@@ -106,16 +110,18 @@ public class TestDistributionParameterGroup {
         final GroupValidationResult validationResult = distributionParameters.validate();
         assertFalse(validationResult.isValid());
         assertEquals("", distributionParameters.getName());
-        assertEquals(receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+        assertEquals(
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerType());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerClassName(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
+                        .getReceptionHandlerClassName(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getReceptionHandlerClassName());
         assertEquals(
-                receptionHandlerParameters.get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
-                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
+                receptionHandlerParameters.get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters(),
+                distributionParameters.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
                         .getPluginHandlerParameters());
         assertTrue(validationResult.getResult().contains(
                 "field \"name\" type \"java.lang.String\" value \"\" INVALID, " + "must be a non-blank string"));
index a324e3d..25f2421 100644 (file)
@@ -24,6 +24,10 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
 import org.junit.Test;
 import org.onap.policy.distribution.main.PolicyDistributionException;
 import org.onap.policy.distribution.main.startstop.DistributionCommandLineArguments;
@@ -139,17 +143,18 @@ public class TestDistributionParameterHandler {
         arguments.parse(distributionConfigParameters);
 
         final DistributionParameterGroup parGroup = new DistributionParameterHandler().getParameters(arguments);
+        assertTrue(arguments.checkSetConfigurationFilePath());
         assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, parGroup.getName());
         assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE, parGroup.getReceptionHandlerParameters()
-                .get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType());
+                .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType());
         assertEquals(CommonTestData.DECODER_TYPE,
-                parGroup.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
-                        .getPluginHandlerParameters().getPolicyDecoders().get(CommonTestData.TOSCA_DECODER_KEY)
+                parGroup.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
+                        .getPluginHandlerParameters().getPolicyDecoders().get(CommonTestData.DUMMY_DECODER_KEY)
                         .getDecoderType());
         assertEquals(CommonTestData.FORWARDER_TYPE,
-                parGroup.getReceptionHandlerParameters().get(CommonTestData.SDC_RECEPTION_HANDLER_KEY)
-                        .getPluginHandlerParameters().getPolicyForwarders().get(CommonTestData.PAP_ENGINE_FORWARDER_KEY)
-                        .getForwarderType());
+                parGroup.getReceptionHandlerParameters().get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY)
+                        .getPluginHandlerParameters().getPolicyForwarders()
+                        .get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY).getForwarderType());
     }
 
     @Test
@@ -169,58 +174,6 @@ public class TestDistributionParameterHandler {
         }
     }
 
-    @Test
-    public void testDistributionParameterGroup_InvalidReceptionHandlerType() throws PolicyDistributionException {
-        final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json" };
-
-        final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage()
-                    .contains("field \"receptionHandlerType\" type \"java.lang.String\" value \" \" INVALID, "
-                            + "must be a non-blank string"));
-        }
-    }
-
-    @Test
-    public void testDistributionParameterGroup_InvalidPolicyDecoderType() throws PolicyDistributionException {
-        final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json" };
-
-        final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage().contains(
-                    "field \"decoderType\" type \"java.lang.String\" value \" \" INVALID, must be a non-blank string"));
-        }
-    }
-
-    @Test
-    public void testDistributionParameterGroup_InvalidPolicyForwarderType() throws PolicyDistributionException {
-        final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidPolicyForwarderType.json" };
-
-        final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage().contains("field \"forwarderType\" type \"java.lang.String\" value \" \" INVALID, "
-                    + "must be a non-blank string"));
-        }
-    }
-
     @Test
     public void testDistributionParameterGroup_NoReceptionHandler() throws PolicyDistributionException {
         final String[] distributionConfigParameters =
@@ -318,9 +271,10 @@ public class TestDistributionParameterHandler {
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidReceptionHandlerClass() throws PolicyDistributionException {
+    public void testDistributionParameterGroup_InvalidReceptionHandlerParameters()
+            throws PolicyDistributionException, IOException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json" };
+        { "-c", "parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json" };
 
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
         arguments.parse(distributionConfigParameters);
@@ -329,14 +283,18 @@ public class TestDistributionParameterHandler {
             new DistributionParameterHandler().getParameters(arguments);
             fail("test should throw an exception here");
         } catch (final Exception e) {
-            assertTrue(e.getMessage().contains("reception handler class not found in classpath"));
+            final String expectedResult = new String(Files.readAllBytes(
+                    Paths.get("src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt")))
+                            .replaceAll("\\s+", "");
+            assertEquals(expectedResult, e.getMessage().replaceAll("\\s+", ""));
         }
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidPolicyDecoderClass() throws PolicyDistributionException {
+    public void testDistributionParameterGroup_InvalidDecoderAndForwarderParameters()
+            throws PolicyDistributionException, IOException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidPolicyDecoderClass.json" };
+        { "-c", "parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json" };
 
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
         arguments.parse(distributionConfigParameters);
@@ -345,14 +303,18 @@ public class TestDistributionParameterHandler {
             new DistributionParameterHandler().getParameters(arguments);
             fail("test should throw an exception here");
         } catch (final Exception e) {
-            assertTrue(e.getMessage().contains("policy decoder class not found in classpath"));
+            final String expectedResult = new String(Files.readAllBytes(
+                    Paths.get("src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt")))
+                            .replaceAll("\\s+", "");
+            assertEquals(expectedResult, e.getMessage().replaceAll("\\s+", ""));
         }
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidPolicyForwarderClass() throws PolicyDistributionException {
+    public void testDistributionParameterGroup_InvalidRestServerParameters()
+            throws PolicyDistributionException, IOException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json" };
+        { "-c", "parameters/DistributionConfigParameters_InvalidRestServerParameters.json" };
 
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
         arguments.parse(distributionConfigParameters);
@@ -361,75 +323,40 @@ public class TestDistributionParameterHandler {
             new DistributionParameterHandler().getParameters(arguments);
             fail("test should throw an exception here");
         } catch (final Exception e) {
-            assertTrue(e.getMessage().contains("policy forwarder class not found in classpath"));
+            final String expectedResult = new String(Files.readAllBytes(
+                    Paths.get("src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt")))
+                            .replaceAll("\\s+", "");
+            assertEquals(expectedResult, e.getMessage().replaceAll("\\s+", ""));
         }
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidRestServerHost() throws PolicyDistributionException {
+    public void testDistributionVersion() throws PolicyDistributionException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidRestServerHost.json" };
-
+        { "-v" };
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage().contains(
-                    "must be a non-blank string containing hostname/ipaddress of the distribution rest server"));
-        }
+        final String version = arguments.parse(distributionConfigParameters);
+        assertTrue(version.startsWith("ONAP Policy Framework Distribution Service"));
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidRestServerPort() throws PolicyDistributionException {
+    public void testDistributionHelp() throws PolicyDistributionException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidRestServerPort.json" };
-
+        { "-h" };
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage()
-                    .contains("must be a positive integer containing port of the distribution rest server"));
-        }
+        final String help = arguments.parse(distributionConfigParameters);
+        assertTrue(help.startsWith("usage:"));
     }
 
     @Test
-    public void testDistributionParameterGroup_InvalidRestServerUser() throws PolicyDistributionException {
+    public void testDistributionInvalidOption() throws PolicyDistributionException {
         final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidRestServerUser.json" };
-
+        { "-d" };
         final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
         try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage().contains(
-                    "must be a non-blank string containing userName for distribution rest server credentials"));
-        }
-    }
-
-    @Test
-    public void testDistributionParameterGroup_InvalidRestServerPassword() throws PolicyDistributionException {
-        final String[] distributionConfigParameters =
-        { "-c", "parameters/DistributionConfigParameters_InvalidRestServerPassword.json" };
-
-        final DistributionCommandLineArguments arguments = new DistributionCommandLineArguments();
-        arguments.parse(distributionConfigParameters);
-
-        try {
-            new DistributionParameterHandler().getParameters(arguments);
-            fail("test should throw an exception here");
-        } catch (final Exception e) {
-            assertTrue(e.getMessage().contains(
-                    "must be a non-blank string containing password for distribution rest server credentials"));
+            arguments.parse(distributionConfigParameters);
+        } catch (final Exception exp) {
+            assertTrue(exp.getMessage().startsWith("invalid command line arguments specified"));
         }
     }
 }
index 4d9e584..5e94dc9 100644 (file)
@@ -46,10 +46,10 @@ public class TestPluginHandlerParameters {
         final Map<String, PolicyForwarderParameters> policyForwarders = commonTestData.getPolicyForwarders(false);
         final PluginHandlerParameters pHParameters = new PluginHandlerParameters(policyDecoders, policyForwarders);
         final GroupValidationResult validationResult = pHParameters.validate();
-        assertEquals(policyDecoders.get(CommonTestData.TOSCA_DECODER_KEY),
-                pHParameters.getPolicyDecoders().get(CommonTestData.TOSCA_DECODER_KEY));
-        assertEquals(policyForwarders.get(CommonTestData.PAP_ENGINE_FORWARDER_KEY),
-                pHParameters.getPolicyForwarders().get(CommonTestData.PAP_ENGINE_FORWARDER_KEY));
+        assertEquals(policyDecoders.get(CommonTestData.DUMMY_DECODER_KEY),
+                pHParameters.getPolicyDecoders().get(CommonTestData.DUMMY_DECODER_KEY));
+        assertEquals(policyForwarders.get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY),
+                pHParameters.getPolicyForwarders().get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY));
         assertTrue(validationResult.isValid());
     }
 
index 7cfb5ef..c901b5d 100644 (file)
@@ -38,7 +38,8 @@ public class TestDistributionActivator {
 
     @Test
     public void testDistributionActivator() throws PolicyDistributionException {
-        final String[] distributionConfigParameters = { "-c", "parameters/DistributionConfigParameters.json" };
+        final String[] distributionConfigParameters =
+        { "-c", "parameters/DistributionConfigParameters.json" };
 
         final DistributionCommandLineArguments arguments =
                 new DistributionCommandLineArguments(distributionConfigParameters);
@@ -51,15 +52,15 @@ public class TestDistributionActivator {
         assertEquals(CommonTestData.DISTRIBUTION_GROUP_NAME, activator.getParameterGroup().getName());
         assertEquals(CommonTestData.RECEPTION_HANDLER_TYPE,
                 activator.getParameterGroup().getReceptionHandlerParameters()
-                        .get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getReceptionHandlerType());
+                        .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getReceptionHandlerType());
         assertEquals(CommonTestData.DECODER_TYPE,
                 activator.getParameterGroup().getReceptionHandlerParameters()
-                        .get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters().getPolicyDecoders()
-                        .get(CommonTestData.TOSCA_DECODER_KEY).getDecoderType());
+                        .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()
+                        .getPolicyDecoders().get(CommonTestData.DUMMY_DECODER_KEY).getDecoderType());
         assertEquals(CommonTestData.FORWARDER_TYPE,
                 activator.getParameterGroup().getReceptionHandlerParameters()
-                        .get(CommonTestData.SDC_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()
-                        .getPolicyForwarders().get(CommonTestData.PAP_ENGINE_FORWARDER_KEY).getForwarderType());
+                        .get(CommonTestData.DUMMY_RECEPTION_HANDLER_KEY).getPluginHandlerParameters()
+                        .getPolicyForwarders().get(CommonTestData.DUMMY_ENGINE_FORWARDER_KEY).getForwarderType());
         activator.terminate();
     }
 }
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyDecoder.java
new file mode 100644 (file)
index 0000000..19e3093
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.main.testclasses;
+
+import java.util.Collection;
+
+import org.onap.policy.distribution.model.Policy;
+import org.onap.policy.distribution.model.PolicyInput;
+import org.onap.policy.distribution.reception.decoding.PolicyDecoder;
+import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
+
+/**
+ * Class to create a dummy decoder for test cases.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DummyDecoder implements PolicyDecoder<PolicyInput, Policy> {
+
+    private boolean canHandleValue;
+    private Collection<Policy> policesToReturn;
+
+    public DummyDecoder() {
+        this.canHandleValue = false;
+        this.policesToReturn = null;
+    }
+
+    public DummyDecoder(final boolean canHandleValue, final Collection<Policy> policesToReturn) {
+        this.canHandleValue = canHandleValue;
+        this.policesToReturn = policesToReturn;
+    }
+
+    @Override
+    public boolean canHandle(final PolicyInput policyInput) {
+        return canHandleValue;
+    }
+
+    @Override
+    public Collection<Policy> decode(final PolicyInput input) throws PolicyDecodingException {
+        return policesToReturn;
+    }
+}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarder.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarder.java
new file mode 100644 (file)
index 0000000..5cae0c6
--- /dev/null
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.main.testclasses;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.onap.policy.distribution.forwarding.PolicyForwarder;
+import org.onap.policy.distribution.forwarding.PolicyForwardingException;
+import org.onap.policy.distribution.model.Policy;
+
+/**
+ * Class to create a dummy forwarder for test cases.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DummyPolicyForwarder implements PolicyForwarder {
+    private int numberOfPoliciesReceived = 0;
+    private Collection<Policy> policiesReceived = new ArrayList<>();
+
+    @Override
+    public void forward(final Collection<Policy> policies) throws PolicyForwardingException {
+        numberOfPoliciesReceived += policies.size();
+        policiesReceived.addAll(policies);
+    }
+
+    public int getNumberOfPoliciesReceived() {
+        return numberOfPoliciesReceived;
+    }
+
+    public boolean receivedPolicy(final Policy policy) {
+        return policiesReceived.contains(policy);
+    }
+}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandler.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandler.java
new file mode 100644 (file)
index 0000000..8d3ec68
--- /dev/null
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.main.testclasses;
+
+import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler;
+
+/**
+ * Class to create a dummy reception handler for test cases.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DummyReceptionHandler extends AbstractReceptionHandler {
+
+    @Override
+    public void initializeReception(final String parameterGroupName) {}
+
+    @Override
+    public void destroy() {}
+}
diff --git a/main/src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt b/main/src/test/resources/expectedValidationResults/InvalidDecoderAndForwarderParameters.txt
new file mode 100644 (file)
index 0000000..41c7b2d
--- /dev/null
@@ -0,0 +1,17 @@
+validation error(s) on parameters from "parameters/DistributionConfigParameters_InvalidDecoderAndForwarderParameters.json"
+parameter group "SDCDistributionGroup" type "org.onap.policy.distribution.main.parameters.DistributionParameterGroup" INVALID, parameter group has status INVALID
+  parameter group map "receptionHandlerParameters" INVALID, parameter group has status INVALID
+    parameter group "null_DummyReceptionHandler" type "org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters" INVALID, parameter group has status INVALID
+      parameter group "null_PluginHandler" type "org.onap.policy.distribution.reception.parameters.PluginHandlerParameters" INVALID, parameter group has status INVALID
+        parameter group map "policyDecoders" INVALID, parameter group has status INVALID
+          parameter group "null" type "org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters" INVALID, parameter group has status INVALID
+            field "decoderType" type "java.lang.String" value "" INVALID, must be a non-blank string
+            field "decoderClassName" type "java.lang.String" value "org.onap.policy.distribution.main.testclasses.PolicyDecoderApexPdpa" INVALID, policy decoder class not found in classpath
+          parameter group "null" type "org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters" INVALID, parameter group has status INVALID
+            field "decoderClassName" type "java.lang.String" value "" INVALID, must be a non-blank string containing full class name of the decoder
+        parameter group map "policyForwarders" INVALID, parameter group has status INVALID
+          parameter group "null" type "org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters" INVALID, parameter group has status INVALID
+            field "forwarderType" type "java.lang.String" value "" INVALID, must be a non-blank string
+            field "forwarderClassName" type "java.lang.String" value "org.onap.policy.distribution.main.testclasses.PapStandalonePolicyForwarder" INVALID, policy forwarder class not found in classpath
+          parameter group "null" type "org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters" INVALID, parameter group has status INVALID
+            field "forwarderClassName" type "java.lang.String" value "" INVALID, must be a non-blank string containing full class name of the forwarder
diff --git a/main/src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt b/main/src/test/resources/expectedValidationResults/InvalidReceptionHandlerParameters.txt
new file mode 100644 (file)
index 0000000..cec33d0
--- /dev/null
@@ -0,0 +1,6 @@
+validation error(s) on parameters from "parameters/DistributionConfigParameters_InvalidReceptionHandlerParameters.json"
+parameter group "SDCDistributionGroup" type "org.onap.policy.distribution.main.parameters.DistributionParameterGroup" INVALID, parameter group has status INVALID
+  parameter group map "receptionHandlerParameters" INVALID, parameter group has status INVALID
+    parameter group "null_" type "org.onap.policy.distribution.reception.parameters.ReceptionHandlerParameters" INVALID, parameter group has status INVALID
+      field "receptionHandlerType" type "java.lang.String" value "" INVALID, must be a non-blank string
+      field "receptionHandlerClassName" type "java.lang.String" value "org.onap.policy.distribution.main.testclasses.InvalidSdcReceptionHandler" INVALID, reception handler class not found in classpath
diff --git a/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt b/main/src/test/resources/expectedValidationResults/InvalidRestServerParameters.txt
new file mode 100644 (file)
index 0000000..ceb195a
--- /dev/null
@@ -0,0 +1,7 @@
+validation error(s) on parameters from "parameters/DistributionConfigParameters_InvalidRestServerParameters.json"
+parameter group "SDCDistributionGroup" type "org.onap.policy.distribution.main.parameters.DistributionParameterGroup" INVALID, parameter group has status INVALID
+  parameter group "null" type "org.onap.policy.distribution.main.parameters.RestServerParameters" INVALID, parameter group has status INVALID
+    field "host" type "java.lang.String" value "" INVALID, must be a non-blank string containing hostname/ipaddress of the distribution rest server
+    field "port" type "int" value "-1" INVALID, must be a positive integer containing port of the distribution rest server
+    field "userName" type "java.lang.String" value "" INVALID, must be a non-blank string containing userName for distribution rest server credentials
+    field "password" type "java.lang.String" value "" INVALID, must be a non-blank string containing password for distribution rest server credentials
index 7ebab31..29e3e46 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
index 940f901..ce66777 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
@@ -38,9 +38,9 @@
                 "policyDecoders":{
                 },
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
index b596f06..3eceef2 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
@@ -36,9 +36,9 @@
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     },
                     "APEXDecoder":{
-                        "decoderType":"APEX",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderApexPdpa"
+                        "decoderType":"",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.PolicyDecoderApexPdpa"
                     },
                     "DROOLSDecoder":{
                         "decoderType":"DROOLS",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderDroolsPdpd"
+                        "decoderClassName":""
                     }
                 },
                 "policyForwarders":{
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
+                    },
+                    "PAPStandaloneForwarder":{
+                        "forwarderType":"",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.PapStandalonePolicyForwarder"
+                    },
                     "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                        "forwarderType":"PAPEngineForwarder",
+                        "forwarderClassName":""
                     }
                 }
+                
             }
         }
     }
index f31a396..377c70e 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyDecoderType.json
deleted file mode 100644 (file)
index c4c73ee..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":" ",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidPolicyForwarderClass.json
deleted file mode 100644 (file)
index 899fcca..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    },
-                    "PAPStandaloneForwarder":{
-                        "forwarderType":"PAPStandalone",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.PapStandalonePolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerClass.json
deleted file mode 100644 (file)
index 4ff308c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.InvalidSdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.InvalidSdcReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":" ",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidReceptionHandlerType.json
deleted file mode 100644 (file)
index a6be01e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":" ",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerHost.json
deleted file mode 100644 (file)
index b59074d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
@@ -1,15 +1,15 @@
 {
     "name":"SDCDistributionGroup",
     "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
+        "host":"",
+        "port":-1,
         "userName":"",
-        "password":"zb!XztG34"
+        "password":""
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPassword.json
deleted file mode 100644 (file)
index 7161dee..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":6969,
-        "userName":"healthcheck",
-        "password":""
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json b/main/src/test/resources/parameters/DistributionConfigParameters_InvalidRestServerPort.json
deleted file mode 100644 (file)
index aa48074..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-    "name":"SDCDistributionGroup",
-    "restServerParameters":{
-        "host":"0.0.0.0",
-        "port":-1,
-        "userName":"healthcheck",
-        "password":"zb!XztG34"
-    },
-    "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
-            "pssdConfiguration":{
-                "asdcAddress": "localhost",
-                "messageBusAddress": [
-                    "a.com",
-                    "b.com",
-                    "c.com"
-                 ],
-                "user": "tbdsdc-1480",
-                "password": "tbdsdc-1480",
-                "pollingInterval":20,
-                "pollingTimeout":30,
-                "consumerId": "policy-id",
-                "artifactTypes": [
-                    "TOSCA_CSAR",
-                    "HEAT"
-                ],
-                "consumerGroup": "policy-group",
-                "environmentName": "environmentName",
-                "keystorePath": "null",
-                "keystorePassword": "null",
-                "activeserverTlsAuth": false,
-                "isFilterinEmptyResources": true,
-                "isUseHttpsWithDmaap": false
-            },
-            "pluginHandlerParameters":{
-                "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
-                    }
-                },
-                "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
-                    }
-                }
-            }
-        }
-    }
-}
index 530a86d..ffb4c72 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
@@ -36,9 +36,9 @@
             },
             "pluginHandlerParameters":{
                 "policyForwarders":{
-                    "PAPEngineForwarder":{
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }
index 6b6d677..7d9a8af 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{
-        "SDCReceptionHandler":{
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
@@ -36,9 +36,9 @@
             },
             "pluginHandlerParameters":{
                 "policyDecoders":{
-                    "TOSCADecoder":{
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 }
             }
index 95359b8..c113d2c 100644 (file)
@@ -7,9 +7,9 @@
         "password":"zb!XztG34"
     },
     "receptionHandlerParameters":{  
-        "SDCReceptionHandler":{  
-            "receptionHandlerType":"SDC",
-            "receptionHandlerClassName":"org.onap.policy.distribution.reception.handling.sdc.SdcReceptionHandler",
+        "DummyReceptionHandler":{  
+            "receptionHandlerType":"DummyReceptionHandler",
+            "receptionHandlerClassName":"org.onap.policy.distribution.main.testclasses.DummyReceptionHandler",
             "pssdConfiguration":{
                 "asdcAddress": "localhost",
                 "messageBusAddress": [
             },
             "pluginHandlerParameters":{  
                 "policyDecoders":{  
-                    "TOSCADecoder":{  
-                        "decoderType":"TOSCA",
-                        "decoderClassName":"org.onap.policy.distribution.reception.decoding.pdpx.PolicyDecoderToscaPdpx"
+                    "DummyDecoder":{  
+                        "decoderType":"DummyDecoder",
+                        "decoderClassName":"org.onap.policy.distribution.main.testclasses.DummyDecoder"
                     }
                 },
                 "policyForwarders":{  
-                    "PAPEngineForwarder":{  
-                        "forwarderType":"PAPEngine",
-                        "forwarderClassName":"org.onap.policy.distribution.forwarding.pap.engine.XacmlPapServletPolicyForwarder"
+                    "DummyForwarder":{  
+                        "forwarderType":"DummyForwarder",
+                        "forwarderClassName":"org.onap.policy.distribution.main.testclasses.DummyPolicyForwarder"
                     }
                 }
             }