summaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-12-22 11:21:15 +0000
committerliamfallon <liam.fallon@est.tech>2020-12-22 11:21:19 +0000
commit24220a823f9b5516a3bed1c1e8cf51f36ea75efe (patch)
treedadfad72d2f967cfd9dd655f2370e75143e2b7d9 /main/src/test/java
parentf2d20681e3b7c71cb1047d08c88a01a2483b3fe5 (diff)
Update unit tests for new validation messages
The refactoring work in validation caused some validation messages to change. This review adapts the API unit tests for those changes. Issue-ID: POLICY-2900 Change-Id: Ifcd1b61488321c7d1cffa7d4ca50d016ab9787c7 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java82
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java192
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java19
3 files changed, 143 insertions, 150 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 ca0b0f6a..c706d2c5 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
@@ -93,15 +93,13 @@ public class TestApiRestServer {
private static final String POLICYTYPES = "policytypes";
private static final String POLICYTYPES_TCA = "policytypes/onap.policies.monitoring.tcagen2";
private static final String POLICYTYPES_COLLECTOR =
- "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
- private static final String POLICYTYPES_TCA_VERSION =
- "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0";
- private static final String POLICYTYPES_TCA_LATEST =
- "policytypes/onap.policies.monitoring.tcagen2/versions/latest";
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server";
+ private static final String POLICYTYPES_TCA_VERSION = "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0";
+ private static final String POLICYTYPES_TCA_LATEST = "policytypes/onap.policies.monitoring.tcagen2/versions/latest";
private static final String POLICYTYPES_COLLECTOR_VERSION =
- "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/1.0.0";
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/1.0.0";
private static final String POLICYTYPES_COLLECTOR_LATEST =
- "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/latest";
+ "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server/versions/latest";
private static final String POLICYTYPES_DROOLS = "policytypes/onap.policies.controlloop.operational.common.Drools";
private static final String POLICYTYPES_DROOLS_VERSION = POLICYTYPES_DROOLS + "/versions/1.0.0";
@@ -110,16 +108,16 @@ public class TestApiRestServer {
private static final String POLICYTYPES_NAMING_VERSION = POLICYTYPES + "/onap.policies.Naming/versions/1.0.0";
private static final String POLICYTYPES_TCA_POLICIES =
- "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies";
private static final String POLICYTYPES_TCA_POLICIES_VCPE =
- "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca";
- private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION1 = "policytypes/"
- + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
+ "policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca";
+ private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION1 =
+ "policytypes/" + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0";
private static final String POLICYTYPES_TCA_POLICIES_VCPE_LATEST = "policytypes/"
- + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/latest";
+ + "onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/latest";
private static final String POLICYTYPES_DROOLS_POLICIES_VCPE_VERSION =
- POLICYTYPES_DROOLS_VERSION + "/policies/" + OP_POLICY_NAME_VCPE + "/versions/1.0.0";
+ POLICYTYPES_DROOLS_VERSION + "/policies/" + OP_POLICY_NAME_VCPE + "/versions/1.0.0";
private static final String POLICIES = "policies";
@@ -181,7 +179,7 @@ public class TestApiRestServer {
* Initializes parameters and set up test environment.
*
* @throws PfModelException the PfModel parsing exception
- * @throws IOException on I/O exceptions
+ * @throws IOException on I/O exceptions
*/
@BeforeClass
public static void setupParameters() throws PfModelException, IOException {
@@ -193,7 +191,7 @@ public class TestApiRestServer {
providerParams.setDatabasePassword("P01icY");
providerParams.setPersistenceUnit("ToscaConceptTest");
apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
- Collections.emptyList());
+ Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
@@ -207,7 +205,7 @@ public class TestApiRestServer {
systemProps.put("javax.net.ssl.keyStorePassword", "Pol1cy_0nap");
System.setProperties(systemProps);
new CommonTestData().makeParameters("src/test/resources/parameters/ApiConfigParameters_Https.json",
- "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", apiPort);
+ "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", apiPort);
apiConfigParameters[0] = "-c";
apiConfigParameters[1] = "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json";
@@ -274,17 +272,17 @@ public class TestApiRestServer {
// Send a policy with no policy type trigger an error
String toscaPolicy = ResourceUtils
- .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
+ .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
TextFileUtils.putStringAsTextFile(toscaPolicy, "src/test/resources/policies/BadTestPolicy.yaml");
- Response rawResponse2 = createResource(POLICYTYPES_TCA_POLICIES,
- "src/test/resources/policies/BadTestPolicy.yaml");
+ Response rawResponse2 =
+ createResource(POLICYTYPES_TCA_POLICIES, "src/test/resources/policies/BadTestPolicy.yaml");
assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
assertThat(errorResponse.getErrorMessage())
- .contains("entity in incoming fragment does not equal existing entity");
+ .contains("item \"entity\" value \"onap.restart.tca:1.0.0\" INVALID, does not equal existing entity");
}
@Test
@@ -298,7 +296,7 @@ public class TestApiRestServer {
// Send a policy with no policy type trigger an error
String toscaPolicy = ResourceUtils
- .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
+ .getResourceAsString(TOSCA_POLICY_RESOURCE_NAMES[TOSCA_POLICIES_RESOURCE_NAMES.length - 1]);
toscaPolicy = toscaPolicy.replaceAll("onap.policies.monitoring.tcagen2", "IDontExist");
toscaPolicy = toscaPolicy.replaceAll("onap.restart.tca", "onap.restart.tca.IDontExist");
@@ -308,7 +306,7 @@ public class TestApiRestServer {
ErrorResponse errorResponse = rawResponse2.readEntity(ErrorResponse.class);
assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), rawResponse2.getStatus());
assertThat(errorResponse.getErrorMessage())
- .contains("policy type IDontExist:1.0.0 referenced in policy not found");
+ .contains("item \"policy type\" value \"IDontExist:1.0.0\" INVALID, not found");
}
@SuppressWarnings("unchecked")
@@ -344,18 +342,18 @@ public class TestApiRestServer {
ToscaServiceTemplate toscaVcpeSt = rawResponse.readEntity(ToscaServiceTemplate.class);
assertEquals(1, toscaVcpeSt.getToscaTopologyTemplate().getPolicies().size());
assertEquals(OP_POLICY_NAME_VCPE,
- toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getName());
+ toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getName());
- Map<String, Object> props = toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE)
- .getProperties();
+ Map<String, Object> props =
+ toscaVcpeSt.getToscaTopologyTemplate().getPolicies().get(0).get(OP_POLICY_NAME_VCPE).getProperties();
assertNotNull(props);
List<Object> operations = (List<Object>) props.get("operations");
assertEquals(1, operations.size());
assertEquals(props.get("trigger"), ((Map<String, Object>) operations.get(0)).get("id"));
- Map<String, Object> operation = (Map<String, Object>) ((Map<String, Object>) operations.get(0))
- .get("operation");
+ Map<String, Object> operation =
+ (Map<String, Object>) ((Map<String, Object>) operations.get(0)).get("operation");
assertEquals("APPC", operation.get("actor"));
assertEquals("Restart", operation.get("operation"));
@@ -518,11 +516,11 @@ public class TestApiRestServer {
public void testNamingPolicyGet() throws Exception {
Response rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
- + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
+ + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
- + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0?mode=referenced", APP_JSON);
+ + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0?mode=referenced", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
ToscaServiceTemplate namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -531,7 +529,7 @@ public class TestApiRestServer {
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
- + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest?mode=referenced", APP_JSON);
+ + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest?mode=referenced", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -539,8 +537,8 @@ public class TestApiRestServer {
assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size());
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
- rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies?mode=referenced",
- APP_JSON);
+ rawResponse =
+ readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies?mode=referenced", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -549,7 +547,7 @@ public class TestApiRestServer {
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
- + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
+ + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -559,7 +557,7 @@ public class TestApiRestServer {
assertNull(namingServiceTemplate.getDataTypes());
rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/"
- + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest", APP_JSON);
+ + "policies/SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP/versions/latest", APP_JSON);
assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus());
namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class);
@@ -752,12 +750,12 @@ public class TestApiRestServer {
String mediaType = APP_JSON; // default media type
ToscaServiceTemplate rawServiceTemplate = new ToscaServiceTemplate();
if (resourceName.endsWith(".json")) {
- rawServiceTemplate = standardCoder
- .decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
+ rawServiceTemplate =
+ standardCoder.decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
} else if (resourceName.endsWith(".yaml") || resourceName.endsWith(".yml")) {
mediaType = APP_YAML;
- rawServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class);
+ rawServiceTemplate = standardYamlCoder.decode(ResourceUtils.getResourceAsString(resourceName),
+ ToscaServiceTemplate.class);
}
final Invocation.Builder invocationBuilder;
@@ -793,8 +791,8 @@ public class TestApiRestServer {
final SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, noopTrustManager, new SecureRandom());
- final ClientBuilder clientBuilder = ClientBuilder.newBuilder().sslContext(sc)
- .hostnameVerifier((host, session) -> true);
+ final ClientBuilder clientBuilder =
+ ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true);
final Client client = clientBuilder.build();
final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34");
client.register(feature);
@@ -841,7 +839,7 @@ public class TestApiRestServer {
}
private void validateHealthCheckReport(final String name, final String url, final boolean healthy, final int code,
- final String message, final HealthCheckReport report) {
+ final String message, final HealthCheckReport report) {
assertEquals(name, report.getName());
assertEquals(url, report.getUrl());
@@ -849,4 +847,4 @@ public class TestApiRestServer {
assertEquals(code, report.getCode());
assertEquals(message, report.getMessage());
}
-} \ No newline at end of file
+}
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 8d991792..e71cfc54 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
@@ -76,16 +76,16 @@ public class TestPolicyProvider {
private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.tcagen2.yaml";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID = "policies/vCPE.policy.bad.policytypeid.json";
private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION =
- "policies/vCPE.policy.bad.policytypeversion.json";
+ "policies/vCPE.policy.bad.policytypeversion.json";
private static final String POLICY_RESOURCE_WITH_NO_POLICY_VERSION = "policies/vCPE.policy.no.policyversion.json";
private static final String POLICY_RESOURCE_WITH_DIFFERENT_FIELDS =
- "policies/vCPE.policy.different.policy.fields.json";
+ "policies/vCPE.policy.different.policy.fields.json";
private static final String MULTIPLE_POLICIES_RESOURCE = "policies/vCPE.policies.optimization.input.tosca.json";
public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON =
- "policytypes/onap.policies.controlloop.operational.Common.yaml";
+ "policytypes/onap.policies.controlloop.operational.Common.yaml";
public static final String POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS =
- "policytypes/onap.policies.controlloop.operational.common.Drools.yaml";
+ "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";
@@ -105,8 +105,8 @@ public class TestPolicyProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword("P01icY");
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup =
- new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(), Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
+ Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
@@ -161,7 +161,7 @@ public class TestPolicyProvider {
String policyTypeId = "onap.policies.monitoring.cdap.tca.hi.lo.app";
try (PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(providerParams)) {
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(providerParams)) {
assertEquals(0, databaseProvider.getPdpGroups("name").size());
assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
@@ -192,14 +192,14 @@ public class TestPolicyProvider {
pdpSubGroup.getPdpInstances().add(pdp);
// Create Pdp Groups
- assertEquals(123,
- databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
+ assertEquals(123, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0)
+ .getDesiredInstanceCount());
assertEquals(1, databaseProvider.getPdpGroups("group").size());
// Create Policy Type
assertThatCode(() -> {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
}).doesNotThrowAnyException();
@@ -207,9 +207,9 @@ public class TestPolicyProvider {
assertThatCode(() -> {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
ToscaServiceTemplate policyServiceTemplate =
- standardCoder.decode(policyString, ToscaServiceTemplate.class);
+ standardCoder.decode(policyString, ToscaServiceTemplate.class);
ToscaServiceTemplate serviceTemplate =
- policyProvider.createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate);
+ policyProvider.createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate);
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
}).doesNotThrowAnyException();
@@ -217,12 +217,12 @@ public class TestPolicyProvider {
pdpSubGroup.setPolicies(new ArrayList<>());
pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion));
assertEquals(1,
- databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size());
+ databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size());
// Test validateDeleteEligibility exception path(!pdpGroups.isEmpty())
assertThatThrownBy(() -> {
policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca",
- "1.0.0");
+ "1.0.0");
}).hasMessageContaining("policy is in use, it is deployed in PDP group group subgroup type");
} catch (Exception exc) {
fail("Test should not throw an exception");
@@ -237,7 +237,7 @@ public class TestPolicyProvider {
}).hasMessage("topology template not specified on service template");
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
assertThatCode(() -> policyTypeProvider.createPolicyType(policyTypeServiceTemplate)).doesNotThrowAnyException();
@@ -245,60 +245,61 @@ public class TestPolicyProvider {
assertThatThrownBy(() -> {
String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID);
ToscaServiceTemplate badPolicyServiceTemplate =
- standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+ standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
- badPolicyServiceTemplate);
+ badPolicyServiceTemplate);
}).hasMessage(
- "PolicyType version not specified, the version of the PolicyType for this policy must be specified in the "
- + "type_version field");
+ "PolicyType version not specified, the version of the PolicyType for this policy must be specified in "
+ + "the type_version field");
assertThatThrownBy(() -> {
String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION);
ToscaServiceTemplate badPolicyServiceTemplate =
- standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+ standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
- badPolicyServiceTemplate);
+ badPolicyServiceTemplate);
}).hasMessageContaining(
- "policy type onap.policies.monitoring.cdap.tca.hi.lo.app:2.0.0 referenced in policy not found");
+ "item \"policy type\" value \"onap.policies.monitoring.cdap.tca.hi.lo.app:2.0.0\" INVALID, not found");
assertThatThrownBy(() -> {
String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_NO_POLICY_VERSION);
ToscaServiceTemplate badPolicyServiceTemplate =
- standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+ standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
- badPolicyServiceTemplate);
- }).hasMessageContaining("key version is a null version");
+ badPolicyServiceTemplate);
+ }).hasMessageContaining("item \"version\" value \"0.0.0\" INVALID, is null");
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate =
- policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
assertThatThrownBy(() -> {
String badPolicyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_WITH_DIFFERENT_FIELDS);
ToscaServiceTemplate badPolicyServiceTemplate =
- standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
+ standardCoder.decode(badPolicyString, ToscaServiceTemplate.class);
policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0",
- badPolicyServiceTemplate);
- }).hasMessageContaining("entity in incoming fragment does not equal existing entity");
+ badPolicyServiceTemplate);
+ }).hasMessageContaining(
+ "item \"entity\" value \"onap.restart.tca:1.0.0\" INVALID, " + "does not equal existing entity");
}
@Test
public void testCreateOperationalDroolsPolicy() throws CoderException, PfModelException {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_COMMON), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_OPERATIONAL_DROOLS), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE_OPERATIONAL);
ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
ToscaServiceTemplate serviceTemplate =
- policyProvider.createPolicy(POLICY_TYPE_OPERATIONAL_DROOLS, "1.0.0", policyServiceTemplate);
+ policyProvider.createPolicy(POLICY_TYPE_OPERATIONAL_DROOLS, "1.0.0", policyServiceTemplate);
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
}
@@ -308,71 +309,74 @@ public class TestPolicyProvider {
assertThatThrownBy(() -> {
String multiPoliciesString = ResourceUtils.getResourceAsString(MULTIPLE_POLICIES_RESOURCE);
ToscaServiceTemplate multiPoliciesServiceTemplate =
- standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
+ standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
policyProvider.createPolicies(multiPoliciesServiceTemplate);
}).hasMessageContaining(
- "no policy types are defined on the service template for the policies in the topology template");
+ "no policy types are defined on the service template for the policies in the topology template");
// Create required policy types
- ToscaServiceTemplate policyTypeServiceTemplate =
- standardYamlCoder.decode(ResourceUtils.getResourceAsString("policytypes/onap.policies.Optimization.yaml"),
+ ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder.decode(
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.Optimization.yaml"),
ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Resource.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Resource.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils
+ .getResourceAsString("policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.DistancePolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils
+ .getResourceAsString("policytypes/onap.policies.optimization.resource.DistancePolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.Vim_fit.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.Vim_fit.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.HpaPolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.HpaPolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.VnfPolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.resource.VnfPolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Service.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.Service.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils
+ .getResourceAsString("policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.QueryPolicy.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.service.QueryPolicy.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
policyTypeServiceTemplate = standardYamlCoder.decode(
- ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"),
- ToscaServiceTemplate.class);
+ ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"),
+ ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
// Create multiple policies in one call
String multiPoliciesString = ResourceUtils.getResourceAsString(MULTIPLE_POLICIES_RESOURCE);
ToscaServiceTemplate multiPoliciesServiceTemplate =
- standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
+ standardCoder.decode(multiPoliciesString, ToscaServiceTemplate.class);
assertThatCode(() -> {
policyProvider.createPolicies(multiPoliciesServiceTemplate);
@@ -389,7 +393,7 @@ public class TestPolicyProvider {
assertThatCode(() -> {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
}).doesNotThrowAnyException();
@@ -397,19 +401,19 @@ public class TestPolicyProvider {
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
ToscaServiceTemplate serviceTemplate = policyProvider
- .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
}).doesNotThrowAnyException();
assertThatCode(() -> {
ToscaServiceTemplate serviceTemplate = policyProvider
- .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0");
+ .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0");
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
}).doesNotThrowAnyException();
assertThatThrownBy(() -> {
policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca",
- "1.0.0");
+ "1.0.0");
}).hasMessageContaining("no policies found");
}
@@ -417,21 +421,19 @@ public class TestPolicyProvider {
public void testFetchAllPolicies() throws Exception {
// Create Policy Type
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
// Create Policy
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
- ToscaServiceTemplate policyServiceTemplate =
- standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
// Test fetch all policies
- policyTypeServiceTemplate = policyProvider
- .fetchPolicies(null, null, null, null, null);
+ policyTypeServiceTemplate = policyProvider.fetchPolicies(null, null, null, null, null);
assertThat(policyTypeServiceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
}
@@ -440,80 +442,74 @@ public class TestPolicyProvider {
public void testFetchSpecificPolicy_availablePolicy() throws Exception {
// Create Policy Type
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
// Create Policy
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
- ToscaServiceTemplate policyServiceTemplate =
- standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
// Test fetch specific policy
- assertThat(policyProvider.fetchPolicies(null, null, "onap.restart.tca",
- "1.0.0", null).getToscaTopologyTemplate().getPolicies()).hasSize(1);
+ assertThat(policyProvider.fetchPolicies(null, null, "onap.restart.tca", "1.0.0", null)
+ .getToscaTopologyTemplate().getPolicies()).hasSize(1);
}
@Test
public void testFetchSpecificPolicy_unavailablePolicy() throws Exception {
// Create Policy Type
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
// Create Policy
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
- ToscaServiceTemplate policyServiceTemplate =
- standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertNotNull(serviceTemplate.getToscaTopologyTemplate().getPolicies());
assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
// Test fetch specific policy
- assertThatThrownBy(() -> policyProvider.fetchPolicies(
- null, null, "onap.restart.tca", "2.0.0", null))
- .hasMessageContaining("policies for onap.restart.tca:2.0.0 do not exist");
+ assertThatThrownBy(() -> policyProvider.fetchPolicies(null, null, "onap.restart.tca", "2.0.0", null))
+ .hasMessageContaining("policies for onap.restart.tca:2.0.0 do not exist");
}
@Test
public void testDeleteSpecificPolicy_availablePolicy() throws Exception {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
- ToscaServiceTemplate svcTemplate = policyProvider
- .deletePolicy(null, null, "onap.restart.tca", "1.0.0");
+ ToscaServiceTemplate svcTemplate = policyProvider.deletePolicy(null, null, "onap.restart.tca", "1.0.0");
assertThat(svcTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
}
@Test
public void testDeleteSpecificPolicy_unavailablePolicy() throws Exception {
ToscaServiceTemplate policyTypeServiceTemplate = standardYamlCoder
- .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
+ .decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE), ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE);
ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class);
- ToscaServiceTemplate serviceTemplate = policyProvider.createPolicy(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
+ ToscaServiceTemplate serviceTemplate = policyProvider
+ .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate);
assertThat(serviceTemplate.getToscaTopologyTemplate().getPolicies()).hasSize(1);
- assertThatThrownBy(() -> policyProvider
- .deletePolicy(null, null, "onap.restart.tca", "2.0.0"))
- .hasMessageContaining("not found");
+ assertThatThrownBy(() -> policyProvider.deletePolicy(null, null, "onap.restart.tca", "2.0.0"))
+ .hasMessageContaining("not found");
- assertThatThrownBy(() -> policyProvider.deletePolicy(
- null, null, "onap.restart.tca.unavailable", "1.0.0"))
- .hasMessageContaining("not found");
+ assertThatThrownBy(() -> policyProvider.deletePolicy(null, null, "onap.restart.tca.unavailable", "1.0.0"))
+ .hasMessageContaining("not found");
}
}
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 5c7c25a9..9b2f3b85 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
@@ -59,8 +59,7 @@ public class TestPolicyTypeProvider {
private static final String POLICY_TYPE_VERSION = "1.0.0";
private static final String POLICY_RESOURCE_MONITORING = "policies/vCPE.policy.monitoring.input.tosca.yaml";
- private static final String POLICY_TYPE_RESOURCE_MONITORING =
- "policytypes/onap.policies.monitoring.tcagen2.yaml";
+ private static final String POLICY_TYPE_RESOURCE_MONITORING = "policytypes/onap.policies.monitoring.tcagen2.yaml";
private static final String POLICY_TYPE_RESOURCE_WITH_NO_VERSION =
"policytypes/onap.policies.optimization.Resource.no.version.yaml";
private static final String POLICY_TYPE_NAME_MONITORING = "onap.policies.monitoring.tcagen2";
@@ -90,8 +89,8 @@ public class TestPolicyTypeProvider {
providerParams.setDatabaseUser("policy");
providerParams.setDatabasePassword("P01icY");
providerParams.setPersistenceUnit("ToscaConceptTest");
- apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams,
- Collections.emptyList(), Collections.emptyList());
+ apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList(),
+ Collections.emptyList());
ParameterService.register(apiParamGroup, true);
policyTypeProvider = new PolicyTypeProvider();
policyProvider = new PolicyProvider();
@@ -145,20 +144,20 @@ public class TestPolicyTypeProvider {
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
}).doesNotThrowAnyException();
- ToscaPolicyType policyType =
- policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.tcagen2");
+ ToscaPolicyType policyType = policyTypeServiceTemplate.getPolicyTypes().get("onap.policies.monitoring.tcagen2");
policyType.setDescription("Some other description");
assertThatThrownBy(() -> {
policyTypeProvider.createPolicyType(policyTypeServiceTemplate);
- }).hasMessageContaining("entity in incoming fragment does not equal existing entity");
+ }).hasMessageContaining("item \"entity\" value \"onap.policies.monitoring.tcagen2:1.0.0\" INVALID, "
+ + "does not equal existing entity");
assertThatThrownBy(() -> {
ToscaServiceTemplate badPolicyType =
standardYamlCoder.decode(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE_WITH_NO_VERSION),
ToscaServiceTemplate.class);
policyTypeProvider.createPolicyType(badPolicyType);
- }).hasMessageContaining("INVALID:key version is a null version");
+ }).hasMessageContaining("item \"version\" value \"0.0.0\" INVALID, is null");
policyTypeProvider.deletePolicyType(POLICY_TYPE_NAME_MONITORING, POLICY_TYPE_VERSION);
}
@@ -210,8 +209,8 @@ public class TestPolicyTypeProvider {
policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");
}).hasMessage(exceptionMessage);
- serviceTemplate = policyProvider.deletePolicy("onap.policies.monitoring.tcagen2", "1.0.0",
- "onap.restart.tca", "1.0.0");
+ serviceTemplate =
+ policyProvider.deletePolicy("onap.policies.monitoring.tcagen2", "1.0.0", "onap.restart.tca", "1.0.0");
assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty());
serviceTemplate = policyTypeProvider.deletePolicyType("onap.policies.monitoring.tcagen2", "1.0.0");