diff options
author | Jim Hahn <jrh3@att.com> | 2021-03-17 15:10:17 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-03-17 16:30:13 -0400 |
commit | 3e9fe84af892cd75c564da90481800a4131fc009 (patch) | |
tree | 8b54a93f852b43be17e43e909bd0ae8822a7a861 /applications/common/src/test | |
parent | 2cb02e53d2eb0374b13b92e87afaf86b0b4c7383 (diff) |
Change RestServerParameters to BusTopicParams
HTTP client parameters should be based on BusTopicParams instead of
RestServerParameters, modified the policyApiParameters.
Issue-ID: POLICY-3147
Change-Id: I73aa34bec3ab7e27e7a3474260f411ed55b6f933
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'applications/common/src/test')
3 files changed, 15 insertions, 16 deletions
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java index 31cb481f..23ebbaa9 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCallerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +47,6 @@ 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.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.utils.network.NetworkUtil; @@ -69,7 +68,7 @@ public class PolicyApiCallerTest { private static final String UNKNOWN_TYPE = "unknown"; private static int port; - private static RestServerParameters clientParams; + private static BusTopicParams clientParams; private PolicyApiCaller api; @@ -83,8 +82,8 @@ public class PolicyApiCallerTest { public static void setUpBeforeClass() throws Exception { port = NetworkUtil.allocPort(); - clientParams = mock(RestServerParameters.class); - when(clientParams.getHost()).thenReturn("localhost"); + clientParams = mock(BusTopicParams.class); + when(clientParams.getHostname()).thenReturn("localhost"); when(clientParams.getPort()).thenReturn(port); Properties props = new Properties(); @@ -93,7 +92,7 @@ public class PolicyApiCallerTest { final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + CLIENT_NAME; - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, clientParams.getHost()); + props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, clientParams.getHostname()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, Integer.toString(clientParams.getPort())); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, @@ -106,7 +105,7 @@ public class PolicyApiCallerTest { HttpServletServerFactoryInstance.getServerFactory().build(props).forEach(HttpServletServer::start); - assertTrue(NetworkUtil.isTcpPortOpen(clientParams.getHost(), clientParams.getPort(), 100, 100)); + assertTrue(NetworkUtil.isTcpPortOpen(clientParams.getHostname(), clientParams.getPort(), 100, 100)); } @AfterClass diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java index 1de1d79d..5cd54e8f 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslatorTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,9 +58,9 @@ 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.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.utils.coder.CoderException; @@ -85,7 +85,7 @@ public class StdMatchableTranslatorTest { private static final String CLIENT_NAME = "policy-api"; private static final StandardYamlCoder yamlCoder = new StandardYamlCoder(); private static int port; - private static RestServerParameters clientParams; + private static BusTopicParams clientParams; private static ToscaServiceTemplate testTemplate; @ClassRule @@ -106,8 +106,8 @@ public class StdMatchableTranslatorTest { // port = NetworkUtil.allocPort(); - clientParams = mock(RestServerParameters.class); - when(clientParams.getHost()).thenReturn("localhost"); + clientParams = mock(BusTopicParams.class); + when(clientParams.getHostname()).thenReturn("localhost"); when(clientParams.getPort()).thenReturn(port); Properties props = new Properties(); @@ -116,7 +116,7 @@ public class StdMatchableTranslatorTest { final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + CLIENT_NAME; - props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, clientParams.getHost()); + props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, clientParams.getHostname()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, Integer.toString(clientParams.getPort())); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, @@ -129,7 +129,7 @@ public class StdMatchableTranslatorTest { HttpServletServerFactoryInstance.getServerFactory().build(props).forEach(HttpServletServer::start); - assertTrue(NetworkUtil.isTcpPortOpen(clientParams.getHost(), clientParams.getPort(), 100, 100)); + assertTrue(NetworkUtil.isTcpPortOpen(clientParams.getHostname(), clientParams.getPort(), 100, 100)); // // Load our test policy type // diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java index 7d5dd664..76f22551 100644 --- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java +++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProviderTest.java @@ -56,7 +56,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; @@ -80,7 +80,7 @@ public class StdXacmlApplicationServiceProviderTest { private static final String POLICY_NAME = "my-name"; private static final String POLICY_VERSION = "1.2.3"; private static final String POLICY_TYPE = "my-type"; - private static final RestServerParameters apiRestParameters = new RestServerParameters(); + private static final BusTopicParams apiRestParameters = new BusTopicParams(); @Mock private ToscaPolicyTranslator trans; |