diff options
Diffstat (limited to 'adapters/mso-vnf-adapter/src/test')
20 files changed, 10 insertions, 1992 deletions
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java index ffa6bcd961..c3d9cca0e9 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vdu.mapper; +package org.onap.so.adapters.vdu.mapper; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -29,15 +29,15 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.HeatEnvironment; -import org.openecomp.mso.db.catalog.beans.HeatFiles; -import org.openecomp.mso.db.catalog.beans.HeatTemplate; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.db.catalog.CatalogDatabase; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatFiles; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java deleted file mode 100644 index 445ca54c21..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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 - *l - * 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.adapters.vnf; - -import org.junit.Test; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertTrue; - -public class BpelRestClientTest { - - @Test - public void testBpelRestClient() { - - BpelRestClient test = new BpelRestClient(); - - assertEquals(test.getSocketTimeout(),5); - assertEquals(test.getConnectTimeout(),5); - assertEquals(test.getRetryCount(),5); - test.setRetryCount(6); - assertEquals(test.getRetryCount(),6); - assertEquals(test.getRetryInterval(),-15); - test.setRetryInterval(5); - assertEquals(test.getRetryInterval(),5); - test.setCredentials("credentials"); - assertEquals(test.getCredentials(),"credentials"); - test.setRetryList("1, 2, 3"); - assertEquals(test.getRetryList(),"1, 2, 3"); - assertEquals(test.getLastResponseCode(),0); - assertEquals(test.getLastResponse(),""); - assertTrue(test.bpelPost("bpelStr","url",true)); - - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java deleted file mode 100644 index 12e2fa04e5..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.adapters.vnf; - -import org.junit.Test; - -public class HealthCheckHandlerTest { - - HealthCheckHandler healthCheckHandler = new HealthCheckHandler(); - - @Test(expected = ClassFormatError.class) - public void healthcheckTest() throws Exception { - healthCheckHandler.healthcheck("req-123"); - } - -}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java deleted file mode 100644 index b00b7a0e36..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.vnf;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Test;
-import org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl;
-import org.openecomp.mso.entity.MsoRequest;
-import org.openecomp.mso.openstack.beans.VnfRollback;
-
-public class MsoVnfAdapterAsyncImplTest {
-
- @Test
- public void healthCheckVNFTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- instance.healthCheckA();
- }
-
- @Test
- public void createVNFTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
-
- instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", new HashMap<>(), Boolean.FALSE, Boolean.TRUE, "messageId",
- null, "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void updateVnfTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- try {
- instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, "messageId", msoRequest,
- "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void queryVnfTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
- instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
- "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void deleteVnfTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
- instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
- "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void rollbackVnfTest() {
- MsoVnfAdapterAsyncImpl instance = new MsoVnfAdapterAsyncImpl();
- VnfRollback vnfRollBack = new VnfRollback();
- vnfRollBack.setCloudSiteId("mdt1");
- vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
- vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
- try {
- instance.rollbackVnfA(vnfRollBack, "messageId",
- "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest");
- } catch (Exception e) {
-
- }
- }
-}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java deleted file mode 100644 index bdf42a19a2..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java +++ /dev/null @@ -1,542 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.vnf;
-
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import javax.xml.ws.Holder;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.mockito.Mock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.openecomp.mso.adapters.vnf.exceptions.VnfAlreadyExists;
-import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.cloudify.exceptions.MsoCloudifyException;
-import org.openecomp.mso.entity.MsoRequest;
-import org.openecomp.mso.openstack.beans.HeatStatus;
-import org.openecomp.mso.openstack.beans.StackInfo;
-import org.openecomp.mso.openstack.beans.VnfRollback;
-import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
-import org.openecomp.mso.openstack.utils.MsoHeatUtils;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class MsoVnfAdapterImplTest {
-
- @InjectMocks
- MsoVnfAdapterImpl msoVnfAdapter;
- @Mock
- MsoHeatUtils heat;
-
- @Before
- public void setup() throws MsoCloudIdentityNotFound{
- ClassLoader classLoader = MsoVnfAdapterImplTest.class.getClassLoader();
- String cloudConfigJsonFilePath = classLoader.getResource("cloud_config.json").getPath();
- CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
- cloudConfigFactory.initializeCloudConfig(cloudConfigJsonFilePath, 1);
- msoVnfAdapter = new MsoVnfAdapterImpl(new MsoPropertiesFactory(), cloudConfigFactory);
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void updateVnf() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- msoVnfAdapter.updateVnf("cloudsite", "tenantid", "vfw", "v1", "test",
- "update", "heatid", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
- Assert.assertTrue(true);
- }
-
-
- @Test(expected = VnfException.class)
- public void nullRequestCreateVnf() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
-
- }
-
- @Test(expected = VnfAlreadyExists.class)
- public void createVnfInProgress() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.INIT);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
-
- }
-
- @Test(expected = VnfAlreadyExists.class)
- public void createVnfFailed() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.FAILED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
-
- }
-
- @Test(expected = VnfAlreadyExists.class)
- public void createVnfUnknown() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.UNKNOWN);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
-
- }
-
- @Test(expected = VnfAlreadyExists.class)
- public void createVnfCreatedAndFail() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, true, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
-
- }
-
- @Test
- public void createVnfCreatedAndContinue() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- null, "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void createVnfNestedStackException() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- StackInfo nestedStackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- "VFMOD", "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void createVnfNestedStackNotFound() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- StackInfo nestedStackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- "VFMOD", "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void createVnfBaseNestedStackFailed() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Map<String,Object> nestedMap = new HashMap();
- nestedMap.put("key",new Integer(3));
- StackInfo stackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- StackInfo nestedStackInfo = new StackInfo("test",HeatStatus.CREATED);
- StackInfo nestedBaseStackInfo = new StackInfo("test",HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- "VFMOD", "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void createVnfBaseNestedStackNotFound() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- StackInfo nestedStackInfo = new StackInfo("test",HeatStatus.CREATED);
- StackInfo nestedBaseStackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo,nestedBaseStackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- "VFMOD", "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void createVnfBaseNestedStackSuc() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test",HeatStatus.NOTFOUND);
- StackInfo nestedStackInfo = new StackInfo("test",HeatStatus.CREATED);
- StackInfo nestedBaseStackInfo = new StackInfo("test",HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo,nestedBaseStackInfo);
- msoVnfAdapter.createVnf("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12",
- "VFMOD", "volumeGroupHeatStackId|1", map, false, true, msoRequest,new Holder<>(),new Holder<>(), new Holder<>());
- }
-
- @Test
- public void queryVnfNullPoinerExceptionTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- Mockito.reset(heat);
- msoVnfAdapter.queryVnf("cloudSiteId",
- "tenantId",
- "vnfName",
- msoRequest,
- new Holder<>(),
- new Holder<>(),
- new Holder<>(),
- new Holder<>());
- Assert.assertFalse(false);
- }
-
- @Test
- public void rollbackVnfCloudSiteInfoNotAvail() throws Exception {
- VnfRollback rollback = new VnfRollback();
- rollback.setVnfId("vnfid");
- rollback.setVfModuleStackId("stackid");
- rollback.setCloudSiteId("11234");
- rollback.setTenantId("234");
-
- msoVnfAdapter.rollbackVnf(rollback);
- Assert.assertFalse(false);
- }
-
- @Test
- public void healthCheckVNFTest() {
- MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
- instance.healthCheck();
- }
-
- @Test
- public void createVnfTest() {
- MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- try {
- instance.createVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>());
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void updateVnfTest() {
- MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- try {
- instance.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- } catch (Exception e) {
-
- }
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfNotFound() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo);
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
-
-
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfFailed() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
-
-
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfNestedStackNotFound() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedstackInfo = new StackInfo("test", HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedstackInfo);
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfNestedStackFailed() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfNestedBaseStackNotFound() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedStackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedBaseStackInfo = new StackInfo("test", HeatStatus.NOTFOUND);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo,nestedBaseStackInfo);
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- }
-
- @Test(expected = VnfException.class)
- public void updateVnfNestedBaseStackFailed() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedStackInfo = new StackInfo("test", HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo).thenThrow(new MsoCloudifyException(1,"test","test"));
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- }
-
- @Test(expected = NullPointerException.class)
- public void updateVnfNestedBaseStackSuc() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- StackInfo stackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedStackInfo = new StackInfo("test", HeatStatus.CREATED);
- StackInfo nestedBaseStackInfo = new StackInfo("test", HeatStatus.CREATED);
- Mockito.when(heat.queryStack(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackInfo,nestedStackInfo,nestedBaseStackInfo);
- msoVnfAdapter.updateVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<>(),
- new Holder<>());
- }
-
- @Test
- public void deleteVnfTest() {
- MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
- instance.deleteVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<>());
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void deleteVnfReturnJsonNodeStack() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Map<String,Object> stackOutputs = new HashMap<>();
- JsonNode node = Mockito.mock(JsonNode.class);
- stackOutputs.put("key",node);
- Mockito.when(heat.queryStackForOutputs(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackOutputs);
- msoVnfAdapter.deleteVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<>());
- }
-
- @Test
- public void deleteVnfReturnLinkedHashMapStack() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Map<String,Object> stackOutputs = new HashMap<>();
- LinkedHashMap<String,Object> node = Mockito.mock(LinkedHashMap.class);
- stackOutputs.put("key",node);
- Mockito.when(heat.queryStackForOutputs(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackOutputs);
- msoVnfAdapter.deleteVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<>());
- }
-
- @Test
- public void deleteVnfReturnIntegerStack() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Map<String,Object> stackOutputs = new HashMap<>();
- Integer node = new Integer(2);
- stackOutputs.put("key",node);
- Mockito.when(heat.queryStackForOutputs(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackOutputs);
- msoVnfAdapter.deleteVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<>());
- }
-
- @Test
- public void deleteVnfReturnOtherStack() throws Exception{
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- Map<String,Object> stackOutputs = new HashMap<>();
- List<String> node = Mockito.mock(List.class);
- stackOutputs.put("key",node);
- Mockito.when(heat.queryStackForOutputs(Mockito.anyString(),Mockito.anyString(),Mockito.anyString())).thenReturn(stackOutputs);
- msoVnfAdapter.deleteVfModule("MT", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest,
- new Holder<>());
- }
-
-
-
-}
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 deleted file mode 100644 index 98c40a4b98..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * 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.
- * 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.adapters.vnf;
-
-import org.junit.Test;
-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();
- instance.healthCheck();
- }
-
- @Test
- public void createVnfTest() {
- MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
- map.put("key1", "value1");
- try {
- instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map,
- Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>());
- } catch (Exception e) {
- }
- }
-
- @Test
- public void updateVnfTest() {
- MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, String> map = new HashMap<>();
-
- map.put("key1", "value1");
- try {
- instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(),
- new Holder<>());
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void deleteVnfTest() {
- MsoVnfCloudifyAdapterImpl instance = new MsoVnfCloudifyAdapterImpl();
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
- instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
- } catch (Exception e) {
-
- }
- }
-
-}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImplTest.java deleted file mode 100644 index 37ca4f762a..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.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.exceptions.VnfException; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; - -public class MsoVnfPluginAdapterImplTest { - - @Test(expected = NullPointerException.class) - public void queryVnfNullPointerExceptionTest() throws Exception { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - 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 { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.deleteVnf("12344", "234", "vnfname", msoRequest); - - } - - @Test - public void rollbackVnf() throws Exception { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - 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 { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - 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 { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - 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() { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - instance.healthCheck(); - } - - @Test - public void createVnfTest() { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, String> map = new HashMap<>(); - map.put("key1", "value1"); - try { - instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, - Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(), - new Holder<>()); - } catch (Exception e) { - } - } - - @Test - public void updateVnfTest() { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, String> map = new HashMap<>(); - - map.put("key1", "value1"); - try { - instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(), - new Holder<>()); - } catch (Exception e) { - - } - } - - @Test - public void deleteVnfTest() { - MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl(); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - try { - instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest); - } catch (Exception e) { - - } - } - -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java deleted file mode 100644 index 06a4cb3307..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.vnf; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.util.Map; - -import javax.xml.ws.Holder; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.mso.adapters.vnf.exceptions.VnfException; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.beans.VnfStatus; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoHeatUtils; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -public class QueryTest { - - @Test - public void testQueryCreatedVnf() throws VnfException, MsoException { - { - StackInfo info = new StackInfo("stackName", HeatStatus.CREATED); - MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl(); - vnfAdapter.heat = Mockito.mock(MsoHeatUtils.class); - when(vnfAdapter.heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - - assertTrue(vnfExists.value); - } - } - - @Test - public void testQueryNotFoundVnf() throws VnfException, MsoException { - { - StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND); - MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl(); - vnfAdapter.heat = Mockito.mock(MsoHeatUtils.class); - when(vnfAdapter.heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - - assertFalse(vnfExists.value); - } - } - - @Test(expected = VnfException.class) - // @Ignore // 1802 merge - public void testQueryVnfWithException() throws VnfException { - { - String propFile = MsoJavaProperties.class.getClassLoader().getResource("mso.properties").getPath(); - String cloudConfigJsonFilePath = MsoJavaProperties.class.getClassLoader().getResource("cloud_config.json") - .getPath(); - - MsoPropertiesFactory msoPropFactory = new MsoPropertiesFactory(); - CloudConfigFactory cloudConfigFact = new CloudConfigFactory(); - try { - msoPropFactory.initializeMsoProperties("MSO_PROP_VNF_ADAPTER", propFile); - cloudConfigFact.initializeCloudConfig(cloudConfigJsonFilePath, 1); - } catch (org.openecomp.mso.properties.MsoPropertiesException e) { - // System.err.println("!?!?!?!! mso config exception: " + e); - // e.printStackTrace(); - } catch (org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound e) { - // System.err.println("!?!?!?!! cloud config exception: " + e); - // e.printStackTrace(); - } - - MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(msoPropFactory, cloudConfigFact); - - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - } - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VfRollbackTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VfRollbackTest.java deleted file mode 100644 index 03de139b1d..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VfRollbackTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*
-* ============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.adapters.vnf;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-public class VfRollbackTest {
- private VfRollback vfRollback = new VfRollback();
-
- @Test
- public void test() {
- vfRollback.setVnfId("vnfId");
- vfRollback.setTenantId("tenantId");
- vfRollback.setCloudSiteId("cloudId");
- vfRollback.setTenantCreated(true);
- vfRollback.setVnfCreated(true);
- vfRollback.setMsoRequest(null);
- vfRollback.setVolumeGroupName("volumeGroupName");
- vfRollback.setVolumeGroupId("volumeGroupId");
- vfRollback.setRequestType("requestType");
- vfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId");
- vfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId");
- vfRollback.setIsBase(true);
- vfRollback.setVfModuleStackId("vfModuleStackId");
- assert(vfRollback.getVnfId() != null);
- assert(vfRollback.getTenantId() != null);
- assert(vfRollback.getCloudSiteId() != null);
- assert(vfRollback.getVolumeGroupName() != null);
- assert(vfRollback.getVolumeGroupId() != null);
- assert(vfRollback.getRequestType() != null);
- assert(vfRollback.getVolumeGroupHeatStackId() != null);
- assert(vfRollback.getBaseGroupHeatStackId() != null);
- assert(vfRollback.getVfModuleStackId() != null);
- assertEquals(vfRollback.getVnfId(), "vnfId");
- assertEquals(vfRollback.getTenantId(),"tenantId");
- assertEquals(vfRollback.getCloudSiteId(), "cloudId");
- assertEquals(vfRollback.getTenantCreated(), true);
- assertEquals(vfRollback.getVnfCreated(), true);
- assertEquals(vfRollback.getMsoRequest(), null);
- assertEquals(vfRollback.getVolumeGroupName(), "volumeGroupName");
- assertEquals(vfRollback.getVolumeGroupId(), "volumeGroupId");
- assertEquals(vfRollback.getRequestType(), "requestType");
- assertEquals(vfRollback.getVolumeGroupHeatStackId(), "volumeGroupHeatStackId");
- assertEquals(vfRollback.getBaseGroupHeatStackId(), "baseGroupHeatStackId");
- assertEquals(vfRollback.isBase(), true);
- assertEquals(vfRollback.getVfModuleStackId(), "vfModuleStackId");
- }
-
- @Test
- public void testtoString() {
- assert(vfRollback.toString() != null);
- }
-}
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java deleted file mode 100644 index 30936d05d8..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - SO - * ================================================================================ - * 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. - * 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.adapters.vnf; - -import org.junit.Test; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; - -public class VnfAdapterRestV2ExceptionTest { - - - - VnfAdapterRestV2 vnfAdapterRestV2 = new VnfAdapterRestV2(); - - //TODO THESE ARE RAINY DAY TESTS, NEED TO WRITE THE SUNNY DAY ONES - // @Test(expected = ClassFormatError.class) - public void testHealthcheckFailForInvalidCase() throws Exception { - try{ - vnfAdapterRestV2.healthcheck(); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - - // @Test(expected = ClassFormatError.class) - public void deleteVfModuleClassFormatError() throws Exception { - try{ - DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); - deleteVfModuleRequest.setVnfId("vnfid"); - deleteVfModuleRequest.setVfModuleId("moduleid"); - vnfAdapterRestV2.deleteVfModule("vnfid", "moduleid", "mode", deleteVfModuleRequest); - } - catch(Exception ex) - { // EXCEPTION EXPECTED - assert(true); - } - - } - - // @Test(expected = NullPointerException.class) - public void queryVfModuleNullPointerException() throws Exception { - try{ - vnfAdapterRestV2.queryVfModule("vnfid", "moduleid", "cloudid", "teanantid", "vfmodulename", true, "requestid", "serviceinstanceid", "mode"); - } - catch(Exception ex) - { // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = ClassFormatError.class) - public void createVfModuleClassFormatError() throws Exception { - try{ - vnfAdapterRestV2.createVfModule("vnfid", "create", new CreateVfModuleRequest()); - } - catch(Exception ex) - { // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = ClassFormatError.class) - public void updateVfModulClassFormatErrore() throws Exception { - try{ - vnfAdapterRestV2.updateVfModule("vnfid", "moduleid", "mode", new UpdateVfModuleRequest()); - } - catch(Exception ex) - { // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = NullPointerException.class) - public void rollbackVfModuleNullPointerException() throws Exception { - try{ - - vnfAdapterRestV2.rollbackVfModule("vnfid", "moduleid", new RollbackVfModuleRequest()); - } - catch(Exception ex) - { - // EXCEPTION EXPECTED - assert(true); - } - } - - -}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java deleted file mode 100644 index a807aafd24..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.vnf; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.ws.Holder; - -import org.openecomp.mso.adapters.vnf.MsoVnfAdapter; -import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl; -import org.openecomp.mso.openstack.beans.VnfRollback; -import org.openecomp.mso.adapters.vnf.exceptions.VnfException; - -public class VnfCreateTest { - public final static void main (String args[]) - { - MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(); - log ("Got a VnfAdapter"); - - // Web Service Inputs - String cloudId = "MT"; - String tenantName = "John_Test"; - String vnfType = "ApacheDemo"; - String vnfName = "AdapterTest"; - Map<String,String> inputs = new HashMap<>(); - inputs.put("vnf_id", "abc"); - inputs.put("extra", "whocares"); - inputs.put("private_subnet_gateway", "10.4.1.1"); - inputs.put("private_subnet_cidr", "10.4.1.0/29"); - - // Web Service Outputs - Holder<String> vnfId = new Holder<>(); - Holder<Map<String,String>> outputs = new Holder<>(); - Holder<VnfRollback> vnfRollback = new Holder<>(); - - try { - vnfAdapter.createVnf(cloudId, tenantName, vnfType,null, vnfName, null, null, inputs, false, true, null, - vnfId, outputs, vnfRollback); - } catch (VnfException e) { - log ("Got a Create Exception: " + e); - System.exit(1); - } - - log ("Created VNF, ID = " + vnfId.value); - for (String key : outputs.value.keySet()) { - log (" " + key + " = " + outputs.value.get(key)); - } - if (vnfRollback.value != null) - log (vnfRollback.value.toString()); - - try { - Thread.sleep(5000); - } catch (InterruptedException e) {} - - log ("Rolling Back VNF"); - try { - vnfAdapter.rollbackVnf(vnfRollback.value); - } catch (VnfException e) { - log ("Got a Rollback Exception: " + e); - } - log ("VNF Rolled Back"); - } - - private static void log (String msg) { - System.out.println (msg); - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java deleted file mode 100644 index a820202855..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.vnf; - - - -import org.openecomp.mso.adapters.vnf.MsoVnfAdapter; -import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl; -import org.openecomp.mso.adapters.vnf.exceptions.VnfException; - -public class VnfDeleteTest { - public final static void main (String args[]) - { - MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(); - log ("Got a VnfAdapter"); - - // Web Service Inputs - String cloudId = "MT"; - String tenantName = "MSO_Test"; - String vnfName = "AdapterTest"; - - try { - vnfAdapter.deleteVnf(cloudId, tenantName, vnfName, null); - } catch (VnfException e) { - log ("Got an Exception: " + e); - } - - log ("Deleted VNF"); - } - - private static void log (String msg) { - System.out.println (msg); - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java deleted file mode 100644 index aca88f3352..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.vnf; - - -import java.util.Map; - -import javax.xml.ws.Holder; - -import org.openecomp.mso.adapters.vnf.MsoVnfAdapter; -import org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl; -import org.openecomp.mso.openstack.beans.VnfStatus; -import org.openecomp.mso.adapters.vnf.exceptions.VnfException; - -public class VnfQueryTest { - public final static void main (String args[]) - { - MsoVnfAdapter vnfAdapter = new MsoVnfAdapterImpl(); - log ("Got a VnfAdapter"); - - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String,String>> outputs = new Holder<>(); - - try { - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, - vnfExists, vnfId, status, outputs); - } catch (VnfException e) { - log ("Got an Exception: " + e); - } - - if (! vnfExists.value){ - log ("VNF Not Found"); - } else { - log ("Found VNF, ID = " + vnfId.value + ", status=" + status.value); - } - } - - private static void log (String msg) { - System.out.println (msg); - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java deleted file mode 100644 index b353079165..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - SO - * ================================================================================ - * 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. - * 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.adapters.vnf; - -import org.junit.Test; -import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.VolumeGroupRollback; - -public class VolumeAdapterRestV2ExceptionTest { - -//TODO THESE ARE RAINY DAY TESTS, NEED TO WRITE THE SUNNY DAY ONES - VolumeAdapterRestV2 volumeAdapterRestV2 = new VolumeAdapterRestV2(); - - - //@Test(expected = ClassFormatError.class) - public void createVNFVolumesClassFormatError() throws Exception { - try{ - volumeAdapterRestV2.createVNFVolumes("mode", new CreateVolumeGroupRequest()); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = ClassFormatError.class) - public void deleteVNFVolumesClassFormatError() throws Exception { - try{ - volumeAdapterRestV2.deleteVNFVolumes("volumegrpid", "mode", new DeleteVolumeGroupRequest()); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = ClassFormatError.class) - public void rollbackVNFVolumesClassFormatError() throws Exception { - try{ - RollbackVolumeGroupRequest rollbackVolumeGroupRequest = new RollbackVolumeGroupRequest(); - VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback(); - volumeGroupRollback.setVolumeGroupId("grpid"); - rollbackVolumeGroupRequest.setVolumeGroupRollback(volumeGroupRollback); - volumeAdapterRestV2.rollbackVNFVolumes("grpid", rollbackVolumeGroupRequest); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = ClassFormatError.class) - public void updateVNFVolumesClassFormatError() throws Exception { - try{ - volumeAdapterRestV2.updateVNFVolumes("vgid", "mode", new UpdateVolumeGroupRequest()); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - // @Test(expected = NullPointerException.class) - public void queryVNFVolumesNullPointerException() throws Exception { - try{ - volumeAdapterRestV2.queryVNFVolumes("vgid", "cloudid", "tenantid", - "stackid", true, "test", "test", "test"); - } - catch(Exception ex){ - // EXCEPTION EXPECTED - assert(true); - } - } - - - -}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java deleted file mode 100644 index 019ae1e3f9..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 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.vdu.utils; - -import static org.junit.Assert.*; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.openecomp.mso.vdu.utils.VduBlueprint; - -import org.junit.Assert; - -public class VduBlueprintTest { - - private VduBlueprint vduBlueprint; - - private Map<String, byte[]> templateFiles; - private Map<String, byte[]> attachedFiles; - - @Before - public void setUp() { - vduBlueprint = new VduBlueprint(); - } - - @Test - public void testGetVduModelId() { - vduBlueprint.setVduModelId("vduModelId"); - Assert.assertNotNull(vduBlueprint.getVduModelId()); - Assert.assertEquals(vduBlueprint.getVduModelId(), "vduModelId"); - } - - @Test - public void testGetMainTemplateName() { - vduBlueprint.setMainTemplateName("MainTemplateName"); - Assert.assertNotNull(vduBlueprint.getMainTemplateName()); - Assert.assertEquals(vduBlueprint.getMainTemplateName(), "MainTemplateName"); - } - - @Test - public void testGetTemplateFiles() { - byte[] templateFileData = "some template file data".getBytes(); - templateFiles = new HashMap<>(); - templateFiles.put("templateKey1", templateFileData); - vduBlueprint.setTemplateFiles(templateFiles); - Assert.assertNotNull(vduBlueprint.getTemplateFiles()); - Assert.assertTrue(vduBlueprint.getTemplateFiles().containsKey("templateKey1")); - Assert.assertTrue(vduBlueprint.getTemplateFiles().containsValue(templateFileData)); - } - - @Test - public void testGetAttachedFiles() { - byte[] attachedFileData = "some file data".getBytes(); - attachedFiles = new HashMap<>(); - attachedFiles.put("attachedKey1", attachedFileData); - vduBlueprint.setAttachedFiles(attachedFiles); - Assert.assertNotNull(vduBlueprint.getAttachedFiles()); - Assert.assertTrue(vduBlueprint.getAttachedFiles().containsKey("attachedKey1")); - Assert.assertTrue(vduBlueprint.getAttachedFiles().containsValue(attachedFileData)); - } -} diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java deleted file mode 100644 index 98a00033f7..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 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.vdu.utils; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class VduInfoTest { - - private VduInfo vduInfo; - private VduStatus status = VduStatus.NOTFOUND; - private Map<String, Object> outputs; - private Map<String, Object> inputs; - - @Before - public void setUp() { - vduInfo = new VduInfo(); - } - - @Test - public void testGetVnfInstanceId() { - String vnfInstanceId = "vnfInstanceId"; - vduInfo.setVnfInstanceId(vnfInstanceId); - Assert.assertNotNull(vduInfo.getVnfInstanceId()); - Assert.assertEquals(vduInfo.getVnfInstanceId(), "vnfInstanceId"); - } - - @Test - public void testGetVnfInstanceName() { - String vnfInstanceName = "vnfInstanceName"; - vduInfo.setVnfInstanceName(vnfInstanceName); - Assert.assertNotNull(vduInfo.getVnfInstanceName()); - Assert.assertEquals(vduInfo.getVnfInstanceName(), "vnfInstanceName"); - } - - @Test - public void testGetStatus() { - vduInfo.setStatus(status); - Assert.assertNotNull(vduInfo.getStatus()); - Assert.assertEquals(status, vduInfo.getStatus()); - } - - @Test - public void testGetOutputs() { - Object obj = new Object(); - String str = "some text"; - outputs = new HashMap<>(); - outputs.put(str, obj); - vduInfo.setOutputs(outputs); - Assert.assertNotNull(vduInfo.getOutputs()); - Assert.assertTrue(vduInfo.getOutputs().containsKey(str)); - Assert.assertTrue(vduInfo.getOutputs().containsValue(obj)); - } - - @Test - public void testGetInputs() { - Object obj = new Object(); - String str = "some text"; - inputs = new HashMap<>(); - inputs.put(str, obj); - vduInfo.setInputs(inputs); - Assert.assertNotNull(vduInfo.getInputs()); - Assert.assertTrue(vduInfo.getInputs().containsKey(str)); - Assert.assertTrue(vduInfo.getInputs().containsValue(obj)); - } - -} diff --git a/adapters/mso-vnf-adapter/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector b/adapters/mso-vnf-adapter/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector deleted file mode 100644 index 1281d32948..0000000000 --- a/adapters/mso-vnf-adapter/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector +++ /dev/null @@ -1 +0,0 @@ -com.woorea.openstack.connector.HttpClientConnector
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json b/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json deleted file mode 100644 index ff24633f32..0000000000 --- a/adapters/mso-vnf-adapter/src/test/resources/cloud_config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ "cloud_config": { - "identity_services": - { - "MT_KEYSTONE": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "john", - "mso_pass": "FD205490A48D48475607C36B9AD902BF", - "admin_tenant": "admin", - "member_role": "_member_", - "tenant_metadata": false, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "RACKSPACE_APIKEY" - }, - "DAN_KEYSTONE": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "mockId", - "mso_pass": "BC59F80E38208A42ABB81ECCDD4FB3E4", - "admin_tenant": "service", - "member_role": "_member_", - "tenant_metadata": false, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - }, - "MTINJVCC101_DCP": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "mockIdToo", - "mso_pass": "95604B9EAAC4D77D74786FAE54177206", - "admin_tenant": "service", - "member_role": "admin", - "tenant_metadata": true, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - }, - "MTSNJA3DCP1": - { - "identity_url": "https://localhost:5000/v2.0", - "mso_id": "mockIdToo", - "mso_pass": "1491DE07AC9D716A7966BB8C2848F031", - "admin_tenant": "service", - "member_role": "admin", - "tenant_metadata": true, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - }, - "CS_service": {} - - }, - "cloud_sites": - { - "MT": - { - "region_id": "regionOne", - "clli": "MT", - "aic_version": "2.5", - "identity_service_id": "MT_KEYSTONE" - }, - "DAN": - { - "region_id": "RegionOne", - "clli": "DAN", - "aic_version": "2.5", - "identity_service_id": "DAN_KEYSTONE" - }, - "MTINJVCC101": - { - "region_id": "regionTwo", - "clli": "MTINJVCC101", - "aic_version": "2.5", - "identity_service_id": "MTINJVCC101_DCP" - }, - "MTSNJA4LCP1": - { - "region_id": "mtsnjlcp1", - "clli": "MTSNJA4LCP1", - "aic_version": "2.5", - "identity_service_id": "MTSNJA3DCP1" - }, - "CS": - { - "region_id": "clliRegion", - "clli": "CS_clli", - "aic_version": "2.5", - "identity_service_id": "CS_service" - } - } -} -} - - - - diff --git a/adapters/mso-vnf-adapter/src/test/resources/logback-test.xml b/adapters/mso-vnf-adapter/src/test/resources/logback-test.xml deleted file mode 100644 index 238980e0c4..0000000000 --- a/adapters/mso-vnf-adapter/src/test/resources/logback-test.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - ECOMP MSO - ================================================================================ - 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========================================================= - --> - -<configuration > - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern> - </encoder> - </appender> - - - <logger name="com.att.eelf.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.error" level="trace" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <root level="info"> - <appender-ref ref="STDOUT" /> - </root> - - -</configuration> diff --git a/adapters/mso-vnf-adapter/src/test/resources/mso.properties b/adapters/mso-vnf-adapter/src/test/resources/mso.properties deleted file mode 100644 index d58521f1db..0000000000 --- a/adapters/mso-vnf-adapter/src/test/resources/mso.properties +++ /dev/null @@ -1,27 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# 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========================================================= -### - -ecomp.mso.cloud.1.cloudId=MT -ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0 -ecomp.mso.cloud.1.msoId=John -ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF -ecomp.mso.cloud.1.test=1234 -ecomp.mso.cloud.1.boolean=true -ecomp.mso.cloud.1.enum=enum1 |