aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-16 09:40:28 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-16 09:40:28 +0000
commita9455a0d9289295b464994b6abe4a35d95e0f4ce (patch)
treec0ca963dbeac7207839d93d15c2aff4b2b244c32
parent1f2d4d8b32ef9403abec190775b90c5a4ab11d9f (diff)
parent89ff5a7f1a560bff0ac319fd7725e08c130fb9cf (diff)
Merge "Adding Junit"
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java61
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java43
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java37
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java58
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java60
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java43
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java59
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java48
8 files changed, 409 insertions, 0 deletions
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
index 0000000000..18a2108c86
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotificationTest.java
@@ -0,0 +1,61 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;
+
+public class CreateVnfNotificationTest {
+
+ @Test
+ public void test() {
+ CreateVnfNotification cvn=new CreateVnfNotification();
+ Entry ent = new Entry();
+ MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
+ Outputs value=new Outputs();
+ VnfRollback vnf=new VnfRollback();
+ vnf.setCloudSiteId("cloud");
+ cvn.setCompleted(true);
+ cvn.setErrorMessage("emsg");
+ cvn.setException(exception);
+ cvn.setMessageId("id");
+ cvn.setOutputs(value);
+ ent.setKey("key");
+ ent.setValue("value");
+ cvn.setRollback(vnf);
+ cvn.setVnfId("vnf");
+ assertTrue(cvn.isCompleted());
+ assert(cvn.getErrorMessage().equals("emsg"));
+ assert(cvn.getException()).equals(exception);
+ assert(cvn.getMessageId()).equals("id");
+ assert(cvn.getRollback()).equals(vnf);
+ assert(cvn.getOutputs()).equals(value);
+ assert(cvn.getVnfId()).equals("vnf");
+ assert(ent.getKey()).equals("key");
+ assert(ent.getValue()).equals("value");
+ assert(ent.toString()!=null);
+ assert(cvn.toString()!=null);
+ assert(vnf.getCloudSiteId().equals("cloud"));
+ assert(value.getEntry()!=null);
+ }
+}
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
index 0000000000..10e760e8de
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotificationTest.java
@@ -0,0 +1,43 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class DeleteVnfNotificationTest {
+
+ @Test
+ public void test() {
+ DeleteVnfNotification dvn=new DeleteVnfNotification();
+ MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
+ dvn.setCompleted(true);
+ dvn.setErrorMessage("msg");
+ dvn.setMessageId("id");
+ dvn.setException(exception);
+ assert(dvn.getErrorMessage().equals("msg"));
+ assert(dvn.getMessageId().equals("id"));
+ assert(dvn.getException().equals(exception));
+ assert(dvn.toString()!=null);
+ assertTrue(dvn.isCompleted());
+ }
+}
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
index 0000000000..59aff8cf77
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequestTest.java
@@ -0,0 +1,37 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class MsoRequestTest {
+ private MsoRequest msorequest = new MsoRequest();
+ @Test
+ public void testMsoRequest() {
+ msorequest.setRequestId("requestId");
+ msorequest.setServiceInstanceId("serviceInstanceId");
+ assertEquals(msorequest.getRequestId(), "requestId");
+ assertEquals(msorequest.getServiceInstanceId(), "serviceInstanceId");
+ }
+ @Test
+ public void testtoString() {
+ assert(msorequest.toString())!= null;
+ }
+}
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
index 0000000000..77ba0ea59b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactoryTest.java
@@ -0,0 +1,58 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.mockito.Mockito.mock;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
+
+public class ObjectFactoryTest {
+ private ObjectFactory ofa=new ObjectFactory();
+
+ @Test
+ public void test() {
+ CreateVnfNotification cvn=mock( CreateVnfNotification.class);
+ UpdateVnfNotification uvn=mock (UpdateVnfNotification.class);
+ QueryVnfNotification qn=mock(QueryVnfNotification.class);
+ DeleteVnfNotification dvn=mock( DeleteVnfNotification.class);
+ RollbackVnfNotification rvn=mock( RollbackVnfNotification.class);
+ MsoRequest mr=mock( MsoRequest.class);
+ Outputs opt=mock(Outputs.class);
+ ofa.createCreateVnfNotification();
+ ofa.createCreateVnfNotificationOutputs();
+ ofa.createDeleteVnfNotification();
+ ofa.createQueryVnfNotification();
+ ofa.createUpdateVnfNotification();
+ ofa.createMsoRequest();
+ ofa.createRollbackVnfNotification();
+ ofa.createUpdateVnfNotificationOutputs();
+ ofa.createQueryVnfNotificationOutputs();
+ ofa.createVnfRollback();
+ ofa.createUpdateVnfNotificationOutputsEntry();
+ ofa.createQueryVnfNotificationOutputsEntry();
+ ofa.createCreateVnfNotificationOutputsEntry();
+ ofa.createCreateVnfNotification(cvn);
+ ofa.createDeleteVnfNotification(dvn);
+ ofa.createQueryVnfNotification(qn);
+ ofa.createRollbackVnfNotification(rvn);
+ ofa.createUpdateVnfNotification(uvn);
+ }
+}
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
index 0000000000..59e10baedc
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotificationTest.java
@@ -0,0 +1,60 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs;
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs.Entry;
+
+public class QueryVnfNotificationTest {
+ private QueryVnfNotification qvn=new QueryVnfNotification();
+
+ @Test
+ public void test() {
+ Entry ent = new Entry();
+ MsoExceptionCategory exception = MsoExceptionCategory.OPENSTACK;
+ Outputs opt=new Outputs();
+ VnfStatus vnf=VnfStatus.ACTIVE;
+ qvn.setCompleted(true);
+ qvn.setErrorMessage("error");
+ qvn.setException(exception);
+ qvn.setMessageId("id");
+ qvn.setStatus(vnf);
+ qvn.setVnfId("id");
+ qvn.setVnfExists(true);
+ ent.setKey("key");
+ ent.setValue("value");
+ assert(qvn.getErrorMessage().equals("error"));
+ assert(qvn.getException()).equals(exception);
+ assert(qvn.getMessageId()).equals("id");
+ assert(qvn.getStatus()).equals(vnf);
+ assert(qvn.getVnfId()).equals("id");
+ assertTrue(qvn.isVnfExists());
+ assertTrue(qvn.isCompleted());
+ assert(opt.getEntry()!=null);
+ assert(opt.toString()!=null);
+ assert(ent.getValue()).equals("value");
+ assert(ent.getKey()).equals("key");
+ assert(ent.toString()!=null);
+ assert(qvn.toString()!=null);
+ }
+}
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
index 0000000000..c6602d33f9
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotificationTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class RollbackVnfNotificationTest {
+ private RollbackVnfNotification rvn = new RollbackVnfNotification();
+ MsoExceptionCategory mso= MsoExceptionCategory.OPENSTACK;
+ @Test
+ public void testRollbackVnfNotification() {
+ rvn.setMessageId("messageId");
+ rvn.setCompleted(true);
+ rvn.setException(mso);
+ rvn.setErrorMessage("errorMessage");
+ assertEquals(rvn.getMessageId(), "messageId");
+ assertEquals(rvn.isCompleted(), true);
+ assertEquals(rvn.getException(), mso);
+ assertEquals(rvn.getErrorMessage(), "errorMessage");
+ }
+ @Test
+ public void testtoString() {
+ assert(rvn.toString()!=null);
+ }
+}
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
index 0000000000..825695b3dd
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotificationTest.java
@@ -0,0 +1,59 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs;
+import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs.Entry;
+
+public class UpdateVnfNotificationTest {
+ private UpdateVnfNotification updatevnf = new UpdateVnfNotification();
+ MsoExceptionCategory mso;
+ Outputs value= new Outputs();
+ VnfRollback roll = new VnfRollback();
+ private Entry entry = new Entry();
+
+ @Test
+ public void testUpdateVnfNotification() {
+ updatevnf.setMessageId("messageId");
+ updatevnf.setCompleted(true);
+ updatevnf.setException(mso);
+ updatevnf.setErrorMessage("errorMessage");
+ updatevnf.setOutputs(value);
+ updatevnf.setRollback(roll);
+ entry.setKey("key");
+ entry.setValue("value");
+ assertEquals(updatevnf.getMessageId(), "messageId");
+ assertEquals(updatevnf.isCompleted(), true);
+ assertEquals(updatevnf.getException(), mso);
+ assertEquals(updatevnf.getErrorMessage(), "errorMessage");
+ assertEquals(updatevnf.getOutputs(), value);
+ assertEquals(updatevnf.getRollback(), roll);
+ assertEquals(entry.getKey(), "key");
+ assertEquals(entry.getValue(), "value");
+ }
+ @Test
+ public void testtoString() {
+ assert(updatevnf.toString()!= null);
+ assert(entry.toString()!= null);
+ }
+}
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
index 0000000000..ebed8714df
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollbackTest.java
@@ -0,0 +1,48 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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 org.openecomp.mso.bpmn.common.adapter.vnf;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class VnfRollbackTest {
+ private VnfRollback vnfrollback = new VnfRollback();
+ MsoRequest mso = new MsoRequest();
+ @Test
+ public void testVnfRollback() {
+ vnfrollback.setCloudSiteId("cloudSiteId");
+ vnfrollback.setMsoRequest(mso);
+ vnfrollback.setTenantCreated(true);
+ vnfrollback.setTenantId("tenantId");
+ vnfrollback.setVnfCreated(true);
+ vnfrollback.setVnfId("vnfId");
+ assertEquals(vnfrollback.getCloudSiteId(), "cloudSiteId");
+ assertEquals(vnfrollback.getMsoRequest(), mso);
+ assertEquals(vnfrollback.isTenantCreated(), true);
+ assertEquals(vnfrollback.getTenantId(), "tenantId");
+ assertEquals(vnfrollback.isVnfCreated(), true);
+ assertEquals(vnfrollback.getVnfId(), "vnfId");
+ }
+ @Test
+ public void testtoString() {
+ assert(vnfrollback.toString() != null);
+ }
+}