aboutsummaryrefslogtreecommitdiffstats
path: root/applications/optimization/src
diff options
context:
space:
mode:
Diffstat (limited to 'applications/optimization/src')
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java10
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java2
2 files changed, 7 insertions, 5 deletions
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
index 5a8978f7..8d337e47 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
@@ -63,6 +63,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
public static final String POLICYTYPE_QUERY = "onap.policies.optimization.service.QueryPolicy";
public static final String POLICYTYPE_VIMFIT = "onap.policies.optimization.resource.Vim_fit";
public static final String POLICYTYPE_VNF = "onap.policies.optimization.resource.VnfPolicy";
+ public static final String ONAP_OPTIMIZATION_DERIVED_POLICY_TYPE = "onap.policies.optimization.";
private OptimizationPdpApplicationTranslator translator = new OptimizationPdpApplicationTranslator();
private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
@@ -118,17 +119,16 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
// For the time being, restrict this if the version isn't known.
// Could be too difficult to support changing of versions dynamically.
//
- //
- // For the time being, restrict this if the version isn't known.
- // Could be too difficult to support changing of versions dynamically.
- //
for (ToscaPolicyTypeIdentifier supported : this.supportedPolicyTypes) {
if (policyTypeId.equals(supported)) {
LOGGER.info("optimization can support {}", supported);
return true;
}
}
- return false;
+ //
+ // Support derived types
+ //
+ return policyTypeId.getName().startsWith(ONAP_OPTIMIZATION_DERIVED_POLICY_TYPE);
}
@Override
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
index 85541f18..031ef33c 100644
--- a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
@@ -188,6 +188,8 @@ public class OptimizationPdpApplicationTest {
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
"onap.policies.optimization.service.SubscriberPolicy", "1.0.0"))).isTrue();
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
+ "onap.policies.optimization.service.CustomUseCase", "1.0.0"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
"onap.foobar", "1.0.0"))).isFalse();
}