aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/CommonTestData.java14
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/parameters/TestXacmlPdpParameterGroup.java39
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestAbbreviateDecisionResults.java4
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java4
-rw-r--r--main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java8
5 files changed, 36 insertions, 33 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 6f73df56..ca8b763d 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
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
-import org.onap.policy.common.parameters.ParameterGroup;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -41,9 +40,10 @@ public class CommonTestData {
private static final String PASS_KEY = "password";
private static final String USER_KEY = "userName";
private static final String PORT_KEY = "port";
- private static final String HOST_KEY = "host";
+ private static final String SERVER_HOST_KEY = "host";
+ private static final String API_HOST_KEY = "hostname";
private static final String AAF_KEY = "aaf";
- private static final String HTTPS_KEY = "https";
+ private static final String HTTPS_KEY = "useHttps";
private static final String REST_SERVER_PASS = "zb!XztG34";
private static final String REST_SERVER_USER = "healthcheck";
@@ -92,7 +92,7 @@ public class CommonTestData {
map.put(AAF_KEY, REST_SERVER_AAF);
if (!isEmpty) {
- map.put(HOST_KEY, REST_SERVER_HOST);
+ map.put(SERVER_HOST_KEY, REST_SERVER_HOST);
map.put(PORT_KEY, REST_SERVER_PORT);
map.put(USER_KEY, REST_SERVER_USER);
map.put(PASS_KEY, REST_SERVER_PASS);
@@ -111,7 +111,7 @@ public class CommonTestData {
final Map<String, Object> map = new TreeMap<>();
map.put(HTTPS_KEY, REST_SERVER_HTTPS);
map.put(AAF_KEY, REST_SERVER_AAF);
- map.put(HOST_KEY, REST_SERVER_HOST);
+ map.put(SERVER_HOST_KEY, REST_SERVER_HOST);
map.put(PORT_KEY, port);
map.put(USER_KEY, REST_SERVER_USER);
map.put(PASS_KEY, REST_SERVER_PASS);
@@ -126,7 +126,7 @@ public class CommonTestData {
* @param clazz class of object to be created from the map
* @return a new object represented by the map
*/
- public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) {
+ public <T> T toObject(final Map<String, Object> source, final Class<T> clazz) {
try {
return coder.decode(coder.encode(source), clazz);
@@ -147,7 +147,7 @@ public class CommonTestData {
map.put(AAF_KEY, POLICY_API_AAF);
if (!isEmpty) {
- map.put(HOST_KEY, POLICY_API_HOST);
+ map.put(API_HOST_KEY, POLICY_API_HOST);
map.put(PORT_KEY, POLICY_API_PORT);
map.put(USER_KEY, POLICY_API_USER);
map.put(PASS_KEY, POLICY_API_PASS);
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 dfd3216e..1c4cf1d0 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
@@ -22,6 +22,7 @@
package org.onap.policy.pdpx.main.parameters;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -32,6 +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.RestServerParameters;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.GroupValidationResult;
@@ -57,8 +59,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup() throws IOException {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
@@ -66,6 +68,7 @@ public class TestXacmlPdpParameterGroup {
CommonTestData.PDPX_GROUP, "flavor", restServerParameters, policyApiParameters,
topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
+ assertThat(validationResult.getResult()).isNull();
assertTrue(validationResult.isValid());
assertEquals(restServerParameters.getHost(), pdpxParameters.getRestServerParameters().getHost());
assertEquals(restServerParameters.getPort(), pdpxParameters.getRestServerParameters().getPort());
@@ -81,8 +84,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_NullParameterGroupName() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup(null, CommonTestData.PDPX_GROUP,
@@ -99,8 +102,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_EmptyParameterGroupName() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters = new XacmlPdpParameterGroup("", CommonTestData.PDPX_GROUP,
@@ -117,8 +120,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_NullPdpGroup() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
@@ -136,8 +139,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_EmptyPdpGroup() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
@@ -155,8 +158,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_EmptyRestServerParameters() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(true), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
@@ -173,8 +176,8 @@ public class TestXacmlPdpParameterGroup {
public void testXacmlPdpParameterGroup_EmptyPolicyApiParameters() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(true), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(true), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
@@ -183,16 +186,16 @@ public class TestXacmlPdpParameterGroup {
topicParameterGroup, applicationPath.getAbsolutePath());
final GroupValidationResult validationResult = pdpxParameters.validate();
assertFalse(validationResult.isValid());
- assertTrue(validationResult.getResult()
- .contains("parameter group \"policyApiParameters\""));
+ assertThat(validationResult.getResult())
+ .contains("field \"policyApiParameters\"");
}
@Test
public void testXacmlPdpParameterGroup_EmptyTopicParameterGroup() {
final RestServerParameters restServerParameters =
testData.toObject(testData.getRestServerParametersMap(false), RestServerParameters.class);
- final RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ final BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
final TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(true), TopicParameterGroup.class);
final XacmlPdpParameterGroup pdpxParameters =
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 dbf977f2..93e541de 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
@@ -84,7 +84,7 @@ public class TestAbbreviateDecisionResults {
private static File propertiesFile;
private static XacmlApplicationServiceProvider service;
- private static RestServerParameters policyApiParameters;
+ private static BusTopicParams policyApiParameters;
@ClassRule
public static final TemporaryFolder appsFolder = new TemporaryFolder();
@@ -116,7 +116,7 @@ public class TestAbbreviateDecisionResults {
// Create parameters for XacmlPdPService
RestServerParameters rest = testData.toObject(testData.getRestServerParametersMap(port),
RestServerParameters.class);
- policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ policyApiParameters = testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
TopicParameterGroup topicParameterGroup = testData.toObject(testData.getTopicParametersMap(false),
TopicParameterGroup.class);
XacmlPdpParameterGroup params =
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 2d71543c..7fa552f4 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
@@ -104,8 +104,8 @@ public class TestDecision {
//
RestServerParameters rest =
testData.toObject(testData.getRestServerParametersMap(port), RestServerParameters.class);
- RestServerParameters policyApiParameters =
- testData.toObject(testData.getPolicyApiParametersMap(false), RestServerParameters.class);
+ BusTopicParams policyApiParameters =
+ testData.toObject(testData.getPolicyApiParametersMap(false), BusTopicParams.class);
TopicParameterGroup topicParameterGroup =
testData.toObject(testData.getTopicParametersMap(false), TopicParameterGroup.class);
XacmlPdpParameterGroup params =
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 4670e785..1673c043 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-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.
@@ -35,7 +35,7 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+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;
@@ -53,7 +53,7 @@ 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 RestServerParameters params = new RestServerParameters();
+ private static final BusTopicParams params = new BusTopicParams();
private static Path appsDirectory;
private static ToscaServiceTemplate completedJtst;
@@ -70,7 +70,7 @@ public class XacmlPdpApplicationManagerTest {
//
// No need to do more than this
//
- params.setName("policyApiParameters");
+ params.setClientName("policyApiParameters");
//
// Load an example policy
//