Adding Junit 83/36183/1
authorSumapriya <SS00493505@techmahindra.com>
Fri, 16 Mar 2018 07:55:22 +0000 (13:25 +0530)
committerSumapriya <SS00493505@techmahindra.com>
Fri, 16 Mar 2018 07:55:22 +0000 (13:25 +0530)
Adding Junit for:
1.CreateVnfNotification.java
2.MsoRequest.java
3.RollbackVnfNotification.java
4.UpdateVnfNotification.java
5.VnfRollback.java
6.DeleteVnfNotification.java
7.ObjectFactory.java
8.QueryVnfNotification.java

Sonar Link:
https://sonar.onap.org/code?id=org.onap.so%3Aso&selected=org.onap.so%3AMSOCommonBPMN%3Asrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fbpmn%2Fcommon%2Fadapter%2Fvnf

Change-Id: I7cc60cb10984d58f50bd40033d48e224de4efbd7
Issue-ID: SO-490
Signed-off-by: Sumapriya <SS00493505@techmahindra.com>
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java [new file with mode: 0644]

diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java
new file mode 100644 (file)
index 0000000..18a2108
--- /dev/null
@@ -0,0 +1,61 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.*;\r
+import org.junit.Test;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;\r
+\r
+public class CreateVnfNotificationTest {\r
+\r
+       @Test\r
+       public void test() {\r
+               CreateVnfNotification cvn=new CreateVnfNotification();\r
+                Entry ent = new Entry();\r
+               MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;\r
+               Outputs value=new Outputs();\r
+               VnfRollback vnf=new VnfRollback();\r
+               vnf.setCloudSiteId("cloud");\r
+               cvn.setCompleted(true);\r
+               cvn.setErrorMessage("emsg");\r
+               cvn.setException(exception);\r
+               cvn.setMessageId("id");\r
+               cvn.setOutputs(value);\r
+               ent.setKey("key");\r
+               ent.setValue("value");\r
+               cvn.setRollback(vnf);\r
+               cvn.setVnfId("vnf");\r
+       assertTrue(cvn.isCompleted());\r
+       assert(cvn.getErrorMessage().equals("emsg"));\r
+       assert(cvn.getException()).equals(exception);\r
+       assert(cvn.getMessageId()).equals("id");\r
+       assert(cvn.getRollback()).equals(vnf);\r
+       assert(cvn.getOutputs()).equals(value);\r
+       assert(cvn.getVnfId()).equals("vnf");\r
+       assert(ent.getKey()).equals("key");\r
+       assert(ent.getValue()).equals("value");\r
+       assert(ent.toString()!=null);\r
+       assert(cvn.toString()!=null);\r
+       assert(vnf.getCloudSiteId().equals("cloud"));\r
+    assert(value.getEntry()!=null);    \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java
new file mode 100644 (file)
index 0000000..10e760e
--- /dev/null
@@ -0,0 +1,43 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class DeleteVnfNotificationTest {\r
+\r
+       @Test\r
+       public void test() {\r
+               DeleteVnfNotification dvn=new DeleteVnfNotification();\r
+               MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;\r
+               dvn.setCompleted(true);\r
+               dvn.setErrorMessage("msg");\r
+               dvn.setMessageId("id");\r
+               dvn.setException(exception);\r
+               assert(dvn.getErrorMessage().equals("msg"));\r
+               assert(dvn.getMessageId().equals("id"));\r
+               assert(dvn.getException().equals(exception));\r
+               assert(dvn.toString()!=null);\r
+               assertTrue(dvn.isCompleted());\r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java
new file mode 100644 (file)
index 0000000..59aff8c
--- /dev/null
@@ -0,0 +1,37 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+import static org.junit.Assert.assertEquals;\r
+import org.junit.Test;\r
+\r
+public class MsoRequestTest {\r
+       private MsoRequest msorequest = new MsoRequest();\r
+       @Test\r
+       public void testMsoRequest() {\r
+               msorequest.setRequestId("requestId");\r
+               msorequest.setServiceInstanceId("serviceInstanceId");\r
+               assertEquals(msorequest.getRequestId(), "requestId");\r
+               assertEquals(msorequest.getServiceInstanceId(), "serviceInstanceId");\r
+       }\r
+       @Test\r
+       public void testtoString() {\r
+               assert(msorequest.toString())!= null;   \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java
new file mode 100644 (file)
index 0000000..77ba0ea
--- /dev/null
@@ -0,0 +1,58 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.mockito.Mockito.mock;\r
+import org.junit.Test;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;\r
+\r
+public class ObjectFactoryTest {\r
+       private ObjectFactory ofa=new ObjectFactory();\r
+       \r
+       @Test\r
+       public void test() {            \r
+               CreateVnfNotification cvn=mock( CreateVnfNotification.class);\r
+               UpdateVnfNotification uvn=mock (UpdateVnfNotification.class);\r
+                QueryVnfNotification qn=mock(QueryVnfNotification.class);\r
+                DeleteVnfNotification dvn=mock( DeleteVnfNotification.class);\r
+                RollbackVnfNotification rvn=mock( RollbackVnfNotification.class);\r
+                MsoRequest mr=mock( MsoRequest.class);\r
+                Outputs opt=mock(Outputs.class);\r
+               ofa.createCreateVnfNotification();\r
+               ofa.createCreateVnfNotificationOutputs();\r
+               ofa.createDeleteVnfNotification();\r
+               ofa.createQueryVnfNotification();\r
+               ofa.createUpdateVnfNotification();\r
+               ofa.createMsoRequest();\r
+               ofa.createRollbackVnfNotification();\r
+               ofa.createUpdateVnfNotificationOutputs();\r
+               ofa.createQueryVnfNotificationOutputs();\r
+               ofa.createVnfRollback();\r
+               ofa.createUpdateVnfNotificationOutputsEntry();\r
+               ofa.createQueryVnfNotificationOutputsEntry();\r
+               ofa.createCreateVnfNotificationOutputsEntry();\r
+               ofa.createCreateVnfNotification(cvn);\r
+               ofa.createDeleteVnfNotification(dvn);\r
+               ofa.createQueryVnfNotification(qn);\r
+               ofa.createRollbackVnfNotification(rvn);\r
+               ofa.createUpdateVnfNotification(uvn); \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java
new file mode 100644 (file)
index 0000000..59e10ba
--- /dev/null
@@ -0,0 +1,60 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.*;\r
+import org.junit.Test;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;\r
+\r
+public class QueryVnfNotificationTest {\r
+       private QueryVnfNotification qvn=new QueryVnfNotification();\r
+       \r
+       @Test\r
+       public void test() {\r
+                Entry ent = new Entry();\r
+               MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;\r
+               Outputs opt=new Outputs();\r
+               VnfStatus vnf=VnfStatus.ACTIVE;\r
+               qvn.setCompleted(true);\r
+               qvn.setErrorMessage("error");\r
+               qvn.setException(exception);\r
+               qvn.setMessageId("id");\r
+               qvn.setStatus(vnf);\r
+               qvn.setVnfId("id");\r
+               qvn.setVnfExists(true);\r
+               ent.setKey("key");\r
+               ent.setValue("value");\r
+               assert(qvn.getErrorMessage().equals("error"));\r
+               assert(qvn.getException()).equals(exception);\r
+               assert(qvn.getMessageId()).equals("id");\r
+               assert(qvn.getStatus()).equals(vnf);\r
+               assert(qvn.getVnfId()).equals("id");\r
+               assertTrue(qvn.isVnfExists());\r
+               assertTrue(qvn.isCompleted());\r
+               assert(opt.getEntry()!=null);\r
+               assert(opt.toString()!=null);\r
+               assert(ent.getValue()).equals("value");\r
+               assert(ent.getKey()).equals("key");\r
+               assert(ent.toString()!=null);\r
+               assert(qvn.toString()!=null);           \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java
new file mode 100644 (file)
index 0000000..c6602d3
--- /dev/null
@@ -0,0 +1,43 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import org.junit.Test;\r
+\r
+public class RollbackVnfNotificationTest {\r
+       private RollbackVnfNotification rvn = new RollbackVnfNotification();\r
+        MsoExceptionCategory mso= MsoExceptionCategory.OPENSTACK;\r
+       @Test\r
+       public void testRollbackVnfNotification() {\r
+               rvn.setMessageId("messageId");\r
+               rvn.setCompleted(true);\r
+               rvn.setException(mso);\r
+               rvn.setErrorMessage("errorMessage");\r
+               assertEquals(rvn.getMessageId(), "messageId");\r
+               assertEquals(rvn.isCompleted(), true);\r
+               assertEquals(rvn.getException(), mso);\r
+               assertEquals(rvn.getErrorMessage(), "errorMessage");\r
+       }\r
+       @Test\r
+       public void testtoString() {\r
+               assert(rvn.toString()!=null);\r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java
new file mode 100644 (file)
index 0000000..825695b
--- /dev/null
@@ -0,0 +1,59 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.*;\r
+import org.junit.Test;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs;\r
+import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs.Entry;\r
+\r
+public class UpdateVnfNotificationTest {\r
+       private UpdateVnfNotification updatevnf = new UpdateVnfNotification();\r
+       MsoExceptionCategory mso;\r
+       Outputs value= new Outputs();\r
+       VnfRollback roll = new VnfRollback();\r
+       private Entry entry = new Entry();\r
+       \r
+       @Test\r
+       public void testUpdateVnfNotification() {\r
+               updatevnf.setMessageId("messageId");\r
+               updatevnf.setCompleted(true);\r
+               updatevnf.setException(mso);\r
+               updatevnf.setErrorMessage("errorMessage");\r
+               updatevnf.setOutputs(value);\r
+               updatevnf.setRollback(roll);\r
+               entry.setKey("key");\r
+               entry.setValue("value");\r
+               assertEquals(updatevnf.getMessageId(), "messageId");\r
+               assertEquals(updatevnf.isCompleted(), true);\r
+               assertEquals(updatevnf.getException(), mso);\r
+               assertEquals(updatevnf.getErrorMessage(), "errorMessage");\r
+               assertEquals(updatevnf.getOutputs(), value);\r
+               assertEquals(updatevnf.getRollback(), roll);\r
+               assertEquals(entry.getKey(), "key");\r
+               assertEquals(entry.getValue(), "value");        \r
+       }\r
+       @Test\r
+       public void testtoString() {\r
+               assert(updatevnf.toString()!= null);\r
+               assert(entry.toString()!= null);\r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java
new file mode 100644 (file)
index 0000000..ebed871
--- /dev/null
@@ -0,0 +1,48 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.bpmn.common.adapter.vnf;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import org.junit.Test;\r
+\r
+public class VnfRollbackTest {\r
+       private VnfRollback vnfrollback = new VnfRollback();\r
+       MsoRequest mso = new MsoRequest();\r
+       @Test\r
+       public void testVnfRollback() {\r
+               vnfrollback.setCloudSiteId("cloudSiteId");\r
+               vnfrollback.setMsoRequest(mso);\r
+               vnfrollback.setTenantCreated(true);\r
+               vnfrollback.setTenantId("tenantId");\r
+               vnfrollback.setVnfCreated(true);\r
+               vnfrollback.setVnfId("vnfId");\r
+               assertEquals(vnfrollback.getCloudSiteId(), "cloudSiteId");\r
+               assertEquals(vnfrollback.getMsoRequest(), mso);\r
+               assertEquals(vnfrollback.isTenantCreated(), true);\r
+               assertEquals(vnfrollback.getTenantId(), "tenantId");\r
+               assertEquals(vnfrollback.isVnfCreated(), true);\r
+               assertEquals(vnfrollback.getVnfId(), "vnfId");  \r
+       }\r
+       @Test\r
+       public void testtoString() {\r
+               assert(vnfrollback.toString() != null);\r
+       }\r
+}\r