aboutsummaryrefslogtreecommitdiffstats
path: root/feature-simulators/src/test/java
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-13 20:37:15 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-13 20:56:08 -0400
commitad83319991bdd6a25416eff9f0adde148e2eee35 (patch)
treebbaa601361802763cebf014160b87fa897d62a58 /feature-simulators/src/test/java
parentc733c08b7201ffdee81c7dab2ed50a1ce8fd5bbb (diff)
Fix checkstyle for features submodules.
These are the remaining submodules that have checkstyle. Pretty clean compile after this. There were a couple of sonar fixes in there also. Issue-ID: POLICY-882 Change-Id: I8191ea1aa261f4a7b9d3d21c108572fd31db1b8c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'feature-simulators/src/test/java')
-rw-r--r--feature-simulators/src/test/java/org/onap/policy/drools/simulators/DMaaPSimulatorTest.java111
1 files changed, 57 insertions, 54 deletions
diff --git a/feature-simulators/src/test/java/org/onap/policy/drools/simulators/DMaaPSimulatorTest.java b/feature-simulators/src/test/java/org/onap/policy/drools/simulators/DMaaPSimulatorTest.java
index 1a19284b..2a849525 100644
--- a/feature-simulators/src/test/java/org/onap/policy/drools/simulators/DMaaPSimulatorTest.java
+++ b/feature-simulators/src/test/java/org/onap/policy/drools/simulators/DMaaPSimulatorTest.java
@@ -44,6 +44,9 @@ public class DMaaPSimulatorTest {
private static final int DMAAPSIM_SERVER_PORT = 6670;
+ /**
+ * Setup the simulator.
+ */
@BeforeClass
public static void setUpSimulator() {
LoggerUtil.setLevel("ROOT", "INFO");
@@ -71,8 +74,8 @@ public class DMaaPSimulatorTest {
int timeout = 1000;
Pair<Integer, String> response = dmaapGet("myTopicNoData", timeout);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals("No topic", response.b);
+ assertNotNull(response.first);
+ assertEquals("No topic", response.second);
}
@Test
@@ -81,13 +84,13 @@ public class DMaaPSimulatorTest {
String testData = "This is some test data";
Pair<Integer, String> response = dmaapPost(myTopic, testData);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet(myTopic, 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(testData, response.b);
+ assertNotNull(response.first);
+ assertEquals(testData, response.second);
}
@Test
@@ -96,118 +99,118 @@ public class DMaaPSimulatorTest {
String myTopic = "myTopicMultiPost";
Pair<Integer, String> response = dmaapPost(myTopic, data[0]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapPost(myTopic, data[1]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapPost(myTopic, data[2]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet(myTopic, 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[0], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[0], response.second);
response = dmaapGet(myTopic, 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[1], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[1], response.second);
response = dmaapGet(myTopic, 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[2], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[2], response.second);
}
@Test
public void testMultiTopic() {
String[][] data = {{"Topic one message one", "Topic one message two"},
- {"Topic two message one", "Topic two message two"}};
+ {"Topic two message one", "Topic two message two"}};
String[] topics = {"topic1", "topic2"};
Pair<Integer, String> response = dmaapPost(topics[0], data[0][0]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet(topics[0], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[0][0], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[0][0], response.second);
response = dmaapGet(topics[1], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals("No topic", response.b);
+ assertNotNull(response.first);
+ assertEquals("No topic", response.second);
response = dmaapPost(topics[1], data[1][0]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapPost(topics[1], data[1][1]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapPost(topics[0], data[0][1]);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet(topics[1], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[1][0], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[1][0], response.second);
response = dmaapGet(topics[0], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[0][1], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[0][1], response.second);
response = dmaapGet(topics[1], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals(data[1][1], response.b);
+ assertNotNull(response.first);
+ assertEquals(data[1][1], response.second);
response = dmaapGet(topics[0], 1000);
assertNotNull(response);
- assertNotNull(response.a);
- assertEquals("No Data", response.b);
+ assertNotNull(response.first);
+ assertEquals("No Data", response.second);
}
@Test
public void testResponseCode() {
Pair<Integer, String> response = dmaapPost("myTopic", "myTopicData");
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = setStatus(503);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet("myTopic", 500);
assertNotNull(response);
- assertEquals(503, response.a.intValue());
- assertEquals("You got response code: 503", response.b);
+ assertEquals(503, response.first.intValue());
+ assertEquals("You got response code: 503", response.second);
response = setStatus(202);
assertNotNull(response);
- assertNotNull(response.a);
- assertNotNull(response.b);
+ assertNotNull(response.first);
+ assertNotNull(response.second);
response = dmaapGet("myTopic", 500);
assertNotNull(response);
- assertEquals(202, response.a.intValue());
- assertEquals("myTopicData", response.b);
+ assertEquals(202, response.first.intValue());
+ assertEquals("myTopicData", response.second);
}
private static Pair<Integer, String> dmaapGet(String topic, int timeout) {
@@ -345,12 +348,12 @@ public class DMaaPSimulatorTest {
}
private static class Pair<A, B> {
- public final A a;
- public final B b;
+ public final A first;
+ public final B second;
- public Pair(A a, B b) {
- this.a = a;
- this.b = b;
+ public Pair(A first, B second) {
+ this.first = first;
+ this.second = second;
}
}
}