commiting code for test coverage
[dmaap/messagerouter/msgrtr.git] / src / test / java / com / att / nsa / cambria / metrics / publisher / DMaaPCambriaClientFactoryTest.java
diff --git a/src/test/java/com/att/nsa/cambria/metrics/publisher/DMaaPCambriaClientFactoryTest.java b/src/test/java/com/att/nsa/cambria/metrics/publisher/DMaaPCambriaClientFactoryTest.java
new file mode 100644 (file)
index 0000000..c2b3391
--- /dev/null
@@ -0,0 +1,171 @@
+/*-\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.cambria.metrics.publisher;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.cambria.listener.DME2EndPointLoader;\r
+import com.att.nsa.cambria.metrics.publisher.CambriaConsumer;\r
+import com.att.nsa.cambria.metrics.publisher.CambriaPublisherUtility;\r
+import com.att.nsa.cambria.metrics.publisher.DMaaPCambriaClientFactory;\r
+\r
+public class DMaaPCambriaClientFactoryTest {\r
+       \r
+       private Collection<String> hostSet;\r
+       \r
+       private String[] hostSetArray; \r
+       @Before\r
+       public void setUp() throws Exception {\r
+               hostSet = new ArrayList<String>();\r
+               \r
+               hostSetArray = new String[10];\r
+               \r
+               for (int i = 0; i < 10; i++) {\r
+                       hostSet.add("host" + (i+1));\r
+                       hostSetArray[i] = "host" + (i+1);\r
+               }\r
+               \r
+       }\r
+\r
+       @After\r
+       public void tearDown() throws Exception {\r
+       }\r
+\r
+       @Test\r
+       public void testCreateConsumer() {\r
+               \r
+               \r
+               \r
+               DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer2() {\r
+               \r
+               \r
+               try {\r
+                       DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic");\r
+               } catch (NullPointerException e) {\r
+                       assertTrue(true);\r
+               }\r
+               \r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer3() {\r
+               \r
+               DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "filter");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer4() {\r
+               DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer5() {\r
+               \r
+               DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer6() {\r
+               \r
+               \r
+               DMaaPCambriaClientFactory.createConsumer("hostList", "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateConsumer7() {\r
+               \r
+               DMaaPCambriaClientFactory.createConsumer(hostSet, "testTopic", "CG1", "23", 100, 20, "filter", "apikey", "apisecret");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateSimplePublisher() {\r
+               \r
+               DMaaPCambriaClientFactory.createSimplePublisher("hostList", "testTopic");\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateBatchingPublisher() {\r
+               \r
+               DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateBatchingPublisher2() {\r
+               \r
+               DMaaPCambriaClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 50, true);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateBatchingPublisher3() {\r
+               \r
+               DMaaPCambriaClientFactory.createBatchingPublisher(hostSetArray, "testTopic", 100, 50, true);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void testCreateBatchingPublisher4() {\r
+               \r
+               DMaaPCambriaClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 50, true);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+       @Test\r
+       public void $testInject() {\r
+               \r
+               DMaaPCambriaClientFactory factory = new DMaaPCambriaClientFactory();\r
+               factory.$testInject(null);\r
+               assertTrue(true);\r
+               \r
+       }\r
+       \r
+}\r