summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java11
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java33
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java39
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarderParameterGroup.java2
-rw-r--r--main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java77
-rw-r--r--main/src/test/resources/parameters/DummyPolicyForwarderParameters.json8
6 files changed, 40 insertions, 130 deletions
diff --git a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java
index f8ba764b..41e97616 100644
--- a/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java
+++ b/main/src/main/java/org/onap/policy/distribution/main/parameters/PolicyForwarderConfigurationParameterGroup.java
@@ -33,15 +33,4 @@ public abstract class PolicyForwarderConfigurationParameterGroup extends Paramet
public PolicyForwarderConfigurationParameterGroup(final String name) {
super(name);
}
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
index 1e53ed24..9c6d1c10 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/parameters/CommonTestData.java
@@ -23,9 +23,7 @@
package org.onap.policy.distribution.main.parameters;
import java.io.File;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
@@ -36,7 +34,6 @@ import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParamet
import org.onap.policy.distribution.main.testclasses.DummyPolicyDecoderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyPolicyForwarderParameterGroup;
import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup;
-import org.onap.policy.distribution.main.testclasses.DummyReceptionHandlerParameterGroup.DummyReceptionHandlerParameterGroupBuilder;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
@@ -123,14 +120,11 @@ public class CommonTestData {
final Map<String, ReceptionHandlerConfigurationParameterGroup> receptionHandlerConfigurationParameters =
new HashMap<String, ReceptionHandlerConfigurationParameterGroup>();
if (!isEmpty) {
- final List<String> messageBusAddress = new ArrayList<>();
- messageBusAddress.add("localhost");
- final List<String> artifactTypes = new ArrayList<>();
- artifactTypes.add("TOSCA_CSAR");
final DummyReceptionHandlerParameterGroup dummyReceptionHandlerParameterGroup =
- new DummyReceptionHandlerParameterGroupBuilder().setMyStringParameter(MY_STRING_PARAMETER_VALUE)
- .setMyIntegerParameter(MY_INTEGER_PARAMETER_VALUE)
- .setMyBooleanParameter(MY_BOOLEAN_PARAMETER_VALUE).build();
+ new DummyReceptionHandlerParameterGroup();
+ dummyReceptionHandlerParameterGroup.setMyStringParameter(MY_STRING_PARAMETER_VALUE);
+ dummyReceptionHandlerParameterGroup.setMyIntegerParameter(MY_INTEGER_PARAMETER_VALUE);
+ dummyReceptionHandlerParameterGroup.setMyBooleanParameter(MY_BOOLEAN_PARAMETER_VALUE);
receptionHandlerConfigurationParameters.put(RECEPTION_CONFIGURATION_PARAMETERS,
dummyReceptionHandlerParameterGroup);
}
@@ -195,13 +189,14 @@ public class CommonTestData {
final Map<String, PolicyForwarderConfigurationParameterGroup> policyForwarderConfigurationParameters =
new HashMap<String, PolicyForwarderConfigurationParameterGroup>();
if (!isEmpty) {
- final String fileName = "src/test/resources/parameters/DummyPolicyForwarderParameters.json";
- try {
- policyForwarderConfigurationParameters.put(FORWARDER_CONFIGURATION_PARAMETERS,
- coder.decode(new File(fileName), DummyPolicyForwarderParameterGroup.class));
- } catch (final CoderException exp) {
- throw new RuntimeException("cannot read/decode " + fileName, exp);
- }
+ final DummyPolicyForwarderParameterGroup parameters = new DummyPolicyForwarderParameterGroup();
+ parameters.setHostname(FORWARDER_HOST);
+ parameters.setManaged(true);
+ parameters.setUserName("myUser");
+ parameters.setPassword("myPassword");
+ parameters.setPort(1234);
+ parameters.setUseHttps(true);
+ policyForwarderConfigurationParameters.put(FORWARDER_CONFIGURATION_PARAMETERS, parameters);
}
return policyForwarderConfigurationParameters;
}
@@ -218,7 +213,9 @@ public class CommonTestData {
new HashMap<String, PolicyDecoderConfigurationParameterGroup>();
if (!isEmpty) {
final DummyPolicyDecoderParameterGroup dummyPolicyForwarderParameterGroup =
- new DummyPolicyDecoderParameterGroup(POLICY_NAME, POLICY_TYPE);
+ new DummyPolicyDecoderParameterGroup();
+ dummyPolicyForwarderParameterGroup.setPolicyName(POLICY_NAME);
+ dummyPolicyForwarderParameterGroup.setPolicyType(POLICY_TYPE);
policyDecoderConfigurationParameters.put(DECODER_CONFIGURATION_PARAMETERS,
dummyPolicyForwarderParameterGroup);
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java
index 5d1738c5..555169e9 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyDecoderParameterGroup.java
@@ -20,7 +20,11 @@
package org.onap.policy.distribution.main.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import lombok.Getter;
+import lombok.Setter;
+
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup;
/**
@@ -28,37 +32,16 @@ import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurat
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
+@Getter
+@Setter
+@NotNull
+@NotBlank
public class DummyPolicyDecoderParameterGroup extends PolicyDecoderConfigurationParameterGroup {
private String policyName;
private String policyType;
- /**
- * Constructor for instantiating the {@link DummyPolicyDecoderParameterGroup} class.
- *
- * @param policyName the policy name
- * @param policyType the policy type
- */
- public DummyPolicyDecoderParameterGroup(final String policyName, final String policyType) {
- super();
- this.policyName = policyName;
- this.policyType = policyType;
- }
-
-
- public String getPolicyName() {
- return policyName;
- }
-
-
- public String getPolicyType() {
- return policyType;
+ public DummyPolicyDecoderParameterGroup() {
+ super(DummyPolicyDecoderParameterGroup.class.getSimpleName());
}
-
- @Override
- public GroupValidationResult validate() {
- final GroupValidationResult validationResult = new GroupValidationResult(this);
- return validationResult;
- }
-
}
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarderParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarderParameterGroup.java
index 5c7dfcf0..3e44cee3 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarderParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyPolicyForwarderParameterGroup.java
@@ -22,6 +22,7 @@
package org.onap.policy.distribution.main.testclasses;
import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
@@ -32,6 +33,7 @@ import org.onap.policy.distribution.main.parameters.PolicyForwarderConfiguration
* Dummy policy forwarder parameter group.
*/
@Getter
+@Setter
@NotNull
@NotBlank
public class DummyPolicyForwarderParameterGroup extends PolicyForwarderConfigurationParameterGroup {
diff --git a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java
index 20f433d0..649d7f4a 100644
--- a/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java
+++ b/main/src/test/java/org/onap/policy/distribution/main/testclasses/DummyReceptionHandlerParameterGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,79 +21,25 @@
package org.onap.policy.distribution.main.testclasses;
-import org.onap.policy.common.parameters.GroupValidationResult;
+import lombok.Getter;
+import lombok.Setter;
+
+import org.onap.policy.common.parameters.annotations.NotBlank;
+import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
+@Getter
+@Setter
+@NotNull
+@NotBlank
public class DummyReceptionHandlerParameterGroup extends ReceptionHandlerConfigurationParameterGroup {
private String myStringParameter;
private int myIntegerParameter;
private boolean myBooleanParameter;
- /**
- * Inner static class is to used as a Builder.
- *
- */
- public static class DummyReceptionHandlerParameterGroupBuilder {
- private String myStringParameter;
- private int myIntegerParameter;
- private boolean myBooleanParameter;
-
- public DummyReceptionHandlerParameterGroupBuilder setMyStringParameter(final String val) {
- myStringParameter = val;
- return this;
- }
-
- public DummyReceptionHandlerParameterGroupBuilder setMyIntegerParameter(final int val) {
- myIntegerParameter = val;
- return this;
- }
-
- public DummyReceptionHandlerParameterGroupBuilder setMyBooleanParameter(final boolean val) {
- myBooleanParameter = val;
- return this;
- }
-
- /**
- * Creates a new DummyReceptionHandlerConfigurationParameterGroup instance.
- */
- public DummyReceptionHandlerParameterGroup build() {
- return new DummyReceptionHandlerParameterGroup(this);
- }
- }
-
- /**
- * The constructor for instantiating PssdConfigurationParameterGroup. It is kept private so that
- * it could only be called by PssdConfigurationBuilder.
- *
- * @param builder stores all the values used by PssdConfigurationParametersGroup
- */
- private DummyReceptionHandlerParameterGroup(final DummyReceptionHandlerParameterGroupBuilder builder) {
- myStringParameter = builder.myStringParameter;
- myIntegerParameter = builder.myIntegerParameter;
- myBooleanParameter = builder.myBooleanParameter;
- }
-
- public String getMyStringParameter() {
- return myStringParameter;
+ public DummyReceptionHandlerParameterGroup() {
+ super(DummyReceptionHandlerParameterGroup.class.getSimpleName());
}
-
- public int getMyIntegerParameter() {
- return myIntegerParameter;
- }
-
- public boolean isMyBooleanParameter() {
- return myBooleanParameter;
- }
-
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public GroupValidationResult validate() {
- return new GroupValidationResult(this);
- }
-
}
diff --git a/main/src/test/resources/parameters/DummyPolicyForwarderParameters.json b/main/src/test/resources/parameters/DummyPolicyForwarderParameters.json
deleted file mode 100644
index 60b0d4af..00000000
--- a/main/src/test/resources/parameters/DummyPolicyForwarderParameters.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "useHttps": true,
- "hostname": "192.168.99.100",
- "port": 1234,
- "userName": "myUser",
- "password": "myPassword",
- "isManaged": true
-} \ No newline at end of file