summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-simulators/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-simulators/src/test')
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java16
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java24
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java10
3 files changed, 25 insertions, 25 deletions
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
index 7a837788b..e553636ec 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/GuardSimulatorTest.java
@@ -3,7 +3,7 @@
* simulators
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -36,7 +37,6 @@ import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.rest.RestManager;
-import org.onap.policy.rest.RestManager.Pair;
public class GuardSimulatorTest {
private static final StandardCoder coder = new StandardCoder();
@@ -65,18 +65,18 @@ public class GuardSimulatorTest {
Pair<Integer, String> response =
new RestManager().post(url, "testUname", "testPass", null, "application/json", request);
assertNotNull(response);
- assertNotNull(response.first);
- assertNotNull(response.second);
+ assertNotNull(response.getLeft());
+ assertNotNull(response.getRight());
- DecisionResponse decision = coder.decode(response.second, DecisionResponse.class);
+ DecisionResponse decision = coder.decode(response.getRight(), DecisionResponse.class);
assertEquals("Permit", decision.getStatus());
request = makeRequest("test_actor_id", "test_op_id", "test_target", "denyGuard");
response = new RestManager().post(url, "testUname", "testPass", null, "application/json", request);
assertNotNull(response);
- assertNotNull(response.first);
- assertNotNull(response.second);
- decision = coder.decode(response.second, DecisionResponse.class);
+ assertNotNull(response.getLeft());
+ assertNotNull(response.getRight());
+ decision = coder.decode(response.getRight(), DecisionResponse.class);
assertEquals("Deny", decision.getStatus());
}
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
index fbeb08466..6dac1b042 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java
@@ -3,7 +3,7 @@
* simulators
* ================================================================================
* Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,12 +28,12 @@ import static org.junit.Assert.fail;
import java.util.HashMap;
import java.util.UUID;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.rest.RestManager;
-import org.onap.policy.rest.RestManager.Pair;
import org.onap.policy.so.SoCloudConfiguration;
import org.onap.policy.so.SoModelInfo;
import org.onap.policy.so.SoRelatedInstance;
@@ -144,7 +144,7 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>(), "application/json", request);
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"COMPLETE\"").contains("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"COMPLETE\"").contains("requestSelfLink");
/*
* Repeat, but set the flag indicating that the request should yield incomplete.
@@ -157,16 +157,16 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>(), "application/json", request);
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("requestSelfLink").doesNotContain("\"COMPLETE\"");
+ assertThat(httpDetails.getRight()).contains("requestSelfLink").doesNotContain("\"COMPLETE\"");
// now poll for the response
- String uri = extractUri(httpDetails.second);
+ String uri = extractUri(httpDetails.getRight());
httpDetails = new RestManager().get(
"http://localhost:6667/orchestrationRequests/v5/" + uri,
"username",
"password", new HashMap<>());
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"IN_PROGRESS\"").doesNotContain("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"IN_PROGRESS\"").doesNotContain("requestSelfLink");
// poll again
httpDetails = new RestManager().get(
@@ -174,7 +174,7 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>());
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"COMPLETE\"").doesNotContain("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"COMPLETE\"").doesNotContain("requestSelfLink");
}
@Test
@@ -186,7 +186,7 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>(), "application/json", request);
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"COMPLETE\"").contains("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"COMPLETE\"").contains("requestSelfLink");
/*
* Repeat, but set the flag indicating that the request should yield incomplete.
@@ -199,16 +199,16 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>(), "application/json", request);
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("requestSelfLink").doesNotContain("\"COMPLETE\"");
+ assertThat(httpDetails.getRight()).contains("requestSelfLink").doesNotContain("\"COMPLETE\"");
// now poll for the response
- String uri = extractUri(httpDetails.second);
+ String uri = extractUri(httpDetails.getRight());
httpDetails = new RestManager().get(
"http://localhost:6667/orchestrationRequests/v5/" + uri,
"username",
"password", new HashMap<>());
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"IN_PROGRESS\"").doesNotContain("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"IN_PROGRESS\"").doesNotContain("requestSelfLink");
// poll again
httpDetails = new RestManager().get(
@@ -216,7 +216,7 @@ public class SoSimulatorTest {
"username",
"password", new HashMap<>());
assertNotNull(httpDetails);
- assertThat(httpDetails.second).contains("\"COMPLETE\"").doesNotContain("requestSelfLink");
+ assertThat(httpDetails.getRight()).contains("\"COMPLETE\"").doesNotContain("requestSelfLink");
}
private String extractUri(String response) {
diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
index 379cfd7bc..d68e9dc5d 100644
--- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
+++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java
@@ -3,7 +3,7 @@
* simulators
* ================================================================================
* Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,12 +26,12 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.HashMap;
+import org.apache.commons.lang3.tuple.Pair;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.rest.RestManager;
-import org.onap.policy.rest.RestManager.Pair;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.util.Serialization;
@@ -60,8 +60,8 @@ public class VfcSimulatorTest {
new RestManager().post("http://localhost:6668/api/nslcm/v1/ns/1234567890/heal", "username", "password",
new HashMap<String, String>(), "application/json", "Some Request Here");
assertNotNull(httpDetails);
- assertTrue(httpDetails.first == 202);
- final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class);
+ assertTrue(httpDetails.getLeft() == 202);
+ final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
assertNotNull(response);
}
@@ -70,7 +70,7 @@ public class VfcSimulatorTest {
final Pair<Integer, String> httpDetails = new RestManager().get("http://localhost:6668/api/nslcm/v1/jobs/1234",
"username", "password", new HashMap<String, String>());
assertNotNull(httpDetails);
- final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, VfcResponse.class);
+ final VfcResponse response = Serialization.gsonPretty.fromJson(httpDetails.getRight(), VfcResponse.class);
assertNotNull(response);
}
}