diff options
Diffstat (limited to 'main/src/test/java')
5 files changed, 33 insertions, 37 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java b/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java index 21475da8..e4352181 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java @@ -37,6 +37,7 @@ import org.onap.policy.common.utils.coder.StandardCoder; */ public class CommonTestData { + private static final String CLIENT_NAME = "clientName"; private static final String PASS_KEY = "password"; private static final String USER_KEY = "userName"; private static final String PORT_KEY = "port"; @@ -143,6 +144,7 @@ public class CommonTestData { */ public Map<String, Object> getPolicyApiParametersMap(final boolean isEmpty) { final Map<String, Object> map = new TreeMap<>(); + map.put(CLIENT_NAME, XacmlPdpParameterGroup.PARAM_POLICY_API); map.put(HTTPS_KEY, POLICY_API_HTTPS); map.put(AAF_KEY, POLICY_API_AAF); diff --git a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java index cb9825cc..a9f3f12d 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java @@ -33,7 +33,7 @@ import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; +import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.parameters.ValidationResult; @@ -59,8 +59,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup() throws IOException { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -88,8 +88,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_NullParameterGroupName() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -107,8 +107,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyParameterGroupName() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -127,8 +127,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_NullPdpGroup() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -147,8 +147,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyPdpGroup() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -167,8 +167,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyRestServerParameters() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(true), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -187,8 +187,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyPolicyApiParameters() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(true), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(true), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -207,8 +207,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyTopicParameterGroup() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(true), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -227,8 +227,8 @@ public class TestXacmlPdpParameterGroup { public void testXacmlPdpParameterGroup_EmptyApplicationParameterGroup() { final RestServerParameters restServerParameters = testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class); - final BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + final RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); final TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java index 54d7432f..8d80b832 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java @@ -47,10 +47,10 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.internal.JerseyClient; +import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.utils.coder.CoderException; @@ -85,7 +85,7 @@ public class TestAbbreviateDecisionResults { private static File propertiesFile; private static XacmlApplicationServiceProvider service; - private static BusTopicParams policyApiParameters; + private static RestClientParameters policyApiParameters; @ClassRule public static final TemporaryFolder appsFolder = new TemporaryFolder(); @@ -117,7 +117,7 @@ public class TestAbbreviateDecisionResults { // Create parameters for XacmlPdPService RestServerParameters rest = testData.toObject(testData.getRestServerParametersMap(port), RestServerParameters.class); - policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -219,7 +219,7 @@ public class TestAbbreviateDecisionResults { */ private static HttpClient getNoAuthHttpClient() throws HttpClientConfigException, KeyManagementException, NoSuchAlgorithmException, ClassNotFoundException { - BusTopicParams clientParams = new BusTopicParams(); + RestClientParameters clientParams = new RestClientParameters(); clientParams.setClientName("testName"); clientParams.setUseHttps(false); clientParams.setAllowSelfSignedCerts(false); @@ -289,6 +289,6 @@ public class TestAbbreviateDecisionResults { // Tell it to initialize based on the properties file // we just built for it. // - service.initialize(propertiesFile.toPath().getParent(), policyApiParameters); + service.initialize(propertiesFile.toPath().getParent(), null); } } diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java index 5f6a2796..77e8873f 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java @@ -46,10 +46,10 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; +import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.utils.network.NetworkUtil; @@ -105,8 +105,8 @@ public class TestDecision { // RestServerParameters rest = testData.toObject(testData.getRestServerParametersMap(port), RestServerParameters.class); - BusTopicParams policyApiParameters = - testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class); + RestClientParameters policyApiParameters = + testData.toObject(testData.getPolicyApiParametersMap(false), RestClientParameters.class); TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class); final XacmlApplicationParameters xacmlApplicationParameters = @@ -245,7 +245,7 @@ public class TestDecision { } private static HttpClient getNoAuthHttpClient() throws HttpClientConfigException { - return HttpClientFactoryInstance.getClientFactory().build(BusTopicParams.builder() + return HttpClientFactoryInstance.getClientFactory().build(RestClientParameters.builder() .clientName("testDecisionClient") .useHttps(false).allowSelfSignedCerts(false).hostname("localhost").port(port) .basePath("policy/pdpx/v1") diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java index c79ebb52..036d4e35 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java @@ -35,7 +35,6 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -54,7 +53,6 @@ import org.slf4j.LoggerFactory; public class XacmlPdpApplicationManagerTest { private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPdpApplicationManagerTest.class); private static final StandardYamlCoder yamlCoder = new StandardYamlCoder(); - private static final BusTopicParams params = new BusTopicParams(); private static Path appsDirectory; private static ToscaServiceTemplate completedJtst; private static CommonTestData testData = new CommonTestData(); @@ -70,10 +68,6 @@ public class XacmlPdpApplicationManagerTest { @BeforeClass public static void setupTestEnvironment() throws Exception { // - // No need to do more than this - // - params.setClientName("policyApiParameters"); - // // Load an example policy // String policyYaml = ResourceUtils @@ -121,7 +115,7 @@ public class XacmlPdpApplicationManagerTest { // // Create our app manager // - XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); + XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, null); // // Still creates the manager, but the apps were not able to initialize // @@ -131,7 +125,7 @@ public class XacmlPdpApplicationManagerTest { // Now create the directory // Files.createDirectory(nonExistentPath); - manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); + manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, null); // // Now it should have initialized the apps // @@ -146,7 +140,7 @@ public class XacmlPdpApplicationManagerTest { final XacmlApplicationParameters xacmlApplicationParameters = testData.toObject(testData.getXacmlapplicationParametersMap(false, appsDirectory.toString(), exclusions), XacmlApplicationParameters.class); - XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); + XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, null); // // Test the basics from the startup // |