--- /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.logging;\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({ MRAppenderTest.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.logging;\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 MRAppenderTest {\r
+ private MRAppender appender = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ appender = new MRAppender();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testClose() {\r
+ /*try {\r
+ appender.close();\r
+ } catch (NullPointerException e) {\r
+ assertTrue(true);\r
+ }\r
+\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testRequiresLayout() {\r
+/*\r
+ appender.requiresLayout();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testAppend() {\r
+\r
+ /*try {\r
+ appender.append(null);\r
+ } catch (NullPointerException e) {\r
+ assertTrue(true);\r
+ }\r
+\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testActivateOptions() {\r
+\r
+/* appender.activateOptions();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetTopic() {\r
+\r
+ /* appender.getTopic();\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testSetTopic() {\r
+\r
+ /*appender.setTopic("testTopic");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testGetPartition() {\r
+\r
+ /* appender.getPartition();\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testSetPartition() {\r
+\r
+ /* appender.setPartition("partition");\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetHosts() {\r
+\r
+/* appender.getHosts();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetHosts() {\r
+/*\r
+ appender.setHosts("hosts");\r
+ assertTrue(true);\r
+*/\r
+ }\r
+\r
+ @Test\r
+ public void testGetMaxBatchSize() {\r
+\r
+ /*appender.getMaxBatchSize();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetMaxBatchSize() {\r
+\r
+ /* appender.setMaxBatchSize(20);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMaxAgeMs() {\r
+\r
+ /*appender.getMaxAgeMs();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetMaxAgeMs() {\r
+\r
+ /*appender.setMaxAgeMs(15);\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testIsCompress() {\r
+\r
+ /* appender.isCompress();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetCompress() {\r
+\r
+ /* appender.setCompress(true);\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.logging;\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class ConsolePublisherTest {\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+// try {\r
+// ConsolePublisher.main(null);\r
+// } catch (Exception e) {\r
+// // TODO Auto-generated catch block\r
+// e.printStackTrace();\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.test.clients;\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({ SimpleExamplePublisherTest.class, ProtocolTypeConstantsTest.class,\r
+ SampleConsumerTest.class, SamplePublisherTest.class, SimpleExampleConsumerTest.class, ConsolePublisherTest.class,\r
+ SimpleExamplePublisherWithResponseTest.class, SimpleExampleConsumerWithReturnResponseTest.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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class ProtocolTypeConstantsTest {\r
+ private ProtocolTypeConstants constants = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ //constants = new ProtocolTypeConstants();\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetValue() {\r
+\r
+// try {\r
+// constants.getValue();\r
+// } catch (Exception e) {\r
+// // TODO Auto-generated catch block\r
+// e.printStackTrace();\r
+// }\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class SampleConsumerTest {\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+ /* try {\r
+ SampleConsumer.main(null);\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class SamplePublisherTest {\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+ /* try {\r
+ SamplePublisher.main(null);\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class SimpleExampleConsumerTest {\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+ /*try {\r
+ SimpleExampleConsumer.main(null);\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class SimpleExampleConsumerWithReturnResponseTest {\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+// try {\r
+// SimpleExampleConsumerWithReturnResponse.main(null);\r
+// } catch (Exception e) {\r
+// // TODO Auto-generated catch block\r
+// e.printStackTrace();\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\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
+ /* try {\r
+ pub.publishMessage("/producer");\r
+ } catch (NullPointerException e) {\r
+ assertTrue(true);\r
+ } catch (IOException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (InterruptedException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testMain() {\r
+\r
+// try {\r
+// SimpleExamplePublisher.main(null);\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.test.clients;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class SimpleExamplePublisherWithResponseTest {\r
+ \r
+ private SimpleExamplePublisherWithResponse pub = null;\r
+ \r
+ @Before\r
+ public void setUp() throws Exception {\r
+ pub = new SimpleExamplePublisherWithResponse();\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testMain() {\r
+\r
+ /* try {\r
+ SimpleExamplePublisherWithResponse.main(null);\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testPublishMessage() {\r
+\r
+ /* try {\r
+ pub.publishMessage("/producer", 100);\r
+ } catch (Exception e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\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.test.clients;\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.test.support;\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({ MRBatchingPublisherMockTest.class, MRConsumerMockTest.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.test.support;\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 MRBatchingPublisherMockTest {\r
+ private MRBatchingPublisherMock pub = null;\r
+\r
+ private MRBatchingPublisherMock.Entry entry = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ pub = new MRBatchingPublisherMock();\r
+ entry = pub.new Entry("partition", "msg");\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testToString() {\r
+\r
+ entry.toString();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testAddListener() {\r
+\r
+ pub.addListener(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetCaptures() {\r
+\r
+ pub.getCaptures();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetCaptures2() {\r
+\r
+ pub.getCaptures(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testReceived() {\r
+\r
+ pub.received();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testResend() {\r
+\r
+ pub.reset();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSend() {\r
+\r
+ pub.send("partition", "msg");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSend2() {\r
+\r
+ pub.send("msg");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSend3() {\r
+ //sending message m obj\r
+ pub.send(new ArrayList<message>());\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSend4() {\r
+ //sending collection of message m objects\r
+ pub.send(new message("partition", "msg"));\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSendBatchWithResponse() {\r
+\r
+ pub.sendBatchWithResponse();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testLogTo() {\r
+\r
+ pub.logTo(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testClearApiCredentials() {\r
+\r
+ pub.clearApiCredentials();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testSetApiCredentials() {\r
+\r
+ pub.setApiCredentials("apikey", "apisecret");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testClose() {\r
+\r
+ pub.close();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testClose2() {\r
+\r
+ pub.close(100, null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testGetPendingMessageCount() {\r
+\r
+ pub.getPendingMessageCount();\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.test.support;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.IOException;\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.Entry;\r
+\r
+public class MRConsumerMockTest {\r
+ private MRConsumerMock cons = null;\r
+ private MRConsumerMock.Entry entry = null;\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ cons = new MRConsumerMock();\r
+ entry = cons.new Entry(100, 200, "statusMsg");\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testClose() {\r
+\r
+ cons.close();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testRun() {\r
+ try {\r
+ entry.run();\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 testSetApiCredentials() {\r
+ cons.setApiCredentials("apikey", "apisecret");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testClearApiCredentials() {\r
+ cons.clearApiCredentials();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAdd() {\r
+ cons.add(entry);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAddImmediateMsg() {\r
+ cons.addImmediateMsg("ImmediateMsg");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAddDelayedMsg() {\r
+ cons.addDelayedMsg(100, "msg");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAddImmediateMsgGroup() {\r
+ cons.addImmediateMsgGroup(new ArrayList<String>());\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAddDelayedMsgGroup() {\r
+ cons.addDelayedMsgGroup(100,new ArrayList<String>());\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testAddImmediateError() {\r
+ cons.addImmediateError(200, "OK");\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testFetch() {\r
+ try {\r
+ cons.fetch();\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 testFetch2() {\r
+ try {\r
+ cons.fetch(100, 200);\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 testLogTo() {\r
+ cons.logTo(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testFetchWithReturnConsumerResponse() {\r
+ cons.fetchWithReturnConsumerResponse();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testGetchWithReturnConsumerResponse() {\r
+ cons.fetchWithReturnConsumerResponse(100,200);\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.test.support;\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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class ApiKeyCommandTest {\r
+ private ApiKeyCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new ApiKeyCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ command.getMatches();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+ try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+ /* try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+*/\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+ /*try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class AuthCommandTest {\r
+ private AuthCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new AuthCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ command.getMatches();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+ try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+ /* try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+/* try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class ClusterCommandTest {\r
+ private ClusterCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new ClusterCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ /* command.getMatches();\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+/* try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+ /*try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+ /* try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\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.tools;\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({ ApiKeyCommandTest.class, AuthCommandTest.class, ClusterCommandTest.class,\r
+ MessageCommandTest.class, MRCommandContextTest.class, TopicCommandTest.class, TraceCommandTest.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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.apiClient.http.HttpTracer;\r
+import com.att.nsa.cmdtool.CommandNotReadyException;\r
+import com.att.nsa.mr.client.HostSelector;\r
+import com.att.nsa.mr.client.MRClient;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Entry;\r
+\r
+public class MRCommandContextTest {\r
+ private MRCommandContext command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new MRCommandContext();\r
+\r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ }\r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testRequestShutdown() {\r
+\r
+ command.requestShutdown();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testShouldContinue() {\r
+\r
+ command.shouldContinue();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testSetAuth() {\r
+\r
+ command.setAuth("key", "pwd");\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testClearAuth() {\r
+\r
+ command.clearAuth();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testCheckClusterReady() {\r
+\r
+ command.checkClusterReady();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetCluster() {\r
+\r
+ command.getCluster();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testClearCluster() {\r
+\r
+ command.clearCluster();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testAddClusterHost() {\r
+\r
+ command.addClusterHost("host");\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetApiKey() {\r
+\r
+ command.getApiKey();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetApiPwd() {\r
+\r
+ command.getApiPwd();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testUseTracer() {\r
+\r
+ command.useTracer(null);\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testNoTracer() {\r
+\r
+ command.noTracer();\r
+ assertTrue(true);\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testApplyTracer() {\r
+\r
+ command.applyTracer(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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class MessageCommandTest {\r
+ private MessageCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new MessageCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ command.getMatches();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+ try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+ /*try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+*/\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+ /* try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\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.tools;\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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class TopicCommandTest {\r
+ private TopicCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new TopicCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ command.getMatches();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+ try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+/* try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+*/\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+ /*try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\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.tools;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.PrintStream;\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.cmdtool.CommandNotReadyException;\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.Entry;\r
+\r
+public class TraceCommandTest {\r
+ private TraceCommand command = null;\r
+ private String[] parts = new String[5];\r
+\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ command = new TraceCommand();\r
+ \r
+ for (int i = 0; i < parts.length; i++) {\r
+ parts[i] = "String" + (i + 1);\r
+ } \r
+\r
+ }\r
+\r
+ @After\r
+ public void tearDown() throws Exception {\r
+\r
+ }\r
+\r
+ @Test\r
+ public void testGetMatches() {\r
+\r
+ command.getMatches();\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testCheckReady() {\r
+\r
+ try {\r
+ command.checkReady(new MRCommandContext());\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);\r
+\r
+ }\r
+ \r
+ @Test\r
+ public void testExecute() {\r
+ \r
+ /*try {\r
+ command.execute(parts, new MRCommandContext(), new PrintStream("/filename"));\r
+ } catch (CommandNotReadyException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ \r
+ @Test\r
+ public void testDisplayHelp() {\r
+ \r
+/* try {\r
+ command.displayHelp(new PrintStream("/filename"));\r
+ } catch (NullPointerException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } catch (FileNotFoundException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ assertTrue(true);*/\r
+\r
+ }\r
+ \r
+ \r
+ \r
+ \r
+}\r