diff options
Diffstat (limited to 'main/src/test/java')
6 files changed, 32 insertions, 32 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java index d2209e73..45653883 100644 --- a/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java +++ b/main/src/test/java/org/onap/policy/api/main/parameters/TestApiParameterGroup.java @@ -48,7 +48,7 @@ public class TestApiParameterGroup { final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(false); final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertTrue(validationResult.isValid()); assertEquals(restServerParameters.getHost(), apiParameters.getRestServerParameters().getHost()); @@ -68,8 +68,8 @@ public class TestApiParameterGroup { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT); final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(false); - final ApiParameterGroup apiParameters = new ApiParameterGroup(null, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + final ApiParameterGroup apiParameters = new ApiParameterGroup(null, restServerParameters, + databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertEquals(null, apiParameters.getName()); @@ -83,8 +83,8 @@ public class TestApiParameterGroup { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT); final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(false); - final ApiParameterGroup apiParameters = new ApiParameterGroup("", - restServerParameters, databaseProviderParameters, Collections.emptyList()); + final ApiParameterGroup apiParameters = new ApiParameterGroup("", restServerParameters, + databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertEquals("", apiParameters.getName()); @@ -98,7 +98,7 @@ public class TestApiParameterGroup { final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(false); final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() @@ -112,7 +112,7 @@ public class TestApiParameterGroup { final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(false); final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() @@ -126,7 +126,7 @@ public class TestApiParameterGroup { final PolicyModelsProviderParameters databaseProviderParameters = commonTestData.getDatabaseProviderParameters(true); final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() @@ -139,7 +139,7 @@ public class TestApiParameterGroup { final RestServerParameters restServerParameters = commonTestData.getRestServerParameters(false, PORT); final PolicyModelsProviderParameters databaseProviderParameters = null; final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - restServerParameters, databaseProviderParameters, Collections.emptyList()); + restServerParameters, databaseProviderParameters, Collections.emptyList(), Collections.emptyList()); final GroupValidationResult validationResult = apiParameters.validate(); assertFalse(validationResult.isValid()); assertTrue(validationResult.getResult() @@ -149,7 +149,7 @@ public class TestApiParameterGroup { @Test public void testApiParameterGroup_SetName() { final ApiParameterGroup apiParameters = new ApiParameterGroup(CommonTestData.API_GROUP_NAME, - null, null, Collections.emptyList()); + null, null, Collections.emptyList(), Collections.emptyList()); assertEquals(CommonTestData.API_GROUP_NAME, apiParameters.getName()); apiParameters.setName("SampleName"); assertEquals("SampleName", apiParameters.getName()); 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 4af601a2..7780ea7d 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 @@ -110,6 +110,9 @@ public class TestApiRestServer { private static final String POLICYTYPES_DROOLS_VERSION = POLICYTYPES_DROOLS + "/versions/1.0.0"; private static final String POLICYTYPES_DROOLS_VERSION_LATEST = POLICYTYPES_DROOLS + "/versions/latest"; + 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.cdap.tca.hi.lo.app/versions/1.0.0/policies"; private static final String POLICYTYPES_TCA_POLICIES_VCPE = @@ -252,7 +255,8 @@ public class TestApiRestServer { providerParams.setDatabaseUser("policy"); providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes())); providerParams.setPersistenceUnit("ToscaConceptTest"); - apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList()); + apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, + Collections.emptyList(), Collections.emptyList()); ParameterService.register(apiParamGroup, true); policyTypeProvider = new PolicyTypeProvider(); @@ -542,6 +546,9 @@ public class TestApiRestServer { rawResponse = readResource(POLICYTYPES_DROOLS_VERSION_LATEST, mediaType); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); + + rawResponse = readResource(POLICYTYPES_NAMING_VERSION, mediaType); + assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); } @Test @@ -611,12 +618,9 @@ public class TestApiRestServer { @Test public void testNamingPolicyGet() throws Exception { - Response rawResponse = createResource("policies", "policies/sdnc.policy.naming.input.tosca.yaml"); - assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); - rawResponse = readResource("policytypes/" - + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0", - APP_JSON); + Response rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/" + + "policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0", APP_JSON); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class); @@ -624,9 +628,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/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/latest", - APP_JSON); + rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/" + + "policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/latest", APP_JSON); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class); @@ -634,20 +637,13 @@ public class TestApiRestServer { assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size()); assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size()); - rawResponse = readResource( - "policytypes/" + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP", - APP_JSON); + rawResponse = readResource("policytypes/onap.policies.Naming/versions/1.0.0/policies", APP_JSON); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); namingServiceTemplate = rawResponse.readEntity(ToscaServiceTemplate.class); assertEquals(1, namingServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size()); assertEquals(1, namingServiceTemplate.getPolicyTypesAsMap().size()); assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size()); - - rawResponse = deleteResource("policytypes/" - + "onap.policies.Naming/versions/1.0.0/policies/SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP/versions/1.0.0", - APP_JSON); - assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); } @Test @@ -664,7 +660,7 @@ public class TestApiRestServer { Response rawResponse = deleteResource(POLICYTYPES_TCA_POLICIES_VCPE_VERSION1, mediaType); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policies found", error.getErrorMessage()); + assertEquals("policy onap.restart.tca:1.0.0 not found", error.getErrorMessage()); } @Test diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java index 342d17b1..dfe29cfc 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java @@ -105,7 +105,8 @@ public class TestLegacyGuardPolicyProvider { providerParams.setDatabaseUser("policy"); providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes())); providerParams.setPersistenceUnit("ToscaConceptTest"); - apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList()); + apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, + Collections.emptyList(), Collections.emptyList()); ParameterService.register(apiParamGroup, true); guardPolicyProvider = new LegacyGuardPolicyProvider(); policyTypeProvider = new PolicyTypeProvider(); 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 c0084956..74ad4a9d 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 @@ -100,7 +100,8 @@ public class TestLegacyOperationalPolicyProvider { providerParams.setDatabaseUser("policy"); providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes())); providerParams.setPersistenceUnit("ToscaConceptTest"); - apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList()); + apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, + Collections.emptyList(), Collections.emptyList()); ParameterService.register(apiParamGroup, true); operationalPolicyProvider = new LegacyOperationalPolicyProvider(); policyTypeProvider = new PolicyTypeProvider(); 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 d9b01fdb..be9b5838 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 @@ -107,7 +107,8 @@ public class TestPolicyProvider { providerParams.setDatabaseUser("policy"); providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes())); providerParams.setPersistenceUnit("ToscaConceptTest"); - apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList()); + apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, + Collections.emptyList(), Collections.emptyList()); ParameterService.register(apiParamGroup, true); policyTypeProvider = new PolicyTypeProvider(); policyProvider = new PolicyProvider(); 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 58576abc..58d4230c 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 @@ -91,7 +91,8 @@ public class TestPolicyTypeProvider { providerParams.setDatabaseUser("policy"); providerParams.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes())); providerParams.setPersistenceUnit("ToscaConceptTest"); - apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, Collections.emptyList()); + apiParamGroup = new ApiParameterGroup("ApiGroup", null, providerParams, + Collections.emptyList(), Collections.emptyList()); ParameterService.register(apiParamGroup, true); policyTypeProvider = new PolicyTypeProvider(); policyProvider = new PolicyProvider(); |