aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-request-handler
diff options
context:
space:
mode:
authorLori Keighron <lk2924@att.com>2018-03-21 14:37:21 -0400
committerTakamune Cho <tc012c@att.com>2018-03-21 19:16:21 +0000
commit9b9d9cd2fc1bca099680dbccc64479669c0c14cb (patch)
tree364c1ba2938c6f5e8dbe82a97689d289986526dd /appc-dispatcher/appc-request-handler
parentf0d0ba473948c1af2c197d6a777872b653273200 (diff)
Add junit coverage to request handler exceptions
Introduce 7 more junit-test files: DGWorkflowNotFoundExceptionTest.java LCMOperationsDisabledExceptionTest.java MultipleRecordsRetrievedExceptionTest.java NoRecordsRetrievedExceptionTest.java RequestValidationExceptionTest.java VNFNotFoundExceptionTest.java WorkflowNotFoundExceptionTest.java Issue-ID: APPC-773 Change-Id: I2e962a9614e3b17d77d2685e1055322531d832a1 Signed-off-by: Lori Keighron <lk2924@att.com>
Diffstat (limited to 'appc-dispatcher/appc-request-handler')
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/DGWorkflowNotFoundExceptionTest.java46
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/LCMOperationsDisabledExceptionTest.java38
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/MultipleRecordsRetrievedExceptionTest.java41
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/NoRecordsRetrievedExceptionTest.java41
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/RequestValidationExceptionTest.java18
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/VNFNotFoundExceptionTest.java39
-rw-r--r--appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/WorkflowNotFoundExceptionTest.java40
7 files changed, 263 insertions, 0 deletions
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/DGWorkflowNotFoundExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/DGWorkflowNotFoundExceptionTest.java
new file mode 100644
index 000000000..c58765dd5
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/DGWorkflowNotFoundExceptionTest.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.appc.executor.objects.LCMCommandStatus;
+
+public class DGWorkflowNotFoundExceptionTest {
+ @Test
+ public final void testDGWorkflowNotFoundException() {
+ String message = "tesingMessage";
+ String workflowModule = "tesingWfModule";
+ String workflowName = "tesingWfName";
+ String workflowVersion = "testingWfVersion";
+ String vnfType = "testingVnfType";
+ String action = "testingAction";
+ DGWorkflowNotFoundException dgwfnfe = new DGWorkflowNotFoundException(message, workflowModule, workflowName,
+ workflowVersion, vnfType, action);
+ assertEquals(dgwfnfe.getMessage(), message);
+ assertEquals(dgwfnfe.workflowModule, workflowModule);
+ assertEquals(dgwfnfe.workflowName, workflowName);
+ assertEquals(dgwfnfe.workflowVersion, workflowVersion);
+ assertEquals(dgwfnfe.getLcmCommandStatus(), LCMCommandStatus.DG_WORKFLOW_NOT_FOUND);
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/LCMOperationsDisabledExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/LCMOperationsDisabledExceptionTest.java
new file mode 100644
index 000000000..f43c03761
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/LCMOperationsDisabledExceptionTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.appc.executor.objects.LCMCommandStatus;
+
+public class LCMOperationsDisabledExceptionTest {
+ @Test
+ public final void testLCMOperationsDisabledException() {
+ String sampleMsg = "sample testing message";
+ LCMOperationsDisabledException lcmode = new LCMOperationsDisabledException(sampleMsg);
+ assertNotNull(lcmode.getMessage());
+ assertEquals(sampleMsg, lcmode.getMessage());
+ assertEquals(lcmode.getLcmCommandStatus(), LCMCommandStatus.REJECTED);
+ }
+} \ No newline at end of file
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/MultipleRecordsRetrievedExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/MultipleRecordsRetrievedExceptionTest.java
new file mode 100644
index 000000000..1e79ed934
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/MultipleRecordsRetrievedExceptionTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class MultipleRecordsRetrievedExceptionTest {
+ @Test
+ public final void testMultipleRecordsRetrievedException() {
+ String sampleMsg = "sample testing message";
+ MultipleRecordsRetrievedException mrre = new MultipleRecordsRetrievedException(sampleMsg);
+ assertNotNull(mrre.getMessage());
+ assertEquals(sampleMsg, mrre.getMessage());
+ }
+ @Test
+ public final void testMultipleRecordsRetrievedExceptionNoArgs() {
+ MultipleRecordsRetrievedException mrre = new MultipleRecordsRetrievedException();
+ assertNull(mrre.getMessage());
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/NoRecordsRetrievedExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/NoRecordsRetrievedExceptionTest.java
new file mode 100644
index 000000000..78ac1b72c
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/NoRecordsRetrievedExceptionTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+public class NoRecordsRetrievedExceptionTest {
+ @Test
+ public final void testNoRecordsRetrievedException() {
+ String sampleMsg = "sample testing message";
+ NoRecordsRetrievedException nrre = new NoRecordsRetrievedException(sampleMsg);
+ assertNotNull(nrre.getMessage());
+ assertEquals(sampleMsg, nrre.getMessage());
+ }
+ @Test
+ public final void testNoRecordsRetrievedExceptionNoArgs() {
+ NoRecordsRetrievedException nrre = new NoRecordsRetrievedException();
+ assertNull(nrre.getMessage());
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/RequestValidationExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/RequestValidationExceptionTest.java
new file mode 100644
index 000000000..2421fee8a
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/RequestValidationExceptionTest.java
@@ -0,0 +1,18 @@
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.appc.executor.objects.LCMCommandStatus;
+import org.onap.appc.executor.objects.Params;
+
+public class RequestValidationExceptionTest {
+ @Test
+ public final void testRequestValidationExceptionWithParams() {
+ String message = "tesingMessage";
+ String command = "tesingCommand";
+ Params p = new Params().addParam("actionName", command);
+ RequestValidationException rve = new RequestValidationException(message, LCMCommandStatus.MISSING_MANDATORY_PARAMETER, p);
+ assertNotNull(rve.getParams());
+ assertNotNull(rve.getMessage());
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/VNFNotFoundExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/VNFNotFoundExceptionTest.java
new file mode 100644
index 000000000..b4b392fa5
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/VNFNotFoundExceptionTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.appc.executor.objects.LCMCommandStatus;
+
+public class VNFNotFoundExceptionTest {
+ @Test
+ public final void testVNFNotFoundException() {
+ String sampleMsg = "sample testing message";
+ String vnfId = "sample vnfId";
+ VNFNotFoundException vnfe = new VNFNotFoundException(sampleMsg, vnfId);
+ assertNotNull(vnfe.getMessage());
+ assertEquals(sampleMsg, vnfe.getMessage());
+ assertEquals(vnfe.getLcmCommandStatus(), LCMCommandStatus.VNF_NOT_FOUND);
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/WorkflowNotFoundExceptionTest.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/WorkflowNotFoundExceptionTest.java
new file mode 100644
index 000000000..054fd9583
--- /dev/null
+++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/WorkflowNotFoundExceptionTest.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.requesthandler.exceptions;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.appc.executor.objects.LCMCommandStatus;
+
+public class WorkflowNotFoundExceptionTest {
+
+ @Test
+ public final void test() {
+ String sampleMsg = "sample testing message";
+ String vnfId = "sample vnfId";
+ String cmd = "sample command";
+ WorkflowNotFoundException wfnfe = new WorkflowNotFoundException(sampleMsg, vnfId, cmd);
+ assertNotNull(wfnfe.getMessage());
+ assertEquals(sampleMsg, wfnfe.getMessage());
+ assertEquals(wfnfe.getLcmCommandStatus(), LCMCommandStatus.WORKFLOW_NOT_FOUND); }
+}