aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/att/nsa/mr/client/HostSelectorTest.java68
-rw-r--r--src/test/java/com/att/nsa/mr/client/JUnitTestSuite.java43
-rw-r--r--src/test/java/com/att/nsa/mr/client/MRClientBuildersTest.java248
-rw-r--r--src/test/java/com/att/nsa/mr/client/MRClientFactoryTest.java252
-rw-r--r--src/test/java/com/att/nsa/mr/client/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java85
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java471
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRBatchPublisherTest.java54
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRConstantsTest.java143
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRConsumerImplTest.java112
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRMetaClientTest.java129
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchConsumerTest.java76
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisherTest.java96
-rw-r--r--src/test/java/com/att/nsa/mr/client/response/JUnitTestSuite.java43
-rw-r--r--src/test/java/com/att/nsa/mr/client/response/MRConsumerResponseTest.java94
-rw-r--r--src/test/java/com/att/nsa/mr/client/response/MRPublisherResponseTest.java104
-rw-r--r--src/test/java/com/att/nsa/mr/client/response/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandlerTest.java69
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/HeaderReplyHandlerTest.java79
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/JUnitTestSuite.java44
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandlerTest.java88
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandlerTest.java74
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/SimpleExamplePublisherTest.java68
-rw-r--r--src/test/java/com/att/nsa/mr/dme/client/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/logging/JUnitTestSuite.java43
-rw-r--r--src/test/java/com/att/nsa/mr/logging/MRAppenderTest.java184
-rw-r--r--src/test/java/com/att/nsa/mr/logging/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/ConsolePublisherTest.java55
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/JUnitTestSuite.java45
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/ProtocolTypeConstantsTest.java61
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SampleConsumerTest.java54
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SamplePublisherTest.java55
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerTest.java55
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerWithReturnResponseTest.java54
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherTest.java80
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherWithResponseTest.java68
-rw-r--r--src/test/java/com/att/nsa/mr/test/clients/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/test/support/JUnitTestSuite.java43
-rw-r--r--src/test/java/com/att/nsa/mr/test/support/MRBatchingPublisherMockTest.java191
-rw-r--r--src/test/java/com/att/nsa/mr/test/support/MRConsumerMockTest.java174
-rw-r--r--src/test/java/com/att/nsa/mr/test/support/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/tools/ApiKeyCommandTest.java217
-rw-r--r--src/test/java/com/att/nsa/mr/tools/AuthCommandTest.java113
-rw-r--r--src/test/java/com/att/nsa/mr/tools/ClusterCommandTest.java106
-rw-r--r--src/test/java/com/att/nsa/mr/tools/JUnitTestSuite.java44
-rw-r--r--src/test/java/com/att/nsa/mr/tools/MRCommandContextTest.java165
-rw-r--r--src/test/java/com/att/nsa/mr/tools/MessageCommandTest.java214
-rw-r--r--src/test/java/com/att/nsa/mr/tools/TestRunner.java41
-rw-r--r--src/test/java/com/att/nsa/mr/tools/ToolsUtilTest.java51
-rw-r--r--src/test/java/com/att/nsa/mr/tools/TopicCommandTest.java224
-rw-r--r--src/test/java/com/att/nsa/mr/tools/TraceCommandTest.java102
-rw-r--r--src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java315
52 files changed, 0 insertions, 5440 deletions
diff --git a/src/test/java/com/att/nsa/mr/client/HostSelectorTest.java b/src/test/java/com/att/nsa/mr/client/HostSelectorTest.java
deleted file mode 100644
index fd6dee8..0000000
--- a/src/test/java/com/att/nsa/mr/client/HostSelectorTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-
-public class HostSelectorTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
-
- @Test
- public void testSelectBaseHost() {
-
- HostSelector selector = new HostSelector("host");
-
- selector.selectBaseHost();
- assertTrue(true);
-
-
- }
-
- @Test
- public void testReportReachabilityProblem() {
-
- HostSelector selector = new HostSelector("host");
-
- selector.reportReachabilityProblem(100, null);
- assertTrue(true);
-
-
- }
-}
-
diff --git a/src/test/java/com/att/nsa/mr/client/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/client/JUnitTestSuite.java
deleted file mode 100644
index 095e1d8..0000000
--- a/src/test/java/com/att/nsa/mr/client/JUnitTestSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ HostSelectorTest.class, MRClientBuildersTest.class, MRClientFactoryTest.class})
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/MRClientBuildersTest.java b/src/test/java/com/att/nsa/mr/client/MRClientBuildersTest.java
deleted file mode 100644
index 9a0a3ce..0000000
--- a/src/test/java/com/att/nsa/mr/client/MRClientBuildersTest.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRClient;
-import com.att.nsa.mr.client.MRClientBuilders;
-
-public class MRClientBuildersTest {
-
- private Collection<String> hostSet = new ArrayList<String>();
- private MRClientBuilders.ConsumerBuilder builder = null;
- private MRClientBuilders.PublisherBuilder pBuilder = null;
- private String[] hostArray = new String[10];
-
- @Before
- public void setUp() throws Exception {
-
- for (int i = 0; i < 10; i++) {
- hostSet.add("host" + (i + 1));
- hostArray[i] = "host" + (i + 1);
- }
-
- builder = new MRClientBuilders.ConsumerBuilder();
-
- pBuilder = new MRClientBuilders.PublisherBuilder();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testUsingHosts() {
-
- builder.usingHosts("hostList");
- assertTrue(true);
-
- }
-
- @Test
- public void testUsingHosts2() {
-
- builder.usingHosts(hostSet);
- assertTrue(true);
-
- }
-
- @Test
- public void testOnTopic() {
-
- builder.onTopic("testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testKnownAs() {
-
- builder.knownAs("CG1", "23");
- assertTrue(true);
-
- }
-
- @Test
- public void testAuthenticatedBy() {
-
- builder.authenticatedBy("apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testWaitAtServer() {
-
- builder.waitAtServer(100);
- assertTrue(true);
-
- }
-
- @Test
- public void testReceivingAtMost() {
-
- builder.receivingAtMost(100);
- assertTrue(true);
-
- }
-
- @Test
- public void testWithServerSideFilter() {
-
- builder.withServerSideFilter("filter");
- assertTrue(true);
-
- }
-
- @Test
- public void testBuild() {
-
- try {
-
- builder.build();
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- }
-
- @Test
- public void testUsingHosts3() {
-
- pBuilder.usingHosts("testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testUsingHosts4() {
-
- pBuilder.usingHosts(hostArray);
- assertTrue(true);
-
- }
-
- @Test
- public void testUsingHosts5() {
-
- pBuilder.usingHosts(hostSet);
- assertTrue(true);
-
- }
-
- @Test
- public void testOnTopic2() {
-
- pBuilder.onTopic("testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testLimitBatch() {
-
- pBuilder.limitBatch(100, 10);
- assertTrue(true);
-
- }
-
- @Test
- public void testWithCompresion() {
-
- pBuilder.withCompresion();
- assertTrue(true);
-
- }
-
- @Test
- public void testWithoutCompresion() {
-
- pBuilder.withoutCompresion();
- assertTrue(true);
-
- }
-
- @Test
- public void testEnableCompresion() {
-
- pBuilder.enableCompresion(true);
- assertTrue(true);
-
- }
-
- @Test
- public void testAuthenticatedBy2() {
-
- pBuilder.authenticatedBy("apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testBuild2() {
-
- try {
-
- pBuilder.build();
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- }
-
- @Test
- public void test$testInject() {
-
- try {
-
- MRClientBuilders.$testInject(builder.build());
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- }
-
- @Test
- public void test$testInject2() {
-
- try {
-
- MRClientBuilders.$testInject(pBuilder.build());
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/client/MRClientFactoryTest.java b/src/test/java/com/att/nsa/mr/client/MRClientFactoryTest.java
deleted file mode 100644
index 7ea091b..0000000
--- a/src/test/java/com/att/nsa/mr/client/MRClientFactoryTest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright © 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRClient;
-import com.att.nsa.mr.client.MRClientBuilders;
-import com.att.nsa.mr.client.MRClientFactory;
-
-public class MRClientFactoryTest {
-
- private Collection<String> hostSet = new ArrayList<String>();
-
- private String[] hostArray = new String[10];
-
- @Before
- public void setUp() throws Exception {
-
- for (int i = 0; i < 10; i++) {
- hostSet.add("host" + (i + 1));
- hostArray[i] = "host" + (i + 1);
- }
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testCreateConsumer() {
-
- MRClientFactory.createConsumer("hostList hostList2", "testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer2() {
-
- MRClientFactory.createConsumer(hostSet, "testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer3() {
-
- MRClientFactory.createConsumer(hostSet, "testTopic", "filter");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer4() {
-
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer5() {
-
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100);
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer6() {
-
- MRClientFactory.createConsumer("hostList", "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer7() {
-
- MRClientFactory.createConsumer(hostSet, "testTopic", "CG1", "22", 100, 100, "filter", "apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateSimplePublisher() {
-
- MRClientFactory.createSimplePublisher("hostList", "testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher1() {
-
- MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10);
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher2() {
-
- MRClientFactory.createBatchingPublisher("hostList", "testTopic", 100, 10, true);
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher3() {
-
- MRClientFactory.createBatchingPublisher(hostArray, "testTopic", 100, 10, true);
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher4() {
-
- MRClientFactory.createBatchingPublisher(hostSet, "testTopic", 100, 10, true);
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher5() {
-
- MRClientFactory.createBatchingPublisher("host", "testTopic", "username", "password", 100, 10, true,
- "protocolFlag");
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher6() {
-
- try {
- MRClientFactory.createBatchingPublisher("/producer");
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateBatchingPublisher7() {
-
- try {
- MRClientFactory.createBatchingPublisher("/producer", true);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateIdentityManager() {
-
- MRClientFactory.createIdentityManager(hostSet, "apikey", "apisecret");
-
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateTopicManager() {
-
- MRClientFactory.createTopicManager(hostSet, "apikey", "apisecret");
-
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer8() {
-
- try {
- MRClientFactory.createConsumer("/consumer");
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer9() {
-
- MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", "protocolFlag",
- "/consumer", 1, 2);
-
- assertTrue(true);
-
- }
-
- @Test
- public void testCreateConsumer10() {
-
- MRClientFactory.createConsumer("host", "topic", "username", "password", "group", "23", 1, 2, "protocolFlag",
- "/consumer");
-
- assertTrue(true);
-
- }
-
- @Test
- public void test$testInject() {
-
- MRClientFactory.$testInject(null);
- assertTrue(true);
-
- }
-
-} \ No newline at end of file
diff --git a/src/test/java/com/att/nsa/mr/client/TestRunner.java b/src/test/java/com/att/nsa/mr/client/TestRunner.java
deleted file mode 100644
index 814354c..0000000
--- a/src/test/java/com/att/nsa/mr/client/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java b/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java
deleted file mode 100644
index 9841adb..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2018 IBM Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.Response;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.att.aft.dme2.internal.jersey.core.spi.factory.ResponseImpl;
-
-public class DMaapClientUtilTest {
-
- Builder builder;
-
- Response response;
-
- WebTarget target;
-
- @Before
- public void setup(){
- Mockito.mock(HttpServletRequest.class);
- builder = Mockito.mock(Invocation.Builder.class);
- response = Mockito.mock(Response.class);
- target = Mockito.mock(WebTarget.class);
-
- }
-
- @Test
- public void testGetTarget() throws IOException{
- WebTarget actual = DmaapClientUtil.getTarget("testpath");
-
- assertEquals("testpath", actual.getUri().getPath());
- }
-
- @Test
- public void testGetTargetWithParams() throws IOException{
- WebTarget actual = DmaapClientUtil.getTarget("testpath", "testuser", "testpassword");
-
- assertEquals("testpath", actual.getUri().getPath());
- }
-
- @Test
- public void testGetResponsewtCambriaAuth() {
- Mockito.when(target.request()).thenReturn(builder);
- Mockito.when(builder.header("X-CambriaAuth", "testuser")).thenReturn(builder);
- Mockito.when(builder.header("X-CambriaDate", "testpassword")).thenReturn(builder);
- Mockito.when(builder.get()).thenReturn(response);
-
- Response actual = DmaapClientUtil.getResponsewtCambriaAuth(target, "testuser", "testpassword");
-
- assertEquals(response, actual);
- }
-
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
deleted file mode 100644
index 055c94f..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRBaseClientTest.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-
-import org.apache.http.HttpException;
-import org.glassfish.jersey.internal.util.Base64;
-import org.glassfish.jersey.internal.util.collection.StringKeyIgnoreCaseMultivaluedMap;
-import org.json.JSONException;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PowerMockIgnore("org.apache.http.conn.ssl.*")
-@PrepareForTest({ DmaapClientUtil.class })
-public class MRBaseClientTest {
-
- // @InjectMocks
- private MRBaseClient mrBaseClient;
- private Collection<String> hosts = new HashSet<>(Arrays.asList("localhost:8080"));
- private String clientSignature = "topic" + "::" + "cg" + "::" + "cid";
-
- @Before
- public void setup() throws MalformedURLException {
- mrBaseClient = new MRBaseClient(hosts, clientSignature);
- PowerMockito.mockStatic(DmaapClientUtil.class);
- }
-
- @Test
- public void testGet() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(
- DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username", "password"))
- .thenReturn(response);
-
- mrBaseClient.get("/path", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGet_403() throws JSONException, HttpException {
- ResponseBuilder responseBuilder = Response.status(403);
- PowerMockito
- .when(DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
- mrBaseClient.get("/path", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGet_basicauth() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password"))).thenReturn(response);
-
- mrBaseClient.get("/path", "username", "password", "HTTPAAF");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testGet_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.get("/path", null, null, "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGet_wrongjson() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("[[");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(
- DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username", "password"))
- .thenReturn(response);
-
- mrBaseClient.get("/path", "username", "password", "HTTPAUTH");
- assertTrue(true);
- }
-
- @Test
- public void testGetResponse() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(
- DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username", "password"))
- .thenReturn(response);
-
- mrBaseClient.getResponse("/path", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetResponse_aaf() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password"))).thenReturn(response);
-
- mrBaseClient.getResponse("/path", "username", "password", "HTTPAAF");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testGetResponse_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.getResponse("/path", null, null, "HTTPAUTH");
-
- }
-
- @Test
- public void testAuthResponse() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(
- DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username", "password"))
- .thenReturn(response);
-
- mrBaseClient.getAuthResponse("/path", "username", "password", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testAuthResponsee_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.getAuthResponse("/path", null, null, null, null, "HTTPAUTH");
-
- }
-
- @Test
- public void testPostAuth() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito
- .when(DmaapClientUtil.postResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password", new String("{\"test\":\"test\"}").getBytes(), "application/json"))
- .thenReturn(response);
-
- mrBaseClient.postAuth("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", "username",
- "password", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testPostAuth_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.postResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password", new String("{\"test\":\"test\"}").getBytes(), "application/json"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.postAuth("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", null, null,
- null, null, "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetNoAuthResponse() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.getResponsewtNoAuth(DmaapClientUtil.getTarget("/path"))).thenReturn(response);
-
- mrBaseClient.getNoAuthResponse("/path", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testPost() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.postResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password"), new String("{\"test\":\"test\"}").getBytes(), "application/json")).thenReturn(response);
-
- mrBaseClient.post("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", "username",
- "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testPost_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password")))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.post("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", null, null,
- "HTTPAUTH");
-
- }
-
- @Test
- public void testPostAuthwithResponse() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito
- .when(DmaapClientUtil.postResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password", new String("{\"test\":\"test\"}").getBytes(), "application/json"))
- .thenReturn(response);
-
- mrBaseClient.postAuthwithResponse("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json",
- "username", "password", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testPostAuthwithResponse_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.postResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password", new String("{\"test\":\"test\"}").getBytes(), "application/json"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.postAuthwithResponse("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json",
- null, null, null, null, "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testPostWithResponse() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.postResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password"), new String("{\"test\":\"test\"}").getBytes(), "application/json")).thenReturn(response);
-
- mrBaseClient.postWithResponse("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json",
- "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testPostWithResponse_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.getResponsewtBasicAuth(DmaapClientUtil.getTarget("/path"),
- Base64.encodeAsString("username:password")))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.postWithResponse("/path", new String("{\"test\":\"test\"}").getBytes(), "application/json", null,
- null, "HTTPAUTH");
-
- }
-
- @Test
- public void testGetAuth() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(
- DmaapClientUtil.getResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username", "password"))
- .thenReturn(response);
- mrBaseClient.getAuth("/path", "username", "password", "username", "password", "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test(expected = HttpException.class)
- public void testGetAuth_error() throws JSONException, HttpException {
-
- ResponseBuilder responseBuilder = Response.ok();
- PowerMockito
- .when(DmaapClientUtil.postResponsewtCambriaAuth(DmaapClientUtil.getTarget("/path"), "username",
- "password", new String("{\"test\":\"test\"}").getBytes(), "application/json"))
- .thenReturn(
- responseBuilder.header("transactionid", "transactionid").entity("{\"test\":\"test\"}").build());
-
- mrBaseClient.getAuth("/path", null, null, null, null, "HTTPAUTH");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetNoAuth() throws JSONException, HttpException {
-
- Response response = Mockito.mock(Response.class);
- MultivaluedMap<String, Object> map = new StringKeyIgnoreCaseMultivaluedMap<>();
- map.add("transactionid", "transactionid");
-
- PowerMockito.when(response.getStatus()).thenReturn(200);
- PowerMockito.when(response.readEntity(String.class)).thenReturn("{\"test\":\"test\"}");
- PowerMockito.when(response.getHeaders()).thenReturn(map);
-
- PowerMockito.when(DmaapClientUtil.getResponsewtNoAuth(DmaapClientUtil.getTarget("/path"))).thenReturn(response);
- mrBaseClient.getNoAuth("/path");
- assertTrue(true);
-
- }
-
-
- @Test
- public void testGetHTTPErrorResponseMessage() {
-
- assertEquals(mrBaseClient.getHTTPErrorResponseMessage("<body>testtest</body>"), "testtest");
-
- }
-
- @Test
- public void getGTTPErrorResponseCode() {
-
- assertEquals(mrBaseClient.getHTTPErrorResponseMessage("<body>testtest</body>"), "testtest");
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRBatchPublisherTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRBatchPublisherTest.java
deleted file mode 100644
index 19b58e9..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRBatchPublisherTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class MRBatchPublisherTest {
-
- private Collection<String> hosts=new HashSet<>(Arrays.asList("/test"));
- private MRBatchPublisher mrBatchPublisher=new MRBatchPublisher(hosts, "topic", 2, 20, true);
-
-
- @Before
- public void setup(){
-
-
- }
-
- @Test
- public void testSend() throws IOException{
- mrBatchPublisher.send("testmessage");
- }
-
- @Test
- public void testClose() throws IOException{
- mrBatchPublisher.close();
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRConstantsTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRConstantsTest.java
deleted file mode 100644
index ed918b5..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRConstantsTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.apache.http.HttpHost;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.impl.MRConstants;
-
-public class MRConstantsTest extends TestCase
-{
- @Test
- public void testPlainHost () throws IOException
- {
- final String rawTopic = "bar";
- final String result = MRConstants.makeUrl ( rawTopic );
- assertEquals ( "/events/" + "bar", result );
- }
-
- @Test
- public void testHostWithProtocol () throws IOException
- {
- final String rawTopic = "bar";
- final String result = MRConstants.makeUrl ( rawTopic );
- assertEquals ( "/events/" + "bar", result );
- }
-
- @Test
- public void testHostWithProtocolAndPort () throws IOException
- {
- final String rawTopic = "bar";
- final String result = MRConstants.makeUrl ( rawTopic );
- assertEquals ( "/events/" + "bar", result );
- }
-
- @Test
- public void testHostWithPort () throws IOException
- {
- final String rawTopic = "bar";
- final String result = MRConstants.makeUrl ( rawTopic );
- assertEquals ( "/events/" + "bar", result );
- }
-
- @Test
- public void testHostWithPortAndEscapedTopic () throws IOException
- {
- final String rawTopic = "bar?bell";
- final String result = MRConstants.makeUrl ( rawTopic );
- assertEquals ( "/events/" + "bar%3Fbell", result );
- }
-
- @Test
- public void testConsumerPlainHost () throws IOException
- {
- final String rawTopic = "bar";
- final String rawGroup = "group";
- final String rawId = "id";
- final String result = MRConstants.makeConsumerUrl ( rawTopic, rawGroup, rawId );
- assertEquals ( "/events/" + "bar/group/id", result );
- }
-
- @Test
- public void testCreateHostList ()
- {
- final ArrayList<String> in = new ArrayList<String> ();
- in.add ( "foo" );
- in.add ( "bar" );
- in.add ( "baz:80" );
-
- final Collection<HttpHost> hosts = MRConstants.createHostsList ( in );
- assertEquals ( 3, hosts.size () );
-
- final Iterator<HttpHost> it = hosts.iterator ();
- final HttpHost first = it.next ();
- assertEquals ( MRConstants.kStdMRServicePort, first.getPort () );
- assertEquals ( "foo", first.getHostName () );
-
- final HttpHost second = it.next ();
- assertEquals ( MRConstants.kStdMRServicePort, second.getPort () );
- assertEquals ( "bar", second.getHostName () );
-
- final HttpHost third = it.next ();
- assertEquals ( 80, third.getPort () );
- assertEquals ( "baz", third.getHostName () );
- }
-
- private static final String[][] hostTests =
- {
- { "host", "host", "" + MRConstants.kStdMRServicePort },
- { ":oops", null, "-1" },
- { "host:1.3", null, "-1" },
- { "host:13", "host", "13" },
- { "host:", "host", "" + MRConstants.kStdMRServicePort },
- };
-
- @Test
- public void testHostParse ()
- {
- for ( String[] test : hostTests )
- {
- final String hostIn = test[0];
- final String hostOut = test[1];
- final int portOut = Integer.parseInt ( test[2] );
-
- try
- {
- final HttpHost hh = MRConstants.hostForString ( hostIn );
- assertEquals ( hostOut, hh.getHostName () );
- assertEquals ( portOut, hh.getPort () );
- }
- catch ( IllegalArgumentException x )
- {
- assertEquals ( -1, portOut );
- }
- }
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRConsumerImplTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRConsumerImplTest.java
deleted file mode 100644
index bfac947..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRConsumerImplTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.junit.Test;
-
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.impl.MRConstants;
-import com.att.nsa.mr.client.impl.MRConsumerImpl;
-
-public class MRConsumerImplTest extends TestCase
-{
- @Test
- public void testNullFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, -1 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );
- }
-
- @Test
- public void testFilterWithNoTimeoutOrLimit () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "filter", null, null );
- final String url = c.createUrlPath ( MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid" ,"http"),-1, -1 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid?filter=filter", url );
- }
-
- @Test
- public void testTimeoutNoLimitNoFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", 30000, -1, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), 30000, -1 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?timeout=30000", url );
- }
-
- @Test
- public void testNoTimeoutWithLimitNoFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, 100, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, 100 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?limit=100", url );
- }
-
- @Test
- public void testWithTimeoutWithLimitWithFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", 1000, 400, "f", null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid" ,"http"), 1000, 400 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid?timeout=1000&limit=400&filter=f", url );
- }
-
- @Test
- public void testFilterEncoding () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }", null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, -1 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?filter=%7B+%22foo%22%3D%22bar%22bar%22+%7D", url );
- }
-
- @Test
- public void testFetchWithReturnConsumerResponse () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- Properties properties = new Properties();
- properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
-
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }", null, null );
- c.fetchWithReturnConsumerResponse();
- c.setProtocolFlag("HTTPAAF");
- c.fetchWithReturnConsumerResponse();
- assertTrue(true);
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRMetaClientTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRMetaClientTest.java
deleted file mode 100644
index 4a3650f..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRMetaClientTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.nsa.mr.client.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.junit.Assert.assertTrue;
-
-import com.att.nsa.apiClient.http.HttpException;
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
-import com.att.nsa.mr.client.MRClient.MRApiException;
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-
-public class MRMetaClientTest {
-
- @Rule public WireMockRule wireMock = new WireMockRule();
-
- @Before
- public void setUp(){
- wireMock.stubFor(get(urlEqualTo("/topics"))
- .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));
- wireMock.stubFor(get(urlEqualTo("/topics/topic1"))
- .willReturn(aResponse().withBody("{\"topics\":[\"topic1\",\"topic2\"]}").withHeader("Content-Type", "application/json")));
- wireMock.stubFor(post(urlEqualTo("/topics/create"))
- .willReturn(aResponse().withStatus(200)));
- }
-
- @Test
- public void getTopicsTest()
- {
- final Collection<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:" + wireMock.port() );
-
- MRMetaClient c;
- try {
- c = new MRMetaClient(hosts);
- Set<String> setString=c.getTopics();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
-
- // assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );
-
- }
-
- @Test
- public void getTopicMetadataTest() {
- final Collection<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:" + wireMock.port() );
-
- final String topic ="topic1";
-
- MRMetaClient c;
- try {
- c = new MRMetaClient(hosts);
- TopicInfo topicInfo=c.getTopicMetadata(topic);
- } catch (IOException | HttpObjectNotFoundException e) {
- e.printStackTrace();
- }
-
- }
-
- @Test
- public void testcreateTopic(){
- final Collection<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:" + wireMock.port() );
-
- MRMetaClient c;
- try {
- c = new MRMetaClient(hosts);
- c.createTopic("topic1", "testTopic", 1, 1);
- } catch (IOException | HttpException e) {
- e.printStackTrace();
- }
- }
- @Test
- public void testupdateApiKey(){
- final Collection<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:" + wireMock.port() );
-
- MRMetaClient c;
- try {
- c = new MRMetaClient(hosts);
- c.updateCurrentApiKey("test@onap.com", "test email");
- }catch (HttpException e) {
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- catch (NullPointerException e) {
- assertTrue(true);
- }
-
- }
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchConsumerTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchConsumerTest.java
deleted file mode 100644
index 506d277..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchConsumerTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-
-package com.att.nsa.mr.client.impl;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
-
-public class MRSimplerBatchConsumerTest {
-
- File outFile;
- @Before
- public void setUp() throws Exception {
- Properties properties = new Properties();
- properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
-
- String routeFilePath="dme2/preferredRoute.txt";
-
- File file = new File(MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());
- properties.put("DME2preferredRouterFilePath", MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());
-
- outFile = new File(file.getParent() + "/consumer_tmp.properties");
- properties.store(new FileOutputStream(outFile), "");
- }
-
- @Test
- public void testSend() throws IOException, InterruptedException {
-
- final MRConsumer cc = MRClientFactory.createConsumer(outFile.getPath());
-
- try {
- for(String msg : cc.fetch()){
- System.out.println(msg);
- }
- } catch (Exception e) {
- System.err.println ( e.getClass().getName () + ": " + e.getMessage () );
- }
-
- }
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisherTest.java b/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisherTest.java
deleted file mode 100644
index 5b8d580..0000000
--- a/src/test/java/com/att/nsa/mr/client/impl/MRSimplerBatchPublisherTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-
-package com.att.nsa.mr.client.impl;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.client.response.MRPublisherResponse;
-
-public class MRSimplerBatchPublisherTest {
-
- File outFile;
- @Before
- public void setUp() throws Exception {
- Properties properties = new Properties();
- properties.load(MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/producer.properties"));
-
- String routeFilePath="dme2/preferredRoute.txt";
-
- File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
- properties.put("DME2preferredRouterFilePath", MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
-
- outFile = new File(file.getParent() + "/producer_tmp.properties");
- properties.store(new FileOutputStream(outFile), "");
- }
-
- @Test
- public void testSend() throws IOException, InterruptedException {
-
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath());
-
- //publish some messages
- final JSONObject msg1 = new JSONObject ();
- pub.send ( "MyPartitionKey", msg1.toString () );
-
- final List<message> stuck = pub.close ( 1, TimeUnit.SECONDS );
- if ( stuck.size () > 0 ) {
- System.out.println( stuck.size() + " messages unsent" );
- }
- else
- {
- System.out.println ( "Clean exit; all messages sent." );
- }
-
-
- }
-
- @Test
- public void testSendBatchWithResponse() throws IOException, InterruptedException {
-
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath(), true);
-
- //publish some messages
- final JSONObject msg1 = new JSONObject ();
- pub.send ( "MyPartitionKey", msg1.toString () );
- MRPublisherResponse pubResponse = new MRPublisherResponse();
- pub.setPubResponse(pubResponse);
-
- MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
- Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/response/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/client/response/JUnitTestSuite.java
deleted file mode 100644
index 90b10a9..0000000
--- a/src/test/java/com/att/nsa/mr/client/response/JUnitTestSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client.response;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ MRConsumerResponseTest.class, MRPublisherResponseTest.class,})
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/response/MRConsumerResponseTest.java b/src/test/java/com/att/nsa/mr/client/response/MRConsumerResponseTest.java
deleted file mode 100644
index 036a216..0000000
--- a/src/test/java/com/att/nsa/mr/client/response/MRConsumerResponseTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client.response;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-
-public class MRConsumerResponseTest {
- private MRConsumerResponse test = null;
-
- @Before
- public void setUp() throws Exception {
- test = new MRConsumerResponse();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetResponseCode() {
-
- test.getResponseCode();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetResponseCode() {
-
- test.setResponseCode("200");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetResponseMessage() {
-
- test.getResponseMessage();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetResponseMessage() {
-
- test.setResponseMessage("responseMessage");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetActualMessages() {
-
- test.getActualMessages();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetActualMessages() {
-
- test.setActualMessages(null);
- assertTrue(true);
-
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/client/response/MRPublisherResponseTest.java b/src/test/java/com/att/nsa/mr/client/response/MRPublisherResponseTest.java
deleted file mode 100644
index 60e64ad..0000000
--- a/src/test/java/com/att/nsa/mr/client/response/MRPublisherResponseTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client.response;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-
-public class MRPublisherResponseTest {
- private MRPublisherResponse response = null;
-
- @Before
- public void setUp() throws Exception {
- response = new MRPublisherResponse();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetResponseCode() {
-
- response.getResponseCode();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetResponseCode() {
-
- response.setResponseCode("200");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetResponseMessage() {
-
- response.getResponseMessage();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetResponseMessage() {
-
- response.setResponseMessage("responseMessage");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetPendingMsgs() {
-
- response.getPendingMsgs();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetPendingMsgs() {
-
- response.setPendingMsgs(5);
- assertTrue(true);
-
- }
-
- @Test
- public void testToString() {
-
- response.toString();
- assertTrue(true);
-
- }
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/client/response/TestRunner.java b/src/test/java/com/att/nsa/mr/client/response/TestRunner.java
deleted file mode 100644
index f2abadc..0000000
--- a/src/test/java/com/att/nsa/mr/client/response/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.client.response;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandlerTest.java b/src/test/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandlerTest.java
deleted file mode 100644
index 5f67f6d..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/DefaultLoggingFailoverFaultHandlerTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class DefaultLoggingFailoverFaultHandlerTest {
- private DefaultLoggingFailoverFaultHandler handler = null;
-
- @Before
- public void setUp() throws Exception {
- handler = new DefaultLoggingFailoverFaultHandler();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testHandleEndpointFailover() {
-
- /* handler.handleEndpointFailover(null);
- assertTrue(true);*/
-
- }
-
- @Test
- public void testHandleRouteOfferFailover() {
-
- /* handler.handleRouteOfferFailover(null);
- assertTrue(true);
-*/
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/HeaderReplyHandlerTest.java b/src/test/java/com/att/nsa/mr/dme/client/HeaderReplyHandlerTest.java
deleted file mode 100644
index bdcff83..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/HeaderReplyHandlerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class HeaderReplyHandlerTest {
- private HeaderReplyHandler handler = null;
-
- @Before
- public void setUp() throws Exception {
- handler = new HeaderReplyHandler();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testHandleFault() {
-
- handler.handleFault(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testHandleEndpointFault() {
-
- handler.handleEndpointFault(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testHandleReply() {
-
- handler.handleReply(null);
- assertTrue(true);
-
- }
-
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/dme/client/JUnitTestSuite.java
deleted file mode 100644
index 3ce48a4..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/JUnitTestSuite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ DefaultLoggingFailoverFaultHandlerTest.class, HeaderReplyHandlerTest.class,PreferredRouteReplyHandlerTest.class,
- PreferredRouteRequestHandlerTest.class,SimpleExamplePublisherTest.class })
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandlerTest.java b/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandlerTest.java
deleted file mode 100644
index 28f138d..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteReplyHandlerTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class PreferredRouteReplyHandlerTest {
- private PreferredRouteReplyHandler handler = null;
-
- @Before
- public void setUp() throws Exception {
- handler = new PreferredRouteReplyHandler();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testHandleReply() {
-
-// handler.handleReply(null);
-// assertTrue(true);
-
- }
-
- @Test
- public void testHandleFault() {
-/*
- handler.handleFault(null);
- assertTrue(true);
-*/
- }
-
- @Test
- public void testHandleEndpointFault() {
-
-/* handler.handleEndpointFault(null);
- assertTrue(true);*/
-
- }
-
- @Test
- public void testRouteWriter() {
-/*
- handler.routeWriter("routeKey", "routeValue");
- assertTrue(true);
-*/
- }
-
-
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandlerTest.java b/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandlerTest.java
deleted file mode 100644
index 86f220c..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/PreferredRouteRequestHandlerTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class PreferredRouteRequestHandlerTest {
- private PreferredRouteRequestHandler handler = null;
-
- @Before
- public void setUp() throws Exception {
- handler = new PreferredRouteRequestHandler();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testHandleRequest() {
-
- /* handler.handleRequest(null);
- assertTrue(true);*/
-
- }
-
- @Test
- public void testReadRoute() {
-
-// try {
-// handler.readRoute("routeKey");
-// } catch (NullPointerException e) {
-// assertTrue(true);
-// }
-//
-// assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/SimpleExamplePublisherTest.java b/src/test/java/com/att/nsa/mr/dme/client/SimpleExamplePublisherTest.java
deleted file mode 100644
index 67051b1..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/SimpleExamplePublisherTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class SimpleExamplePublisherTest {
- private SimpleExamplePublisher pub = null;
-
- @Before
- public void setUp() throws Exception {
- pub = new SimpleExamplePublisher();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testPublishMessage() {
-
- try {
- pub.publishMessage("/producer");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/dme/client/TestRunner.java b/src/test/java/com/att/nsa/mr/dme/client/TestRunner.java
deleted file mode 100644
index 08be6da..0000000
--- a/src/test/java/com/att/nsa/mr/dme/client/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.dme.client;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/logging/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/logging/JUnitTestSuite.java
deleted file mode 100644
index 43fe365..0000000
--- a/src/test/java/com/att/nsa/mr/logging/JUnitTestSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.logging;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ MRAppenderTest.class, })
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/logging/MRAppenderTest.java b/src/test/java/com/att/nsa/mr/logging/MRAppenderTest.java
deleted file mode 100644
index 0a59d97..0000000
--- a/src/test/java/com/att/nsa/mr/logging/MRAppenderTest.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.logging;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-
-public class MRAppenderTest {
- private MRAppender appender = null;
-
- @Before
- public void setUp() throws Exception {
- appender = new MRAppender();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testClose() {
- try {
- appender.close();
- } catch (NullPointerException e) {
- assertTrue(true);
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testRequiresLayout() {
-
- appender.requiresLayout();
- assertTrue(true);
-
- }
-
- @Test
- public void testAppend() {
-
- try {
- appender.append(null);
- } catch (NullPointerException e) {
- assertTrue(true);
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testActivateOptions() {
-
- appender.activateOptions();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetTopic() {
-
- appender.getTopic();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetTopic() {
-
- appender.setTopic("testTopic");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetPartition() {
-
- appender.getPartition();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetPartition() {
-
- appender.setPartition("partition");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetHosts() {
-
- appender.getHosts();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetHosts() {
-
- appender.setHosts("hosts");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetMaxBatchSize() {
-
- appender.getMaxBatchSize();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetMaxBatchSize() {
-
- appender.setMaxBatchSize(20);
- assertTrue(true);
-
- }
-
- @Test
- public void testGetMaxAgeMs() {
-
- appender.getMaxAgeMs();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetMaxAgeMs() {
-
- appender.setMaxAgeMs(15);
- assertTrue(true);
-
- }
-
- @Test
- public void testIsCompress() {
-
- appender.isCompress();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetCompress() {
-
- appender.setCompress(true);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/logging/TestRunner.java b/src/test/java/com/att/nsa/mr/logging/TestRunner.java
deleted file mode 100644
index 415156f..0000000
--- a/src/test/java/com/att/nsa/mr/logging/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.logging;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/ConsolePublisherTest.java b/src/test/java/com/att/nsa/mr/test/clients/ConsolePublisherTest.java
deleted file mode 100644
index 5ccd10c..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/ConsolePublisherTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConsolePublisherTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- ConsolePublisher.main(null);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/test/clients/JUnitTestSuite.java
deleted file mode 100644
index 49e22de..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/JUnitTestSuite.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ SimpleExamplePublisherTest.class, ProtocolTypeConstantsTest.class,
- SampleConsumerTest.class, SamplePublisherTest.class, SimpleExampleConsumerTest.class, ConsolePublisherTest.class,
- SimpleExamplePublisherWithResponseTest.class, SimpleExampleConsumerWithReturnResponseTest.class,})
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/ProtocolTypeConstantsTest.java b/src/test/java/com/att/nsa/mr/test/clients/ProtocolTypeConstantsTest.java
deleted file mode 100644
index ce4b72c..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/ProtocolTypeConstantsTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ProtocolTypeConstantsTest {
- private ProtocolTypeConstants constants = null;
-
- @Before
- public void setUp() throws Exception {
- // constants = new ProtocolTypeConstants();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetValue() {
-
- try {
- constants.getValue();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SampleConsumerTest.java b/src/test/java/com/att/nsa/mr/test/clients/SampleConsumerTest.java
deleted file mode 100644
index f950fc6..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SampleConsumerTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SampleConsumerTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SampleConsumer.main( new String[0]);
- } catch (Exception e) {
- assertTrue(true);
- }
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SamplePublisherTest.java b/src/test/java/com/att/nsa/mr/test/clients/SamplePublisherTest.java
deleted file mode 100644
index 5ad4407..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SamplePublisherTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SamplePublisherTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SamplePublisher.main( new String[0]);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- assertTrue(true);
- }
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerTest.java b/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerTest.java
deleted file mode 100644
index 1887ff9..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleExampleConsumerTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SimpleExampleConsumer.main(null);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerWithReturnResponseTest.java b/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerWithReturnResponseTest.java
deleted file mode 100644
index f6f2deb..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SimpleExampleConsumerWithReturnResponseTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleExampleConsumerWithReturnResponseTest {
-
- @Before
- public void setUp() throws Exception {
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SimpleExampleConsumerWithReturnResponse.main(null);
- } catch (Exception e) {
- // TODO Auto-generated catch block e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherTest.java b/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherTest.java
deleted file mode 100644
index b30d523..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleExamplePublisherTest {
- private SimpleExamplePublisher pub = null;
-
- @Before
- public void setUp() throws Exception {
- pub = new SimpleExamplePublisher();
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testPublishMessage() {
- try {
- pub.publishMessage("/producer");
- } catch (NullPointerException e) {
- assertTrue(true);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SimpleExamplePublisher.main(null);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
-
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherWithResponseTest.java b/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherWithResponseTest.java
deleted file mode 100644
index d408a33..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/SimpleExamplePublisherWithResponseTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleExamplePublisherWithResponseTest {
-
- private SimpleExamplePublisherWithResponse pub = null;
-
- @Before
- public void setUp() throws Exception {
- pub = new SimpleExamplePublisherWithResponse();
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testMain() {
-
- try {
- SimpleExamplePublisherWithResponse.main( new String[0]);
- } catch (Exception e) {
- assertTrue(true);
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testPublishMessage() {
-
- try {
- pub.publishMessage("/producer", 100);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/test/clients/TestRunner.java b/src/test/java/com/att/nsa/mr/test/clients/TestRunner.java
deleted file mode 100644
index 39bbbb3..0000000
--- a/src/test/java/com/att/nsa/mr/test/clients/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.clients;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/support/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/test/support/JUnitTestSuite.java
deleted file mode 100644
index 8d18e1c..0000000
--- a/src/test/java/com/att/nsa/mr/test/support/JUnitTestSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.support;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ MRBatchingPublisherMockTest.class, MRConsumerMockTest.class,})
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/test/support/MRBatchingPublisherMockTest.java b/src/test/java/com/att/nsa/mr/test/support/MRBatchingPublisherMockTest.java
deleted file mode 100644
index 3666c25..0000000
--- a/src/test/java/com/att/nsa/mr/test/support/MRBatchingPublisherMockTest.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.support;
-
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Listener;
-
-public class MRBatchingPublisherMockTest {
- private MRBatchingPublisherMock pub = null;
-
- private MRBatchingPublisherMock.Entry entry = null;
-
- @Before
- public void setUp() throws Exception {
- pub = new MRBatchingPublisherMock();
- entry = pub.new Entry("partition", "msg");
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testToString() {
-
- entry.toString();
- assertTrue(true);
-
- }
-
- @Test
- public void testAddListener() {
-
- pub.addListener(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testGetCaptures() {
-
- pub.getCaptures();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetCaptures2() {
-
- pub.getCaptures(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testReceived() {
-
- pub.received();
- assertTrue(true);
-
- }
-
- @Test
- public void testResend() {
-
- pub.reset();
- assertTrue(true);
-
- }
-
- @Test
- public void testSend() {
-
- pub.send("partition", "msg");
- assertTrue(true);
-
- }
-
- @Test
- public void testSend2() {
-
- pub.send("msg");
- assertTrue(true);
-
- }
-
- @Test
- public void testSend3() {
- //sending message m obj
- pub.send(new ArrayList<message>());
- assertTrue(true);
-
- }
-
- @Test
- public void testSend4() {
- //sending collection of message m objects
- pub.send(new message("partition", "msg"));
- assertTrue(true);
-
- }
-
- @Test
- public void testSendBatchWithResponse() {
-
- pub.sendBatchWithResponse();
- assertTrue(true);
-
- }
-
- @Test
- public void testLogTo() {
-
- pub.logTo(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testClearApiCredentials() {
-
- pub.clearApiCredentials();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetApiCredentials() {
-
- pub.setApiCredentials("apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testClose() {
-
- pub.close();
- assertTrue(true);
-
- }
-
- @Test
- public void testClose2() {
-
- pub.close(100, null);
- assertTrue(true);
-
- }
-
- @Test
- public void testGetPendingMessageCount() {
-
- pub.getPendingMessageCount();
- assertTrue(true);
-
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/test/support/MRConsumerMockTest.java b/src/test/java/com/att/nsa/mr/test/support/MRConsumerMockTest.java
deleted file mode 100644
index 2a4f50a..0000000
--- a/src/test/java/com/att/nsa/mr/test/support/MRConsumerMockTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.support;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Entry;
-
-public class MRConsumerMockTest {
- private MRConsumerMock cons = null;
- private MRConsumerMock.Entry entry = null;
-
- @Before
- public void setUp() throws Exception {
- cons = new MRConsumerMock();
- entry = cons.new Entry(100, 200, "statusMsg");
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testClose() {
-
- cons.close();
- assertTrue(true);
-
- }
-
- @Test
- public void testRun() {
- try {
- entry.run();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue(true);
-
- }
-
- @Test
- public void testSetApiCredentials() {
- cons.setApiCredentials("apikey", "apisecret");
- assertTrue(true);
-
- }
-
- @Test
- public void testClearApiCredentials() {
- cons.clearApiCredentials();
- assertTrue(true);
-
- }
-
- @Test
- public void testAdd() {
- cons.add(entry);
- assertTrue(true);
-
- }
-
- @Test
- public void testAddImmediateMsg() {
- cons.addImmediateMsg("ImmediateMsg");
- assertTrue(true);
-
- }
-
- @Test
- public void testAddDelayedMsg() {
- cons.addDelayedMsg(100, "msg");
- assertTrue(true);
-
- }
-
- @Test
- public void testAddImmediateMsgGroup() {
- cons.addImmediateMsgGroup(new ArrayList<String>());
- assertTrue(true);
-
- }
-
- @Test
- public void testAddDelayedMsgGroup() {
- cons.addDelayedMsgGroup(100,new ArrayList<String>());
- assertTrue(true);
-
- }
-
- @Test
- public void testAddImmediateError() {
- cons.addImmediateError(200, "OK");
- assertTrue(true);
-
- }
-
- @Test
- public void testFetch() {
- try {
- cons.fetch();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testFetch2() {
- try {
- cons.fetch(100, 200);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testLogTo() {
- cons.logTo(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testFetchWithReturnConsumerResponse() {
- cons.fetchWithReturnConsumerResponse();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetchWithReturnConsumerResponse() {
- cons.fetchWithReturnConsumerResponse(100,200);
- assertTrue(true);
-
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/test/support/TestRunner.java b/src/test/java/com/att/nsa/mr/test/support/TestRunner.java
deleted file mode 100644
index 4e8651c..0000000
--- a/src/test/java/com/att/nsa/mr/test/support/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.test.support;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/ApiKeyCommandTest.java b/src/test/java/com/att/nsa/mr/tools/ApiKeyCommandTest.java
deleted file mode 100644
index e5bd722..0000000
--- a/src/test/java/com/att/nsa/mr/tools/ApiKeyCommandTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.apiClient.credentials.ApiCredential;
-import com.att.nsa.apiClient.http.HttpException;
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
-import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRClient.MRApiException;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRIdentityManager;
-import com.att.nsa.mr.client.MRIdentityManager.ApiKey;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ MRClientFactory.class })
-public class ApiKeyCommandTest {
-
- @InjectMocks
- private ApiKeyCommand command;
- @Mock
- private MRIdentityManager tm;
- @Mock
- private ApiKey ti;
- @Mock
- private ApiKey key;
- @Mock
- private ApiCredential ac;
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- PowerMockito.mockStatic(MRClientFactory.class);
- PowerMockito.when(MRClientFactory.createIdentityManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);
- PowerMockito.when(tm.getApiKey("testtopic")).thenReturn(key);
- PowerMockito.when(tm.createApiKey("testtopic", "1")).thenReturn(ac);
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(new MRCommandContext());
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() {
-
- String[] parts1 = { "create", "testtopic", "1" };
- String[] parts2 = { "list", "testtopic", "1" };
- String[] parts3 = { "revoke", "write", "read" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
- }
-
- @Test
- public void testExecute_error1() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new IOException("error"));
- String[] parts1 = { "create", "testtopic", "1" };
- String[] parts2 = { "list", "testtopic", "1" };
- String[] parts3 = { "revoke", "write", "read" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
- }
-
- }
-
- @Test
- public void testExecute_error2() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new MRApiException("error"));
- String[] parts1 = { "create", "testtopic", "1" };
- String[] parts2 = { "list", "testtopic", "1" };
- String[] parts3 = { "revoke", "write", "read" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(),printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
- }
-
- @Test
- public void testExecute_error3() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpException(500, "error"));
- String[] parts1 = { "create", "testtopic", "1" };
- String[] parts2 = { "list", "testtopic", "1" };
- String[] parts3 = { "revoke", "write", "read" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
- }
-
- }
-
- @Test
- public void testExecute_error4() throws HttpObjectNotFoundException, HttpException, MRApiException, IOException {
- PowerMockito.when(tm.getApiKey("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));
- String[] parts1 = { "create", "testtopic", "1" };
- String[] parts2 = { "list", "testtopic", "1" };
- String[] parts3 = { "revoke", "write", "read" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
- }
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/AuthCommandTest.java b/src/test/java/com/att/nsa/mr/tools/AuthCommandTest.java
deleted file mode 100644
index fdb7671..0000000
--- a/src/test/java/com/att/nsa/mr/tools/AuthCommandTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.cmdtool.CommandNotReadyException;
-
-@RunWith(PowerMockRunner.class)
-public class AuthCommandTest {
- @InjectMocks
- private AuthCommand command = null;
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(new MRCommandContext());
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() {
-
- try {
- String[] parts = new String[5];
- command.execute(parts, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute1() {
-
- try {
- String[] parts = { "userName", "password" };
- command.execute(parts, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/ClusterCommandTest.java b/src/test/java/com/att/nsa/mr/tools/ClusterCommandTest.java
deleted file mode 100644
index cf9c1a7..0000000
--- a/src/test/java/com/att/nsa/mr/tools/ClusterCommandTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.io.PrintStream;
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.cmdtool.CommandNotReadyException;
-
-@RunWith(PowerMockRunner.class)
-public class ClusterCommandTest {
- @InjectMocks
- private ClusterCommand command;
- @Mock
- private MRCommandContext context;
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- PowerMockito.when(context.getCluster()).thenReturn(Arrays.asList("localhost"));
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(context);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() throws FileNotFoundException, CommandNotReadyException {
- String[] parts = { "create", "testtopic", "1", "1" };
- command.execute(parts, context, printStream);
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute1() throws FileNotFoundException, CommandNotReadyException {
- String[] parts = {};
- command.execute(parts, context, printStream);
- assertTrue(true);
-
- }
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/JUnitTestSuite.java b/src/test/java/com/att/nsa/mr/tools/JUnitTestSuite.java
deleted file mode 100644
index 6e882d4..0000000
--- a/src/test/java/com/att/nsa/mr/tools/JUnitTestSuite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import junit.framework.TestSuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-import org.apache.log4j.Logger;
-
-@RunWith(Suite.class)
-@SuiteClasses({ ApiKeyCommandTest.class, AuthCommandTest.class, ClusterCommandTest.class,
- MessageCommandTest.class, MRCommandContextTest.class, TopicCommandTest.class, TraceCommandTest.class,})
-
-public class JUnitTestSuite {
- private static final Logger LOGGER = Logger.getLogger(JUnitTestSuite.class);
-
- public static void main(String[] args) {
- LOGGER.info("Running the test suite");
-
- TestSuite tstSuite = new TestSuite();
- LOGGER.info("Total Test Counts " + tstSuite.countTestCases());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/MRCommandContextTest.java b/src/test/java/com/att/nsa/mr/tools/MRCommandContextTest.java
deleted file mode 100644
index 23ef0a1..0000000
--- a/src/test/java/com/att/nsa/mr/tools/MRCommandContextTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.att.nsa.apiClient.http.HttpTracer;
-import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.HostSelector;
-import com.att.nsa.mr.client.MRClient;
-import com.att.nsa.mr.client.MRPublisher.message;
-import com.att.nsa.mr.test.support.MRBatchingPublisherMock.Entry;
-
-public class MRCommandContextTest {
- private MRCommandContext command = null;
- private String[] parts = new String[5];
-
- @Before
- public void setUp() throws Exception {
- command = new MRCommandContext();
-
- for (int i = 0; i < parts.length; i++) {
- parts[i] = "String" + (i + 1);
- }
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testRequestShutdown() {
-
- command.requestShutdown();
- assertTrue(true);
-
- }
-
- @Test
- public void testShouldContinue() {
-
- command.shouldContinue();
- assertTrue(true);
-
- }
-
- @Test
- public void testSetAuth() {
-
- command.setAuth("key", "pwd");
- assertTrue(true);
-
- }
-
- @Test
- public void testClearAuth() {
-
- command.clearAuth();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckClusterReady() {
-
- command.checkClusterReady();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetCluster() {
-
- command.getCluster();
- assertTrue(true);
-
- }
-
- @Test
- public void testClearCluster() {
-
- command.clearCluster();
- assertTrue(true);
-
- }
-
- @Test
- public void testAddClusterHost() {
-
- command.addClusterHost("host");
- assertTrue(true);
-
- }
-
- @Test
- public void testGetApiKey() {
-
- command.getApiKey();
- assertTrue(true);
-
- }
-
- @Test
- public void testGetApiPwd() {
-
- command.getApiPwd();
- assertTrue(true);
-
- }
-
- @Test
- public void testUseTracer() {
-
- command.useTracer(null);
- assertTrue(true);
-
- }
-
- @Test
- public void testNoTracer() {
-
- command.noTracer();
- assertTrue(true);
-
- }
-
- @Test
- public void testApplyTracer() {
-
- command.applyTracer(null);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/MessageCommandTest.java b/src/test/java/com/att/nsa/mr/tools/MessageCommandTest.java
deleted file mode 100644
index 638d067..0000000
--- a/src/test/java/com/att/nsa/mr/tools/MessageCommandTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRConsumer;
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ MRClientFactory.class, ToolsUtil.class })
-public class MessageCommandTest {
- @InjectMocks
- private MessageCommand command;
- @Mock
- private MRConsumer tm;
- @Mock
- private TopicInfo ti;
- @Mock
- private MRBatchingPublisher pub;
- @Mock
- private MRConsumer cc;
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- PowerMockito.mockStatic(MRClientFactory.class);
- PowerMockito.mockStatic(ToolsUtil.class);
- PowerMockito.when(MRClientFactory.createConsumer(Arrays.asList("localhost"), "testtopic", "2", "3", -1, -1,
- null, null, null)).thenReturn(cc);
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(new MRCommandContext());
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() {
-
- String[] parts1 = { "read", "testtopic", "2", "3" };
- String[] parts2 = { "write", "testtopic", "2", "3" };
- List<String[]> parts = Arrays.asList(parts1, parts2);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- MRCommandContext context = new MRCommandContext();
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
- try {
- command.execute(part, context, printStream);
- } catch (CommandNotReadyException e) {
- assertTrue(true);
- }
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute_error1() {
- try {
- PowerMockito.doThrow(new Exception()).when(cc).fetch();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- String[] parts1 = { "read", "testtopic", "2", "3" };
- String[] parts2 = { "write", "testtopic", "2", "3" };
- List<String[]> parts = Arrays.asList(parts1, parts2);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- MRCommandContext context = new MRCommandContext();
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
- try {
- command.execute(part, context, printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute_error2() {
- try {
- PowerMockito.doThrow(new IOException()).when(pub).close(500, TimeUnit.MILLISECONDS);
- PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- String[] parts1 = { "read", "testtopic", "2", "3" };
- String[] parts2 = { "write", "testtopic", "2", "3" };
- List<String[]> parts = Arrays.asList(parts1, parts2);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- MRCommandContext context = new MRCommandContext();
- PowerMockito.when(ToolsUtil.createBatchPublisher(context, "testtopic")).thenReturn(pub);
- try {
- command.execute(part, context, printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- assertTrue(true);
-
- }
-
- /*
- * @Test public void testExecute_error3() {
- *
- * try { PowerMockito.doThrow(new IOException()).when(pub).send("2", "3");
- * PowerMockito.doThrow(new InterruptedException()).when(pub).close(500,
- * TimeUnit.MILLISECONDS); } catch (IOException e) { // TODO Auto-generated
- * catch block e.printStackTrace(); } catch (InterruptedException e) { //
- * TODO Auto-generated catch block e.printStackTrace(); } String[] parts1 =
- * { "read", "testtopic", "2", "3" }; String[] parts2 = { "write",
- * "testtopic", "2", "3" }; List<String[]> parts = Arrays.asList(parts1,
- * parts2); for (Iterator iterator = parts.iterator(); iterator.hasNext();)
- * { String[] part = (String[]) iterator.next(); PrintStream printStream =
- * new PrintStream(System.out);
- *
- * MRCommandContext context = new MRCommandContext();
- * PowerMockito.when(ToolsUtil.createBatchPublisher(context,
- * "testtopic")).thenReturn(pub); try { command.execute(part, context,
- * printStream); } catch (CommandNotReadyException e) { // TODO
- * Auto-generated catch block e.printStackTrace(); } } assertTrue(true);
- *
- * }
- */
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/TestRunner.java b/src/test/java/com/att/nsa/mr/tools/TestRunner.java
deleted file mode 100644
index 728752b..0000000
--- a/src/test/java/com/att/nsa/mr/tools/TestRunner.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.apache.log4j.Logger;
-
-public class TestRunner {
- private static final Logger LOGGER = Logger.getLogger(TestRunner.class);
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Result result = JUnitCore.runClasses(JUnitTestSuite.class);
- for (Failure failure : result.getFailures()) {
- LOGGER.info(failure.toString());
-
- }
- LOGGER.info(result.wasSuccessful());
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/ToolsUtilTest.java b/src/test/java/com/att/nsa/mr/tools/ToolsUtilTest.java
deleted file mode 100644
index 69bdd44..0000000
--- a/src/test/java/com/att/nsa/mr/tools/ToolsUtilTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2018 Nokia
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- * @author marcin.migdal@nokia.com
- */
-package com.att.nsa.mr.tools;
-
-import com.att.nsa.mr.client.MRBatchingPublisher;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ToolsUtilTest {
-
- private final static List<String> clusters = Arrays.asList("Cluster1", "Cluster2");
- private final static String apiKey = "apiKey";
- private final static String apiPassword = "apiPassword";
- private final static String topicName = "topicName";
-
- @Test
- public void createBatchPublisher() {
- MRCommandContext mrCommandContext = Mockito.mock(MRCommandContext.class);
- Mockito.when(mrCommandContext.getCluster()).thenReturn(clusters);
- Mockito.when(mrCommandContext.getApiKey()).thenReturn(apiKey);
- Mockito.when(mrCommandContext.getApiPwd()).thenReturn(apiPassword);
-
- MRBatchingPublisher mrBatchingPublisher = ToolsUtil.createBatchPublisher(mrCommandContext, topicName);
-
- Assert.assertNotNull(mrBatchingPublisher);
- }
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/TopicCommandTest.java b/src/test/java/com/att/nsa/mr/tools/TopicCommandTest.java
deleted file mode 100644
index 6459e6a..0000000
--- a/src/test/java/com/att/nsa/mr/tools/TopicCommandTest.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.apiClient.http.HttpException;
-import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
-import com.att.nsa.cmdtool.CommandNotReadyException;
-import com.att.nsa.mr.client.MRClientFactory;
-import com.att.nsa.mr.client.MRTopicManager.TopicInfo;
-import com.att.nsa.mr.client.MRTopicManager;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ MRClientFactory.class })
-public class TopicCommandTest {
- @InjectMocks
- private TopicCommand command;
- @Mock
- private MRTopicManager tm;
- @Mock
- private TopicInfo ti;
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
-
- MockitoAnnotations.initMocks(this);
- PowerMockito.mockStatic(MRClientFactory.class);
- PowerMockito.when(MRClientFactory.createTopicManager(Arrays.asList("localhost"), null, null)).thenReturn(tm);
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenReturn(ti);
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(new MRCommandContext());
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() {
-
- String[] parts1 = { "create", "testtopic", "1", "1" };
- String[] parts2 = { "grant", "write", "read", "1" };
- String[] parts3 = { "revoke", "write", "read", "1" };
- String[] parts4 = { "list", "testtopic", "1", "1" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- }
-
- @Test
- public void testExecute_error() {
-
- String[] parts1 = { "create", "testtopic", "1", "1" };
- String[] parts2 = { "grant", "write", "read", "1" };
- String[] parts3 = { "revoke", "write", "read", "1" };
- String[] parts4 = { "list", "testtopic", "1", "1" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- }
-
- @Test
- public void testExecute_error_1() throws com.att.nsa.apiClient.http.HttpException, IOException {
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new IOException("error"));
- PowerMockito.doThrow(new IOException()).when(tm).createTopic("testtopic", "", 1, 1);
- PowerMockito.doThrow(new IOException()).when(tm).revokeProducer("read", "1");
- String[] parts1 = { "create", "testtopic", "1", "1" };
- String[] parts2 = { "grant", "read", "read", "1" };
- String[] parts3 = { "revoke", "write", "read", "1" };
- String[] parts4 = { "list", "testtopic", "1", "1" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- }
-
- @Test
- public void testExecute_error_2() throws com.att.nsa.apiClient.http.HttpException, IOException {
- PowerMockito.when(tm.getTopicMetadata("testtopic")).thenThrow(new HttpObjectNotFoundException("error"));
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).revokeConsumer("read", "1");
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowConsumer("read", "1");
- String[] parts1 = { "create", "testtopic", "1", "1" };
- String[] parts2 = { "grant", "write", "write", "1" };
- String[] parts3 = { "revoke", "read", "read", "1" };
- String[] parts4 = { "list", "testtopic", "1", "1" };
- List<String[]> parts = Arrays.asList(parts1, parts2, parts3, parts4);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- }
-
- @Test
- public void testExecute_error_3() throws com.att.nsa.apiClient.http.HttpException, IOException {
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).createTopic("testtopic", "", 1, 1);
- PowerMockito.doThrow(new HttpException(500, "error")).when(tm).allowProducer("read", "1");
- String[] parts1 = { "create", "testtopic", "1a", "1a" };
- String[] parts2 = { "grant", "write", "read", "1" };
- List<String[]> parts = Arrays.asList(parts1, parts2);
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- String[] part = (String[]) iterator.next();
-
- try {
- command.execute(part, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- }
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/TraceCommandTest.java b/src/test/java/com/att/nsa/mr/tools/TraceCommandTest.java
deleted file mode 100644
index 6ac106a..0000000
--- a/src/test/java/com/att/nsa/mr/tools/TraceCommandTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.att.nsa.cmdtool.CommandNotReadyException;
-
-@RunWith(PowerMockRunner.class)
-public class TraceCommandTest {
- @InjectMocks
- private TraceCommand command;
- private String[] parts = new String[5];
- @Mock
- private PrintStream printStream;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- for (int i = 0; i < parts.length; i++) {
- parts[i] = "String" + (i + 1);
- }
-
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void testGetMatches() {
-
- command.getMatches();
- assertTrue(true);
-
- }
-
- @Test
- public void testCheckReady() {
-
- try {
- command.checkReady(new MRCommandContext());
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testExecute() {
-
- try {
- command.execute(parts, new MRCommandContext(), printStream);
- } catch (CommandNotReadyException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- assertTrue(true);
-
- }
-
- @Test
- public void testDisplayHelp() {
-
- command.displayHelp(printStream);
- assertTrue(true);
-
- }
-
-}
diff --git a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java b/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java
deleted file mode 100644
index ec382f4..0000000
--- a/src/test/java/com/att/nsa/mr/tools/ValidatorUtilTest.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2018 IBM Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-
-package com.att.nsa.mr.tools;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.junit.Test;
-
-import com.att.nsa.mr.test.clients.ProtocolTypeConstants;
-
-public class ValidatorUtilTest {
-
- @Test
- public void testValidateForDME2WithNullServiceName() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.DME2.getValue());
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "Servicename is needed");
- }
-
- }
-
- @Test
- public void testValidateForDME2WithNullTopic() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.DME2.getValue());
- props.setProperty("ServiceName", "ServiceName");
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "topic is needed");
- }
-
- }
-
- @Test
- public void testValidateForDME2WithNullUserName() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.DME2.getValue());
- props.setProperty("ServiceName", "ServiceName");
- props.setProperty("topic", "topic");
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "username is needed");
- }
-
- }
-
- @Test
- public void testValidateForDME2WithNullPassword() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.DME2.getValue());
- props.setProperty("ServiceName", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "password is needed");
- }
-
- }
-
-
-
-
- @Test
- public void testValidateForNonDME2WithNullServiceName() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "Servicename is needed");
- }
-
- }
-
- @Test
- public void testValidateForNonDME2WithNullTopic() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "topic is needed");
- }
-
- }
-
- @Test
- public void testValidateForNonDME2WithNullContenttype() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "contenttype is needed");
- }
-
- }
-
-
- @Test
- public void testValidateForNonDME2WithNullUserName() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("contenttype", "contenttype");
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "username is needed");
- }
-
- }
-
- @Test
- public void testValidateForNonDME2WithNullPassword() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "password is needed");
- }
-
- }
-
- @Test
- public void testValidateForNonDME2WithAuthKey() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "authKey is needed");
- }
-
- }
-
- @Test
- public void testValidateForNonDME2WithOutAuthDate() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
-
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "authDate is needed");
- }
- }
-
- @Test
- public void testValidateForNonDME2WithAuthDate() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
- props.setProperty("authDate", "authDate");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "maxBatchSize is needed");
- }
- }
-
-
- @Test
- public void testValidateForNonDME2WithMaxAgeMs() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
- props.setProperty("authDate", "authDate");
- props.setProperty("maxBatchSize", "maxBatchSize");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "maxAgeMs is needed");
- }
-
-
-
- }
-
- @Test
- public void testValidateForNonDME2WithMessageSentThreadOccurance() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
- props.setProperty("authDate", "authDate");
- props.setProperty("maxBatchSize", "maxBatchSize");
- props.setProperty("maxAgeMs", "maxAgeMs");
-
- try{
- ValidatorUtil.validatePublisher(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "MessageSentThreadOccurance is needed");
- }
-
- }
-
-
- @Test
- public void testValidateSubscriberWithoutGroup() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
- props.setProperty("authDate", "authDate");
- props.setProperty("maxBatchSize", "maxBatchSize");
- props.setProperty("maxAgeMs", "maxAgeMs");
-
- try{
- ValidatorUtil.validateSubscriber(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "group is needed");
- }
- }
-
- @Test
- public void testValidateSubscriberWithoutCustomer() {
- Properties props = new Properties();
- props.setProperty("TransportType", ProtocolTypeConstants.AUTH_KEY.getValue());
- props.setProperty("host", "ServiceName");
- props.setProperty("topic", "topic");
- props.setProperty("username", "username");
- props.setProperty("contenttype", "contenttype");
- props.setProperty("password", "password");
- props.setProperty("authKey", "authKey");
- props.setProperty("authDate", "authDate");
- props.setProperty("maxBatchSize", "maxBatchSize");
- props.setProperty("maxAgeMs", "maxAgeMs");
- props.setProperty("group", "group");
-
- try{
- ValidatorUtil.validateSubscriber(props);
- } catch(IllegalArgumentException e) {
- assertEquals(e.getMessage(), "Consumer (Id) is needed");
- }
- }
-
-
-
-
-
-}