--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+\r
+public class HostSelectorTest {\r
+ \r
+ @Before\r
+ public void setUp() throws Exception {\r
+ \r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+ \r
+ }\r
+\r
+ \r
+ @Test\r
+ public void testSelectBaseHost() {\r
+ \r
+// HostSelector selector = new HostSelector("host");\r
+// \r
+// selector.selectBaseHost();\r
+// assertTrue(true);\r
+// \r
+\r
+ }\r
+\r
+ @Test\r
+ public void testReportReachabilityProblem() {\r
+ \r
+/* HostSelector selector = new HostSelector("host");\r
+ \r
+ selector.reportReachabilityProblem(100, null);\r
+ assertTrue(true);*/\r
+ \r
+\r
+ }\r
+}\r
+\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client;\r
+\r
+import junit.framework.TestSuite;\r
+\r
+import org.junit.runner.RunWith;\r
+import org.junit.runners.Suite;\r
+import org.junit.runners.Suite.SuiteClasses;\r
+import org.apache.log4j.Logger;\r
+\r
+@RunWith(Suite.class)\r
+@SuiteClasses({ HostSelectorTest.class, MRClientBuildersTest.class, MRClientFactoryTest.class})\r
+\r
+public class JUnitTestSuite {\r
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
+\r
+ public static void main(String[] args) {\r
+ LOGGER.info("Running the test suite");\r
+ \r
+ TestSuite tstSuite = new TestSuite();\r
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRClient;\r
+import com.att.nsa.mr.client.MRClientBuilders;\r
+\r
+public class MRClientBuildersTest {\r
+\r
+ private Collection<String> hostSet = new ArrayList<String>();\r
+ private MRClientBuilders.ConsumerBuilder builder = null;\r
+ private MRClientBuilders.PublisherBuilder pBuilder = null;\r
+ private MRClientBuilders mrcBuilders = null;\r
+\r
+ private String[] hostArray = new String[10];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ /* for (int i = 0; i < 10; i++) {\r
+ hostSet.add("host" + (i + 1));\r
+ hostArray[i] = "host" + (i + 1);\r
+ }\r
+\r
+ builder = new MRClientBuilders.ConsumerBuilder();\r
+\r
+ pBuilder = new MRClientBuilders.PublisherBuilder();\r
+\r
+ mrcBuilders = new MRClientBuilders();*/\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testUsingHosts() {\r
+\r
+ /*builder.usingHosts("hostList");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testUsingHosts2() {\r
+\r
+ /*builder.usingHosts(hostSet);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testOnTopic() {\r
+\r
+/* builder.onTopic("testTopic");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testKnownAs() {\r
+\r
+ /* builder.knownAs("CG1", "23");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testAuthenticatedBy() {\r
+\r
+/* builder.authenticatedBy("apikey", "apisecret");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testWaitAtServer() {\r
+\r
+// builder.waitAtServer(100);\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testReceivingAtMost() {\r
+\r
+ /*builder.receivingAtMost(100);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testWithServerSideFilter() {\r
+\r
+ /*builder.withServerSideFilter("filter");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testBuild() {\r
+\r
+ /* try {\r
+\r
+ builder.build();\r
+ } catch (IllegalArgumentException e) {\r
+ assertTrue(true);\r
+ }*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testUsingHosts3() {\r
+\r
+/* pBuilder.usingHosts("testTopic");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testUsingHosts4() {\r
+\r
+/* pBuilder.usingHosts(hostArray);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testUsingHosts5() {\r
+\r
+/* pBuilder.usingHosts(hostSet);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testOnTopic2() {\r
+\r
+ /* pBuilder.onTopic("testTopic");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testLimitBatch() {\r
+\r
+ /*pBuilder.limitBatch(100, 10);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testWithCompresion() {\r
+\r
+ /* pBuilder.withCompresion();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testWithoutCompresion() {\r
+\r
+ /* pBuilder.withoutCompresion();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testEnableCompresion() {\r
+\r
+ /* pBuilder.enableCompresion(true);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testAuthenticatedBy2() {\r
+\r
+ /* pBuilder.authenticatedBy("apikey", "apisecret");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testBuild2() {\r
+\r
+ /* try {\r
+\r
+ pBuilder.build();\r
+ } catch (IllegalArgumentException e) {\r
+ assertTrue(true);\r
+ }*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void test$testInject() {\r
+\r
+ /*try {\r
+\r
+ mrcBuilders.$testInject(builder.build());\r
+ } catch (IllegalArgumentException e) {\r
+ assertTrue(true);\r
+ }*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void test$testInject2() {\r
+\r
+// try {\r
+//\r
+// mrcBuilders.$testInject(pBuilder.build());\r
+// } catch (IllegalArgumentException e) {\r
+// assertTrue(true);\r
+// }\r
+\r
+ }\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRClient;\r
+import com.att.nsa.mr.client.MRClientBuilders;\r
+import com.att.nsa.mr.client.MRClientFactory;\r
+\r
+public class MRClientFactoryTest {\r
+\r
+ private Collection<String> hostSet = new ArrayList<String>();\r
+\r
+ private MRClientFactory factory = null;\r
+\r
+ private String[] hostArray = new String[10];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ for (int i = 0; i < 10; i++) {\r
+ hostSet.add("host" + (i + 1));\r
+ hostArray[i] = "host" + (i + 1);\r
+ }\r
+\r
+ factory = new MRClientFactory();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer() {\r
+\r
+ /* MRClientFactory.createConsumer("hostList hostList2", "testTopic");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer2() {\r
+\r
+ /* MRClientFactory.createConsumer(hostSet, "testTopic");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer3() {\r
+\r
+ /* MRClientFactory.createConsumer(hostSet, "testTopic", "filter");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer4() {\r
+\r
+// MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22");\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer5() {\r
+\r
+/* MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer6() {\r
+\r
+ /* MRClientFactory.createConsumer("hostList", "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer7() {\r
+\r
+/* MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateSimplePublisher() {\r
+\r
+/* MRClientFactory.createSimplePublisher("hostList", "testTopic");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher1() {\r
+/*\r
+ MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher2() {\r
+/*\r
+ MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10, true);\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher3() {\r
+/*\r
+ MRClientFactory.createBatchingPublisher(hostArray, "testTopic", 100, 10, true);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher4() {\r
+\r
+// MRClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 10, true);\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher5() {\r
+//\r
+// MRClientFactory.createBatchingPublisher("host", "testTopic", "username", "password", 100, 10, true,\r
+// "protocolFlag", "/producer");\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher6() {\r
+//\r
+// try {\r
+// MRClientFactory.createBatchingPublisher("/producer");\r
+// } catch (IOException e) {\r
+// // TODO Auto-generated catch block\r
+// e.printStackTrace();\r
+// }\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateBatchingPublisher7() {\r
+\r
+ /* try {\r
+ MRClientFactory.createBatchingPublisher("/producer", true);\r
+ } catch (IOException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateIdentityManager() {\r
+/*\r
+ MRClientFactory.createIdentityManager(hostSet, "apikey", "apisecret");\r
+\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateTopicManager() {\r
+\r
+ /* MRClientFactory.createTopicManager(hostSet, "apikey", "apisecret");\r
+\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer8() {\r
+/*\r
+ try {\r
+ MRClientFactory.createConsumer("/consumer");\r
+ } catch (IOException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer9() {\r
+\r
+// MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", "protocolFlag",\r
+// "/consumer", 1, 2);\r
+//\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCreateConsumer10() {\r
+\r
+// MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", 1, 2, "protocolFlag",\r
+// "/consumer");\r
+//\r
+// assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void test$testInject() {\r
+\r
+/* MRClientFactory.$testInject(null);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client;\r
+\r
+import org.junit.runner.JUnitCore;\r
+import org.junit.runner.Result;\r
+import org.junit.runner.notification.Failure;\r
+import org.apache.log4j.Logger;\r
+\r
+public class TestRunner {\r
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
+\r
+ public static void main(String[] args) {\r
+ // TODO Auto-generated method stub\r
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
+ for (Failure failure : result.getFailures()) {\r
+ LOGGER.info(failure.toString());\r
+ \r
+ }\r
+ LOGGER.info(result.wasSuccessful());\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client.response;\r
+\r
+import junit.framework.TestSuite;\r
+\r
+import org.junit.runner.RunWith;\r
+import org.junit.runners.Suite;\r
+import org.junit.runners.Suite.SuiteClasses;\r
+import org.apache.log4j.Logger;\r
+\r
+@RunWith(Suite.class)\r
+@SuiteClasses({ MRConsumerResponseTest.class, MRPublisherResponseTest.class,})\r
+\r
+public class JUnitTestSuite {\r
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
+\r
+ public static void main(String[] args) {\r
+ LOGGER.info("Running the test suite");\r
+ \r
+ TestSuite tstSuite = new TestSuite();\r
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client.response;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+\r
+public class MRConsumerResponseTest {\r
+ private MRConsumerResponse test = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ test = new MRConsumerResponse();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetResponseCode() {\r
+\r
+ test.getResponseCode();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetResponseCode() {\r
+\r
+ test.setResponseCode("200");\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetResponseMessage() {\r
+\r
+ test.getResponseMessage();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetResponseMessage() {\r
+\r
+ test.setResponseMessage("responseMessage");\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetActualMessages() {\r
+\r
+ test.getActualMessages();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetActualMessages() {\r
+\r
+ test.setActualMessages(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client.response;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+\r
+public class MRPublisherResponseTest {\r
+ private MRPublisherResponse response = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ response = new MRPublisherResponse();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetResponseCode() {\r
+\r
+ response.getResponseCode();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSetResponseCode() {\r
+\r
+ response.setResponseCode("200");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testGetResponseMessage() {\r
+\r
+ response.getResponseMessage();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetResponseMessage() {\r
+\r
+ response.setResponseMessage("responseMessage");\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetPendingMsgs() {\r
+\r
+ response.getPendingMsgs();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetPendingMsgs() {\r
+\r
+ response.setPendingMsgs(5);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testToString() {\r
+\r
+ response.toString();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ \r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.client.response;\r
+\r
+import org.junit.runner.JUnitCore;\r
+import org.junit.runner.Result;\r
+import org.junit.runner.notification.Failure;\r
+import org.apache.log4j.Logger;\r
+\r
+public class TestRunner {\r
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
+\r
+ public static void main(String[] args) {\r
+ // TODO Auto-generated method stub\r
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
+ for (Failure failure : result.getFailures()) {\r
+ LOGGER.info(failure.toString());\r
+ \r
+ }\r
+ LOGGER.info(result.wasSuccessful());\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
+\r
+public class DefaultLoggingFailoverFaultHandlerTest {\r
+ private DefaultLoggingFailoverFaultHandler handler = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ handler = new DefaultLoggingFailoverFaultHandler();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testHandleEndpointFailover() {\r
+\r
+// handler.handleEndpointFailover(null);\r
+// assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testHandleRouteOfferFailover() {\r
+\r
+ /* handler.handleRouteOfferFailover(null);\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
+\r
+public class HeaderReplyHandlerTest {\r
+ private HeaderReplyHandler handler = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ handler = new HeaderReplyHandler();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testHandleFault() {\r
+\r
+ handler.handleFault(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testHandleEndpointFault() {\r
+\r
+ handler.handleEndpointFault(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testHandleReply() {\r
+\r
+ handler.handleReply(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import junit.framework.TestSuite;\r
+\r
+import org.junit.runner.RunWith;\r
+import org.junit.runners.Suite;\r
+import org.junit.runners.Suite.SuiteClasses;\r
+import org.apache.log4j.Logger;\r
+\r
+@RunWith(Suite.class)\r
+@SuiteClasses({ DefaultLoggingFailoverFaultHandlerTest.class, HeaderReplyHandlerTest.class,PreferredRouteReplyHandlerTest.class,\r
+ PreferredRouteRequestHandlerTest.class,SimpleExamplePublisherTest.class })\r
+\r
+public class JUnitTestSuite {\r
+ private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);\r
+\r
+ public static void main(String[] args) {\r
+ LOGGER.info("Running the test suite");\r
+ \r
+ TestSuite tstSuite = new TestSuite();\r
+ LOGGER.info("Total Test Counts " + tstSuite.countTestCases());\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
+\r
+public class PreferredRouteReplyHandlerTest {\r
+ private PreferredRouteReplyHandler handler = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ handler = new PreferredRouteReplyHandler();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testHandleReply() {\r
+\r
+// handler.handleReply(null);\r
+// assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testHandleFault() {\r
+/*\r
+ handler.handleFault(null);\r
+ assertTrue(true);\r
+*/\r
+ }\r
+ \r
+ @Test\r
+ public void testHandleEndpointFault() {\r
+\r
+/* handler.handleEndpointFault(null);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testRouteWriter() {\r
+/*\r
+ handler.routeWriter("routeKey", "routeValue");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+ \r
+ \r
+ \r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
+\r
+public class PreferredRouteRequestHandlerTest {\r
+ private PreferredRouteRequestHandler handler = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ handler = new PreferredRouteRequestHandler();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testHandleRequest() {\r
+\r
+ /* handler.handleRequest(null);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testReadRoute() {\r
+\r
+// try {\r
+// handler.readRoute("routeKey");\r
+// } catch (NullPointerException e) {\r
+// assertTrue(true);\r
+// }\r
+//\r
+// assertTrue(true);\r
+\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.ArrayList;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;\r
+\r
+public class SimpleExamplePublisherTest {\r
+ private SimpleExamplePublisher pub = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ pub = new SimpleExamplePublisher();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testPublishMessage() {\r
+\r
+/* try {\r
+ pub.publishMessage("/producer");\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ \r
+\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP Policy Engine\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package com.att.nsa.mr.dme.client;\r
+\r
+import org.junit.runner.JUnitCore;\r
+import org.junit.runner.Result;\r
+import org.junit.runner.notification.Failure;\r
+import org.apache.log4j.Logger;\r
+\r
+public class TestRunner {\r
+ private static final Logger LOGGER = Logger.getLogger(TestRunner.class);\r
+\r
+ public static void main(String[] args) {\r
+ // TODO Auto-generated method stub\r
+ Result result = JUnitCore.runClasses(JUnitTestSuite.class);\r
+ for (Failure failure : result.getFailures()) {\r
+ LOGGER.info(failure.toString());\r
+ \r
+ }\r
+ LOGGER.info(result.wasSuccessful());\r
+ }\r
+\r
+}\r