Add junit coverage to request handler exceptions 55/37555/2
authorLori Keighron <lk2924@att.com>
Wed, 21 Mar 2018 18:37:21 +0000 (14:37 -0400)
committerTakamune Cho <tc012c@att.com>
Wed, 21 Mar 2018 19:16:21 +0000 (19:16 +0000)
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>
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/DGWorkflowNotFoundExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/LCMOperationsDisabledExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/MultipleRecordsRetrievedExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/NoRecordsRetrievedExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/RequestValidationExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/VNFNotFoundExceptionTest.java [new file with mode: 0644]
appc-dispatcher/appc-request-handler/appc-request-handler-core/src/test/java/org/onap/appc/requesthandler/exceptions/WorkflowNotFoundExceptionTest.java [new file with mode: 0644]

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 (file)
index 0000000..c58765d
--- /dev/null
@@ -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 (file)
index 0000000..f43c037
--- /dev/null
@@ -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 (file)
index 0000000..1e79ed9
--- /dev/null
@@ -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 (file)
index 0000000..78ac1b7
--- /dev/null
@@ -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 (file)
index 0000000..2421fee
--- /dev/null
@@ -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 (file)
index 0000000..b4b392f
--- /dev/null
@@ -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 (file)
index 0000000..054fd95
--- /dev/null
@@ -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);   }
+}