From ad83319991bdd6a25416eff9f0adde148e2eee35 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Thu, 13 Sep 2018 20:37:15 -0400 Subject: 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 --- .../drools/simulators/DMaaPSimulatorTest.java | 111 +++++++++++---------- 1 file changed, 57 insertions(+), 54 deletions(-) (limited to 'feature-simulators/src/test/java/org') 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 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 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 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 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 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 dmaapGet(String topic, int timeout) { @@ -345,12 +348,12 @@ public class DMaaPSimulatorTest { } private static class Pair { - 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; } } } -- cgit 1.2.3-korg