summaryrefslogtreecommitdiffstats
path: root/reception/src/main/java
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@est.tech>2019-07-17 11:03:26 +0000
committerramverma <ram.krishna.verma@est.tech>2019-07-17 11:03:26 +0000
commitcf748512392e5d3257de629dc57fb353dc073c92 (patch)
tree8e81a773d1f9556669b344d5f31dd139999ef2f6 /reception/src/main/java
parent5f032e0363703239f30dff29914dc41dd3abca48 (diff)
Changing policy/distribution to use policy/models
1) Changed policy distribution framework to use entities from policy/models 2) Changed all the test cases. 3) Commented few test cases which will be fixed along with code fixes. 4) Will be removing the old policy entities once all the pieces are ready. Change-Id: I1fd7b975b2e072c0b24e429903c9ca4796173929 Issue-ID: POLICY-1888 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'reception/src/main/java')
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/decoding/PolicyDecoder.java4
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java12
-rw-r--r--reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java12
3 files changed, 14 insertions, 14 deletions
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/decoding/PolicyDecoder.java b/reception/src/main/java/org/onap/policy/distribution/reception/decoding/PolicyDecoder.java
index 9cd660a9..04150205 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/decoding/PolicyDecoder.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/decoding/PolicyDecoder.java
@@ -22,8 +22,8 @@ package org.onap.policy.distribution.reception.decoding;
import java.util.Collection;
-import org.onap.policy.distribution.model.Policy;
import org.onap.policy.distribution.model.PolicyInput;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Decodes polices from a given input.
@@ -31,7 +31,7 @@ import org.onap.policy.distribution.model.PolicyInput;
* @param <T> the type of policy that will be created
* @param <S> the type of input to be decoded
*/
-public interface PolicyDecoder<S extends PolicyInput, T extends Policy> {
+public interface PolicyDecoder<S extends PolicyInput, T extends ToscaEntity> {
/**
* Configure the policy decoder. This method will be invoked immediately after instantiation in order for the policy
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java
index 5b2d1671..2ea18704 100644
--- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java
+++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java
@@ -27,12 +27,12 @@ import java.util.Collection;
import org.onap.policy.common.parameters.ParameterService;
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.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.ReceptionHandlerParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,8 +76,8 @@ public abstract class AbstractReceptionHandler implements ReceptionHandler {
*/
protected void inputReceived(final PolicyInput policyInput) throws PolicyDecodingException {
- final Collection<Policy> policies = new ArrayList<>();
- for (final PolicyDecoder<PolicyInput, Policy> policyDecoder : getRelevantPolicyDecoders(policyInput)) {
+ final Collection<ToscaEntity> policies = new ArrayList<>();
+ for (final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder : getRelevantPolicyDecoders(policyInput)) {
policies.addAll(policyDecoder.decode(policyInput));
}
@@ -90,10 +90,10 @@ public abstract class AbstractReceptionHandler implements ReceptionHandler {
}
}
- private Collection<PolicyDecoder<PolicyInput, Policy>> getRelevantPolicyDecoders(final PolicyInput policyInput)
+ private Collection<PolicyDecoder<PolicyInput, ToscaEntity>> getRelevantPolicyDecoders(final PolicyInput policyInput)
throws PolicyDecodingException {
- final Collection<PolicyDecoder<PolicyInput, Policy>> relevantPolicyDecoders = new ArrayList<>();
- for (final PolicyDecoder<PolicyInput, Policy> policyDecoder : pluginHandler.getPolicyDecoders()) {
+ final Collection<PolicyDecoder<PolicyInput, ToscaEntity>> relevantPolicyDecoders = new ArrayList<>();
+ for (final PolicyDecoder<PolicyInput, ToscaEntity> policyDecoder : pluginHandler.getPolicyDecoders()) {
if (policyDecoder.canHandle(policyInput)) {
relevantPolicyDecoders.add(policyDecoder);
}
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 afa703ab..f837e520 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
@@ -28,12 +28,12 @@ import java.util.Map;
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.parameters.PluginHandlerParameters;
import org.onap.policy.distribution.reception.parameters.PolicyDecoderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +44,7 @@ public class PluginHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(PluginHandler.class);
- private Collection<PolicyDecoder<PolicyInput, Policy>> policyDecoders;
+ private Collection<PolicyDecoder<PolicyInput, ToscaEntity>> policyDecoders;
private Collection<PolicyForwarder> policyForwarders;
/**
@@ -64,7 +64,7 @@ public class PluginHandler {
*
* @return the policy decoders
*/
- public Collection<PolicyDecoder<PolicyInput, Policy>> getPolicyDecoders() {
+ public Collection<PolicyDecoder<PolicyInput, ToscaEntity>> getPolicyDecoders() {
return policyDecoders;
}
@@ -89,10 +89,10 @@ public class PluginHandler {
policyDecoders = new ArrayList<>();
for (final PolicyDecoderParameters decoderParameters : policyDecoderParameters.values()) {
try {
- final Class<PolicyDecoder<PolicyInput, Policy>> policyDecoderClass =
- (Class<PolicyDecoder<PolicyInput, Policy>>) Class
+ final Class<PolicyDecoder<PolicyInput, ToscaEntity>> policyDecoderClass =
+ (Class<PolicyDecoder<PolicyInput, ToscaEntity>>) Class
.forName(decoderParameters.getDecoderClassName());
- final PolicyDecoder<PolicyInput, Policy> decoder = policyDecoderClass.newInstance();
+ final PolicyDecoder<PolicyInput, ToscaEntity> decoder = policyDecoderClass.newInstance();
decoder.configure(decoderParameters.getDecoderConfigurationName());
policyDecoders.add(decoder);
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException exp) {