diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-03-22 13:21:33 +0000 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-03-22 13:23:06 +0000 |
commit | b4777f0f5043cf1e5acc3af0309841002b5b1d65 (patch) | |
tree | 9059b8b6d383bedd42285430bbe3579f7bc67ed5 /adapters/mso-vnf-adapter | |
parent | 26bedd7ab6b03cef3cd0f0153f85d50070bbe888 (diff) |
Improve UT for SO
Improve UT for SO by adding exception cases.
Change-Id: I81f1be245e92f8bdac67a3e08cedbdde3a7ca166
Issue-ID: SO-369
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'adapters/mso-vnf-adapter')
-rw-r--r-- | adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index a773d13bb1..98c40a4b98 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -3,6 +3,7 @@ * ONAP - SO
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Huawei 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.
@@ -20,16 +21,77 @@ package org.openecomp.mso.adapters.vnf;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.ws.Holder;
import org.junit.Test;
-import org.openecomp.mso.adapters.vnf.MsoVnfCloudifyAdapterImpl;
+import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
import org.openecomp.mso.entity.MsoRequest;
import org.openecomp.mso.openstack.beans.VnfRollback;
+import org.openecomp.mso.properties.MsoPropertiesException;
+
+import javax.xml.ws.Holder;
+import java.util.HashMap;
+import java.util.Map;
public class MsoVnfCloudifyAdapterImplTest {
+ @Test(expected = NullPointerException.class)
+ public void queryVnfNullPointerExceptionTest() throws Exception {
+ MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.queryVnf("siteid", "1234", "vfname",
+ msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
+ new Holder<>());
+ }
+
+ @Test(expected = VnfException.class)
+ public void deleteVnfVnfExceptionTest() throws Exception {
+ MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.deleteVnf("12344", "234", "vnfname", msoRequest);
+
+ }
+
+ @Test
+ public void rollbackVnf() throws Exception {
+ MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ VnfRollback vnfRollback = new VnfRollback();
+ vnfRollback.setModelCustomizationUuid("1234");
+ vnfRollback.setVfModuleStackId("2134");
+ vnfRollback.setVnfId("123");
+ vnfRollback.setModelCustomizationUuid("1234");
+
+ instance.rollbackVnf(vnfRollback);
+ }
+
+ @Test(expected = VnfException.class)
+ public void createVfModuleVnfException() throws Exception {
+ MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "123", new HashMap<>(), true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test(expected = VnfException.class)
+ public void updateVfModuleVnfException() throws Exception {
+ MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
+ }
+
@Test
public void healthCheckVNFTest() {
MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
|