aboutsummaryrefslogtreecommitdiffstats
path: root/applications/optimization
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-07-19 11:59:46 -0400
committerJim Hahn <jrh3@att.com>2021-07-19 13:58:51 -0400
commit1c35a18a77bd4d55e419a8b6c275bce0a1037e05 (patch)
tree4e318624467a5b7b273cc906f4067db57b5c05eb /applications/optimization
parente3d0ebb1599c36f23ec82ca2f428af6db8fa4373 (diff)
Use new RestClientParameters class in xacml-pdp
Replaced generic BusTopicParams with more specific RestClientParameters. Also modified code to pass the HttpClient around instead of passing the client parameters around. Issue-ID: POLICY-3456 Change-Id: Ic07b710645eeab696e6df0a015171578ad08ca83 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'applications/optimization')
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java8
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java9
2 files changed, 5 insertions, 12 deletions
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
index 998ed537..42ceb4b4 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
@@ -34,7 +34,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
+import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -87,18 +87,18 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
}
@Override
- public void initialize(Path pathForData, BusTopicParams policyApiParameters)
+ public void initialize(Path pathForData, HttpClient policyApiClient)
throws XacmlApplicationException {
//
// Store our API parameters and path for translator so it
// can go get Policy Types
//
this.translator.setPathForData(pathForData);
- this.translator.setApiRestParameters(policyApiParameters);
+ this.translator.setApiClient(policyApiClient);
//
// Let our super class do its thing
//
- super.initialize(pathForData, policyApiParameters);
+ super.initialize(pathForData, policyApiClient);
}
@Override
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
index a3b218c6..674169e8 100644
--- a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
@@ -25,8 +25,6 @@ package org.onap.policy.xacml.pdp.application.optimization;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import com.att.research.xacml.api.Response;
import com.google.common.collect.Lists;
@@ -48,7 +46,6 @@ import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runners.MethodSorters;
-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.StandardCoder;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
@@ -76,7 +73,6 @@ public class OptimizationPdpApplicationTest {
private static XacmlApplicationServiceProvider service;
private static StandardCoder gson = new StandardCoder();
private static DecisionRequest baseRequest;
- private static BusTopicParams clientParams;
private static String[] listPolicyTypeFiles = {
"onap.policies.Optimization",
"onap.policies.optimization.Resource",
@@ -101,9 +97,6 @@ public class OptimizationPdpApplicationTest {
*/
@BeforeClass
public static void setUp() throws Exception {
- clientParams = mock(BusTopicParams.class);
- when(clientParams.getHostname()).thenReturn("localhost");
- when(clientParams.getPort()).thenReturn(6969);
//
// Load Single Decision Request
//
@@ -162,7 +155,7 @@ public class OptimizationPdpApplicationTest {
// Tell it to initialize based on the properties file
// we just built for it.
//
- service.initialize(propertiesFile.toPath().getParent(), clientParams);
+ service.initialize(propertiesFile.toPath().getParent(), null);
}
/**