diff options
Diffstat (limited to 'main/src')
5 files changed, 34 insertions, 8 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java index 0cca2ffc..291bddde 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java @@ -190,6 +190,7 @@ public class TestApiRestServer { "policytypes/onap.policies.Optimization.yaml", LEGACY_POLICYTYPE_OP_RESOURCE, TOSCA_POLICYTYPE_OP_RESOURCE, + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml", "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", "policytypes/onap.policies.controlloop.guard.MinMax.yaml", @@ -217,9 +218,9 @@ public class TestApiRestServer { }; private static final String[] LEGACY_OPERATIONAL_POLICY_RESOURCE_NAMES = { - "policies/vCPE.policy.operational.input.json", - "policies/vDNS.policy.operational.input.json", - "policies/vFirewall.policy.operational.input.json" + "policies/vCPE.policy.operational.legacy.input.json", + "policies/vDNS.policy.operational.legacy.input.json", + "policies/vFirewall.policy.operational.legacy.input.json" }; private static PolicyModelsProviderParameters providerParams; @@ -405,6 +406,11 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); rawResponse = readResource(POLICYTYPES_DROOLS_VERSION, APP_JSON); + // + // PLD not sure how to fix this? How do I merge 2 policy types? + // + ErrorResponse errorResponse = rawResponse.readEntity(ErrorResponse.class); + System.err.println(errorResponse.getErrorMessage()); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); rawResponse = createResource(POLICIES, TOSCA_POLICY_OP_DROOLS_VCPE_RESOURSE_JSON); diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java index d812d4e1..f9fc666d 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java @@ -73,7 +73,7 @@ public class TestLegacyOperationalPolicyProvider { private static StandardCoder standardCoder; private static StandardYamlCoder standardYamlCoder; - private static final String POLICY_RESOURCE = "policies/vCPE.policy.operational.input.json"; + private static final String POLICY_RESOURCE = "policies/vCPE.policy.operational.legacy.input.json"; private static final String POLICY_RESOURCE_WITH_NO_VERSION = "policies/vDNS.policy.operational.no.policyversion.json"; private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.controlloop.Operational.yaml"; diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java index 51cd4d3c..31be84a9 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java @@ -83,7 +83,11 @@ public class TestPolicyProvider { private static final String MULTIPLE_POLICIES_RESOURCE = "policies/vCPE.policies.optimization.input.tosca.json"; public static final String POLICY_TYPE_RESOURCE_OPERATIONAL = + "policytypes/onap.policies.controlloop.Operational.yaml"; + public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON = "policytypes/onap.policies.controlloop.operational.Common.yaml"; + public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS = + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml"; private static final String POLICY_RESOURCE_OPERATIONAL = "policies/vCPE.policy.operational.input.tosca.json"; public static final String POLICY_TYPE_OPERATIONAL_DROOLS = "onap.policies.controlloop.operational.common.Drools"; @@ -297,6 +301,15 @@ public class TestPolicyProvider { public void testCreateOperationalDroolsPolicy() throws CoderException, PfModelException { ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode( ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL), ToscaServiceTemplate.class); + + policyTypeProvider.createPolicyType(policyTypeServiceTemplate); + policyTypeServiceTemplate = standardYamlCoder.decode( + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class); + + policyTypeProvider.createPolicyType(policyTypeServiceTemplate); + + policyTypeServiceTemplate = standardYamlCoder.decode( + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_OPERATIONAL); diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java index 8f5657b3..3c64e640 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java @@ -66,8 +66,10 @@ public class TestPolicyTypeProvider { "policytypes/onap.policies.optimization.Resource.no.version.yaml"; private static final String POLICY_TYPE_NAME_MONITORING = "onap.policies.monitoring.cdap.tca.hi.lo.app"; - public static final String POLICY_TYPE_RESOURCE_OPERATIONAL = + public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON = "policytypes/onap.policies.controlloop.operational.Common.yaml"; + public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS = + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml"; public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_APEX = "policytypes/onap.policies.controlloop.operational.common.Apex.yaml"; public static final String POLICY_TYPE_OPERATIONAL_COMMON = "onap.policies.controlloop.operational.Common"; @@ -164,10 +166,14 @@ public class TestPolicyTypeProvider { @Test public void testCreateOperationalPolicyTypes() throws CoderException, PfModelException { ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode( - ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL), ToscaServiceTemplate.class); + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_COMMON)); + + policyTypeServiceTemplate = standardYamlCoder.decode( + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class); + serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); assertNotNull(serviceTemplate.getPolicyTypes().get(POLICY_TYPE_OPERATIONAL_DROOLS)); policyTypeProvider.deletePolicyType(POLICY_TYPE_OPERATIONAL_DROOLS, POLICY_TYPE_VERSION); @@ -177,7 +183,7 @@ public class TestPolicyTypeProvider { @Test public void testCreateApexOperationalPolicyTypes() throws CoderException, PfModelException { ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode( - ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL), ToscaServiceTemplate.class); + ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); policyTypeServiceTemplate = standardYamlCoder.decode( ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_APEX), ToscaServiceTemplate.class); diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json index a48847cb..29745fb8 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json @@ -42,6 +42,7 @@ "policytypes/onap.policies.native.Xacml.yaml", "policytypes/onap.policies.native.Apex.yaml", "policytypes/onap.policies.controlloop.operational.Common.yaml", - "policytypes/onap.policies.controlloop.operational.common.Apex.yaml" + "policytypes/onap.policies.controlloop.operational.common.Apex.yaml", + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml" ] } |