aboutsummaryrefslogtreecommitdiffstats
path: root/reception/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'reception/src/test')
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java38
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java10
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java11
3 files changed, 25 insertions, 34 deletions
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
index 8dc84621..f76f599c 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java
@@ -34,13 +34,13 @@ import org.junit.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
import org.onap.policy.distribution.forwarding.parameters.PolicyForwarderParameters;
-import org.onap.policy.distribution.model.Policy;
import org.onap.policy.distribution.model.PolicyInput;
import org.onap.policy.distribution.reception.decoding.PluginInitializationException;
import org.onap.policy.distribution.reception.decoding.PolicyDecoder;
import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
import org.onap.policy.distribution.reception.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to perform unit test of AbstractReceptionHandler.
@@ -65,15 +65,15 @@ public class AbstractReceptionHandlerTest {
IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final AbstractReceptionHandler handler = new DummyReceptionHandler();
- final Policy generatedPolicy1 = new DummyPolicy1();
- final Policy generatedPolicy2 = new DummyPolicy2();
+ final ToscaEntity generatedPolicy1 = new DummyPolicy1();
+ final ToscaEntity generatedPolicy2 = new DummyPolicy2();
- final PolicyDecoder<PolicyInput, Policy> policyDecoder1 =
+ final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder1 =
new DummyDecoder(true, Collections.singletonList(generatedPolicy1));
- final PolicyDecoder<PolicyInput, Policy> policyDecoder2 =
+ final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder2 =
new DummyDecoder(true, Collections.singletonList(generatedPolicy2));
- final Collection<PolicyDecoder<PolicyInput, Policy>> policyDecoders = new ArrayList<>();
+ final Collection<PolicyDecoder<PolicyInput, ToscaEntity>> policyDecoders = new ArrayList<>();
policyDecoders.add(policyDecoder1);
policyDecoders.add(policyDecoder2);
@@ -101,7 +101,7 @@ public class AbstractReceptionHandlerTest {
SecurityException, IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final AbstractReceptionHandler handler = new DummyReceptionHandler();
- final PolicyDecoder<PolicyInput, Policy> policyDecoder = new DummyDecoder(false, Collections.emptyList());
+ final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder = new DummyDecoder(false, Collections.emptyList());
final DummyPolicyForwarder policyForwarder = new DummyPolicyForwarder();
setUpPlugins(handler, Collections.singleton(policyDecoder), Collections.singleton(policyForwarder));
@@ -122,36 +122,26 @@ public class AbstractReceptionHandlerTest {
class DummyPolicyInput implements PolicyInput {
}
- class DummyPolicy1 implements Policy {
+ class DummyPolicy1 extends ToscaEntity {
@Override
- public String getPolicyName() {
- return null;
- }
-
- @Override
- public String getPolicyType() {
+ public String getName() {
return null;
}
}
- class DummyPolicy2 implements Policy {
+ class DummyPolicy2 extends ToscaEntity {
@Override
- public String getPolicyName() {
- return null;
- }
-
- @Override
- public String getPolicyType() {
+ public String getName() {
return null;
}
}
private void setUpPlugins(final AbstractReceptionHandler receptionHandler,
- final Collection<PolicyDecoder<PolicyInput, Policy>> decoders, final Collection<PolicyForwarder> forwarders)
- throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException,
- PluginInitializationException {
+ final Collection<PolicyDecoder<PolicyInput, ToscaEntity>> decoders,
+ final Collection<PolicyForwarder> forwarders) throws NoSuchFieldException, SecurityException,
+ IllegalArgumentException, IllegalAccessException, PluginInitializationException {
final PluginHandlerParameters pluginParameters = getPluginHandlerParameters();
pluginParameters.setName(DISTRIBUTION_GROUP);
ParameterService.register(pluginParameters);
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java
index 74792b1e..aa61c1c2 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyDecoder.java
@@ -22,27 +22,27 @@ package org.onap.policy.distribution.reception.handling;
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;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to create a dummy decoder for test cases in AbstractReceptionHandlerTest.
*
* @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
*/
-public class DummyDecoder implements PolicyDecoder<PolicyInput, Policy> {
+public class DummyDecoder implements PolicyDecoder<PolicyInput, ToscaEntity> {
private boolean canHandleValue;
- private Collection<Policy> policesToReturn;
+ private Collection<ToscaEntity> policesToReturn;
public DummyDecoder() {
this.canHandleValue = false;
this.policesToReturn = null;
}
- public DummyDecoder(final boolean canHandleValue, final Collection<Policy> policesToReturn) {
+ public DummyDecoder(final boolean canHandleValue, final Collection<ToscaEntity> policesToReturn) {
this.canHandleValue = canHandleValue;
this.policesToReturn = policesToReturn;
}
@@ -53,7 +53,7 @@ public class DummyDecoder implements PolicyDecoder<PolicyInput, Policy> {
}
@Override
- public Collection<Policy> decode(final PolicyInput input) throws PolicyDecodingException {
+ public Collection<ToscaEntity> decode(final PolicyInput input) throws PolicyDecodingException {
return policesToReturn;
}
diff --git a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java
index a665c546..588adc8f 100644
--- a/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java
+++ b/reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java
@@ -22,9 +22,10 @@ package org.onap.policy.distribution.reception.handling;
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;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to create a dummy forwarder for test cases in AbstractReceptionHandlerTest.
@@ -33,10 +34,10 @@ import org.onap.policy.distribution.model.Policy;
*/
public class DummyPolicyForwarder implements PolicyForwarder {
private int numberOfPoliciesReceived = 0;
- private Collection<Policy> policiesReceived = new ArrayList<>();
+ private Collection<ToscaEntity> policiesReceived = new ArrayList<>();
@Override
- public void forward(final Collection<Policy> policies) throws PolicyForwardingException {
+ public void forward(final Collection<ToscaEntity> policies) throws PolicyForwardingException {
numberOfPoliciesReceived += policies.size();
policiesReceived.addAll(policies);
}
@@ -45,10 +46,10 @@ public class DummyPolicyForwarder implements PolicyForwarder {
return numberOfPoliciesReceived;
}
- public boolean receivedPolicy(final Policy policy) {
+ public boolean receivedPolicy(final ToscaEntity policy) {
return policiesReceived.contains(policy);
}
@Override
- public void configure(String parameterGroupName) {}
+ public void configure(final String parameterGroupName) {}
}