summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/att/nsa/cambria/exception
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/att/nsa/cambria/exception')
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/DMaaPCambriaExceptionMapperTest.java60
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/DMaaPErrorMessagesTest.java372
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/DMaaPWebExceptionMapperTest.java60
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/ErrorResponseTest.java146
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/JUnitTestSuite.java43
-rw-r--r--src/test/java/com/att/nsa/cambria/exception/TestRunner.java41
6 files changed, 722 insertions, 0 deletions
diff --git a/src/test/java/com/att/nsa/cambria/exception/DMaaPCambriaExceptionMapperTest.java b/src/test/java/com/att/nsa/cambria/exception/DMaaPCambriaExceptionMapperTest.java
new file mode 100644
index 0000000..12cc0e8
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/DMaaPCambriaExceptionMapperTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.cambria.exception;
+
+import static org.junit.Assert.*;
+import com.att.nsa.cambria.exception.DMaaPCambriaExceptionMapper;
+import com.att.nsa.cambria.transaction.TransactionObj;
+import com.att.nsa.cambria.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPCambriaExceptionMapperTest {
+
+ @Before
+ public void setUp() throws Exception {
+ DMaaPCambriaExceptionMapper exception = new DMaaPCambriaExceptionMapper();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testToResponse() {
+
+ DMaaPCambriaExceptionMapper mapper = new DMaaPCambriaExceptionMapper();
+
+ try {
+ mapper.toResponse(null);
+ } catch (NullPointerException e) {
+ assertTrue(true);
+ }
+
+
+
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/com/att/nsa/cambria/exception/DMaaPErrorMessagesTest.java b/src/test/java/com/att/nsa/cambria/exception/DMaaPErrorMessagesTest.java
new file mode 100644
index 0000000..6f171a9
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/DMaaPErrorMessagesTest.java
@@ -0,0 +1,372 @@
+/*-
+ * ============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.cambria.exception;
+
+import static org.junit.Assert.*;
+import com.att.nsa.cambria.exception.DMaaPErrorMessages;
+import com.att.nsa.cambria.transaction.TransactionObj;
+import com.att.nsa.cambria.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPErrorMessagesTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testGetMsgSizeExceeds() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getMsgSizeExceeds();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMsgSizeExceeds() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setMsgSizeExceeds("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotFound() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotFound();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotFound() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotFound("not found");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetServerUnav() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getServerUnav();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetServerUnav() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setServerUnav("server1");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetMethodNotAllowed() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getMethodNotAllowed();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetMethodNotAllowed() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setMethodNotAllowed("server2");
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testGetBadRequest() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getBadRequest();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetBadRequest() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setBadRequest("badRequest");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNwTimeout() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNwTimeout();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNwTimeout() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNwTimeout("12:00:00");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotPermitted1() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotPermitted1();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotPermitted1() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotPermitted1("not permitted");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetNotPermitted2() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getNotPermitted2();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetNotPermitted2() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setNotPermitted2("not permitted2");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicsfailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicsfailure();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicsfailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicsfailure("failure");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicDetailsFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicDetailsFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicDetailsFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicDetailsFail("topic details fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetCreateTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getCreateTopicFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetCreateTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setCreateTopicFail("topic details fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetIncorrectJson() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getIncorrectJson();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetIncorrectJson() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setIncorrectJson("incorrect Json");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetDeleteTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getDeleteTopicFail();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetDeleteTopicFail() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setDeleteTopicFail("delete tpic fail");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetConsumeMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getConsumeMsgError();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetConsumeMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setConsumeMsgError("consume message error");
+ assertTrue(true);
+
+ }
+
+
+ @Test
+ public void testGetPublishMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getPublishMsgError();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPublishMsgError() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setPublishMsgError("publish message error");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetPublishMsgCount() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getPublishMsgCount();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetPublishMsgCount() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setPublishMsgCount("200");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetAuthFailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getAuthFailure();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetAuthFailure() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setAuthFailure("auth failure");
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testGetTopicNotExist() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.getTopicNotExist();
+ assertTrue(true);
+
+ }
+
+ @Test
+ public void testSetTopicNotExist() {
+
+ DMaaPErrorMessages msg = new DMaaPErrorMessages();
+ msg.setTopicNotExist("toopic doesn't exist");
+ assertTrue(true);
+
+ }
+
+
+} \ No newline at end of file
diff --git a/src/test/java/com/att/nsa/cambria/exception/DMaaPWebExceptionMapperTest.java b/src/test/java/com/att/nsa/cambria/exception/DMaaPWebExceptionMapperTest.java
new file mode 100644
index 0000000..4a6fb90
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/DMaaPWebExceptionMapperTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.cambria.exception;
+
+import static org.junit.Assert.*;
+import com.att.nsa.cambria.exception.DMaaPWebExceptionMapper;
+import com.att.nsa.cambria.transaction.TransactionObj;
+import com.att.nsa.cambria.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DMaaPWebExceptionMapperTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testToResponse() {
+
+ DMaaPWebExceptionMapper msg = new DMaaPWebExceptionMapper();
+
+ try {
+ msg.toResponse(null);
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+
+
+
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/com/att/nsa/cambria/exception/ErrorResponseTest.java b/src/test/java/com/att/nsa/cambria/exception/ErrorResponseTest.java
new file mode 100644
index 0000000..88656a7
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/ErrorResponseTest.java
@@ -0,0 +1,146 @@
+/*-
+ * ============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.cambria.exception;
+
+import static org.junit.Assert.*;
+import com.att.nsa.cambria.exception.ErrorResponse;
+import com.att.nsa.cambria.transaction.TransactionObj;
+import com.att.nsa.cambria.transaction.impl.DMaaPSimpleTransactionFactory;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ErrorResponseTest {
+
+ @Before
+ public void setUp() throws Exception {
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+
+ @Test
+ public void testGetHttpStatusCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getHttpStatusCode();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void tesSGetHttpStatusCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setHttpStatusCode(200);
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetMrErrorCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getMrErrorCode();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testSetMrErrorCode() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setMrErrorCode(500);
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrorMessage() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getErrorMessage();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testSetErrorMessage() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setErrorMessage("no error");
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testToString() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.toString();
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrMapperStr1() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.setHelpURL("/help");
+ assertTrue(true);
+
+
+ }
+
+ @Test
+ public void testGetErrMapperStr() {
+
+ ErrorResponse resp = new ErrorResponse(200, 500, "no error");
+
+ resp.getHelpURL();
+ assertTrue(true);
+
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/src/test/java/com/att/nsa/cambria/exception/JUnitTestSuite.java b/src/test/java/com/att/nsa/cambria/exception/JUnitTestSuite.java
new file mode 100644
index 0000000..5b3ab7e
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/JUnitTestSuite.java
@@ -0,0 +1,43 @@
+/*-
+ * ============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.cambria.exception;
+
+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({ DMaaPCambriaExceptionMapperTest.class,
+ DMaaPErrorMessagesTest.class, DMaaPWebExceptionMapperTest.class, ErrorResponseTest.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/cambria/exception/TestRunner.java b/src/test/java/com/att/nsa/cambria/exception/TestRunner.java
new file mode 100644
index 0000000..75cf48d
--- /dev/null
+++ b/src/test/java/com/att/nsa/cambria/exception/TestRunner.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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.cambria.exception;
+
+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());
+ }
+
+}