aboutsummaryrefslogtreecommitdiffstats
path: root/reception
diff options
context:
space:
mode:
Diffstat (limited to 'reception')
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java5
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandlerTest.java24
-rw-r--r--reception/src/test/java/org/onap/policy/distribution/reception/handling/DummyPolicyForwarder.java4
3 files changed, 28 insertions, 5 deletions
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java
index eb1a33a5..4f3f41e3 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java
@@ -23,7 +23,6 @@ package org.onap.policy.distribution.reception.handling;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
-
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.common.parameters.ParameterService;
@@ -114,7 +113,9 @@ public class PluginHandler {
try {
final Class<PolicyForwarder> policyForwarderClass =
(Class<PolicyForwarder>) Class.forName(forwarderParameters.getForwarderClassName());
- policyForwarders.add(policyForwarderClass.newInstance());
+ PolicyForwarder policyForwarder = policyForwarderClass.newInstance();
+ policyForwarder.configure(forwarderParameters.getForwarderConfigurationName());
+ policyForwarders.add(policyForwarder);
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException exp) {
LOGGER.error("exception occured while initializing forwarders", exp);
throw new PluginInitializationException(exp.getMessage(), exp.getCause());
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 83fe5a45..d339507c 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
@@ -29,7 +29,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
import org.junit.Test;
import org.onap.policy.common.parameters.ParameterService;
import org.onap.policy.distribution.forwarding.PolicyForwarder;
@@ -57,6 +56,7 @@ public class AbstractReceptionHandlerTest {
private static final String FORWARDER_TYPE = "DummyForwarder";
private static final String FORWARDER_CLASS_NAME =
"org.onap.policy.distribution.reception.handling.DummyPolicyForwarder";
+ private static final String FORWARDER_CONFIGURATION_PARAMETERS = "DummyConfiguration";
@Test
public void testInputReceived() throws PolicyDecodingException, NoSuchFieldException, SecurityException,
@@ -121,9 +121,29 @@ public class AbstractReceptionHandlerTest {
}
class DummyPolicy1 implements Policy {
+
+ @Override
+ public String getPolicyName() {
+ return null;
+ }
+
+ @Override
+ public String getPolicyType() {
+ return null;
+ }
}
class DummyPolicy2 implements Policy {
+
+ @Override
+ public String getPolicyName() {
+ return null;
+ }
+
+ @Override
+ public String getPolicyType() {
+ return null;
+ }
}
private void setUpPlugins(final AbstractReceptionHandler receptionHandler,
@@ -160,7 +180,7 @@ public class AbstractReceptionHandlerTest {
final Map<String, PolicyForwarderParameters> policyForwarders =
new HashMap<String, PolicyForwarderParameters>();
final PolicyForwarderParameters pFParameters =
- new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME);
+ new PolicyForwarderParameters(FORWARDER_TYPE, FORWARDER_CLASS_NAME, FORWARDER_CONFIGURATION_PARAMETERS);
policyForwarders.put(FORWARDER_KEY, pFParameters);
return policyForwarders;
}
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 acee4697..a665c546 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,7 +22,6 @@ 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;
@@ -49,4 +48,7 @@ public class DummyPolicyForwarder implements PolicyForwarder {
public boolean receivedPolicy(final Policy policy) {
return policiesReceived.contains(policy);
}
+
+ @Override
+ public void configure(String parameterGroupName) {}
}