From aff0352cc138a494ec105947d446a54d5fa035cf Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 10 Dec 2019 07:34:36 -0500 Subject: Update preload optimization types The type names were updated and added 2 new types. Issue-ID: POLICY-2066 Change-Id: Ibbd149dec1809a9a815a5f6b64a8e7855fcc2010 Signed-off-by: Pamela Dragosh --- .../policy/api/main/rest/TestApiRestServer.java | 30 +++++++++++----------- .../api/main/rest/provider/TestPolicyProvider.java | 18 ++++++------- .../resources/parameters/ApiConfigParameters.json | 20 ++++++++------- .../parameters/ApiConfigParameters_Https.json | 20 ++++++++------- .../src/main/resources/etc/defaultConfig.json | 20 ++++++++------- 5 files changed, 57 insertions(+), 51 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 8ede8815..3636d625 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 @@ -186,15 +186,15 @@ public class TestApiRestServer { "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", "policytypes/onap.policies.controlloop.guard.MinMax.yaml", "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", - "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", - "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", - "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml" + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml" }; private String[] legacyGuardPolicyResourceNames = { @@ -318,8 +318,8 @@ public class TestApiRestServer { Response rawResponse = createResource(POLICIES, resrcName, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy type onap.policies.optimization.AffinityPolicy:0.0.0 for " - + "policy OSDF_CASABLANCA.Affinity_vCPE_1:1.0.0 does not exist", error.getErrorMessage()); + assertEquals("policy type onap.policies.optimization.resource.AffinityPolicy:1.0.0 for " + + "policy OSDF_CASABLANCA.Affinity_Default:1.0.0 does not exist", error.getErrorMessage()); } } @@ -442,8 +442,8 @@ public class TestApiRestServer { Response rawResponse = createResource(POLICIES, resrcName, false); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy type onap.policies.optimization.AffinityPolicy:0.0.0 for " - + "policy OSDF_CASABLANCA.Affinity_vCPE_1:1.0.0 does not exist", error.getErrorMessage()); + assertEquals("policy type onap.policies.optimization.resource.AffinityPolicy:1.0.0 for " + + "policy OSDF_CASABLANCA.Affinity_Default:1.0.0 does not exist", error.getErrorMessage()); } } @@ -704,7 +704,7 @@ public class TestApiRestServer { Response rawResponse = readResource(POLICYTYPES, true, APP_JSON); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); - assertEquals(26, response.getPolicyTypes().size()); + assertEquals(28, response.getPolicyTypes().size()); } @Test @@ -714,7 +714,7 @@ public class TestApiRestServer { Response rawResponse = readResource(POLICYTYPES, true, APP_YAML); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); - assertEquals(26, response.getPolicyTypes().size()); + assertEquals(28, response.getPolicyTypes().size()); } @Test 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 5d0b4128..4221c670 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 @@ -80,13 +80,13 @@ public class TestPolicyProvider { // @formatter:off private String[] toscaPolicyTypeResourceNames = { - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", - "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", - "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml" + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml" }; // @formatter:on @@ -285,8 +285,8 @@ public class TestPolicyProvider { @Test public void testSimpleCreatePolicy() throws Exception { - String errorMessage = "policy type onap.policies.optimization.AffinityPolicy:0.0.0 for " - + "policy OSDF_CASABLANCA.Affinity_vCPE_1:1.0.0 does not exist"; + String errorMessage = "policy type onap.policies.optimization.resource.AffinityPolicy:1.0.0 for " + + "policy OSDF_CASABLANCA.Affinity_Default:1.0.0 does not exist"; assertThatThrownBy(() -> { String multiPoliciesString = ResourceUtils.getResourceAsString(MULTIPLE_POLICIES_RESOURCE); ToscaServiceTemplate multiPoliciesServiceTemplate = diff --git a/main/src/test/resources/parameters/ApiConfigParameters.json b/main/src/test/resources/parameters/ApiConfigParameters.json index d2479125..f7c992bf 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters.json +++ b/main/src/test/resources/parameters/ApiConfigParameters.json @@ -19,15 +19,17 @@ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml", "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", "policytypes/onap.policies.Optimization.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", - "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", - "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", - "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.optimization.Resource.yaml", + "policytypes/onap.policies.optimization.Service.yaml", + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml", "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", "policytypes/onap.policies.controlloop.guard.MinMax.yaml", diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json index 0f6fc65d..68a16bc8 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json @@ -20,15 +20,17 @@ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml", "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", "policytypes/onap.policies.Optimization.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", - "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", - "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", - "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.optimization.Resource.yaml", + "policytypes/onap.policies.optimization.Service.yaml", + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml", "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", "policytypes/onap.policies.controlloop.guard.MinMax.yaml", diff --git a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json index 41bd172f..0cb5984f 100644 --- a/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json +++ b/packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json @@ -21,15 +21,17 @@ "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml", "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", "policytypes/onap.policies.Optimization.yaml", - "policytypes/onap.policies.optimization.AffinityPolicy.yaml", - "policytypes/onap.policies.optimization.DistancePolicy.yaml", - "policytypes/onap.policies.optimization.HpaPolicy.yaml", - "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", - "policytypes/onap.policies.optimization.PciPolicy.yaml", - "policytypes/onap.policies.optimization.QueryPolicy.yaml", - "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", - "policytypes/onap.policies.optimization.Vim_fit.yaml", - "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.optimization.Service.yaml", + "policytypes/onap.policies.optimization.Resource.yaml", + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml", "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", "policytypes/onap.policies.controlloop.guard.MinMax.yaml", -- cgit 1.2.3-korg