aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/com/att/nsa/mr/tools
diff options
context:
space:
mode:
authorsunil unnava <sunil.unnava@att.com>2018-10-23 10:31:46 -0400
committersunil unnava <sunil.unnava@att.com>2018-10-23 10:33:54 -0400
commit0cb18b0baa2cf750e557262d821bbf2a03326bbe (patch)
tree8ca6880c9cc4f3bfc9d76575ef03ca647863415a /src/test/java/com/att/nsa/mr/tools
parent9775bb11c919b0a8d89d81abf1b1a76bb7592f78 (diff)
update the package name
Issue-ID: DMAAP-858 Change-Id: Ia69621ea6ad2ec2ec525800af2a7d3f73aef82ed Signed-off-by: sunil unnava <sunil.unnava@att.com>
Diffstat (limited to 'src/test/java/com/att/nsa/mr/tools')
-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
11 files changed, 0 insertions, 1592 deletions
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");
- }
- }
-
-
-
-
-
-}