From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../VfModuleCustomizationToVduMapperTest.java | 158 ++++++ .../VfModuleCustomizationToVduMapperTest.java | 158 ------ .../mso/adapters/vnf/BpelRestClientTest.java | 52 -- .../mso/adapters/vnf/HealthCheckHandlerTest.java | 33 -- .../adapters/vnf/MsoVnfAdapterAsyncImplTest.java | 114 ----- .../mso/adapters/vnf/MsoVnfAdapterImplTest.java | 542 --------------------- .../vnf/MsoVnfCloudifyAdapterImplTest.java | 151 ------ .../adapters/vnf/MsoVnfPluginAdapterImplTest.java | 151 ------ .../org/openecomp/mso/adapters/vnf/QueryTest.java | 121 ----- .../openecomp/mso/adapters/vnf/VfRollbackTest.java | 69 --- .../vnf/VnfAdapterRestV2ExceptionTest.java | 109 ----- .../openecomp/mso/adapters/vnf/VnfCreateTest.java | 87 ---- .../openecomp/mso/adapters/vnf/VnfDeleteTest.java | 52 -- .../openecomp/mso/adapters/vnf/VnfQueryTest.java | 64 --- .../vnf/VolumeAdapterRestV2ExceptionTest.java | 97 ---- .../openecomp/mso/vdu/utils/VduBlueprintTest.java | 81 --- .../org/openecomp/mso/vdu/utils/VduInfoTest.java | 89 ---- 17 files changed, 158 insertions(+), 1970 deletions(-) create mode 100644 adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VfRollbackTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java (limited to 'adapters/mso-vnf-adapter/src/test/java/org') diff --git a/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java new file mode 100644 index 0000000000..c3d9cca0e9 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -0,0 +1,158 @@ +/*- + * ============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.onap.so.adapters.vdu.mapper; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +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; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({CatalogDatabase.class}) +public class VfModuleCustomizationToVduMapperTest { + + private static final String HEAT_TEMPLATE_ARTIFACT_UUID = "testHeatTemplate"; + private static final String VF_MODULE_MODEL_UUID = "vfModuleUuid"; + private static final String HEAT_ENV_ARTIFACT_UUID = "heatEnvArtifactUuid"; + private static final String MAIN_TEMPLATE_NAME = "testTempName"; + private static final String MAIN_TEMPLATE_BODY = "testTempBody"; + private static final String NESTED_TEMPLATE_KEY = "testKey"; + private static final String NESTED_TEMPLATE_VALUE = "nestedTemplateTest"; + private static final String HEAT_FILE_NAME = "heatFileName"; + private static final String HEAT_FILE_BODY = "heatFileBodyTest"; + private static final String HEAT_ENV_NAME = "heatEnvName"; + private static final String HEAT_ENV = "heatEnv"; + private static final String VOL_HEAT_TEMPLATE_ARTIFACT = "volEnvArtifact"; + private static final String VOL_ENV_ARTIFACT_UUID = "volEnvArtifactUuid"; + + private VfModuleCustomizationToVduMapper testedObject; + private CatalogDatabase catalogDatabaseMock; + + @Before + public void init() { + PowerMockito.mockStatic(CatalogDatabase.class); + catalogDatabaseMock = mock(CatalogDatabase.class); + testedObject = new VfModuleCustomizationToVduMapper(); + PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(catalogDatabaseMock); + when(catalogDatabaseMock.getNestedTemplates(HEAT_TEMPLATE_ARTIFACT_UUID)).thenReturn(createNestedTemplates()); + when(catalogDatabaseMock.getHeatFilesForVfModule(VF_MODULE_MODEL_UUID)).thenReturn(createHeatFileMap()); + } + + @Test + public void mapVfModuleCustomizationToVdu_successful() { + when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID)) + .thenReturn(createHeatTemplate()); + when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(HEAT_ENV_ARTIFACT_UUID)) + .thenReturn(createHeatEnvironment()); + VduModelInfo result = testedObject.mapVfModuleCustomizationToVdu(createVfModuleCustomization()); + assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); + } + + @Test + public void mapVfModuleCustVolumeToVdu_successful() { + when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(VOL_HEAT_TEMPLATE_ARTIFACT)) + .thenReturn(createHeatTemplate()); + when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(VOL_ENV_ARTIFACT_UUID)) + .thenReturn(createHeatEnvironment()); + VduModelInfo result = testedObject.mapVfModuleCustVolumeToVdu(createVfModuleCustomization()); + assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); + } + + private VfModuleCustomization createVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + VfModule vfModule = new VfModule(); + vfModule.setHeatTemplateArtifactUUId(HEAT_TEMPLATE_ARTIFACT_UUID); + vfModule.setVolHeatTemplateArtifactUUId(VOL_HEAT_TEMPLATE_ARTIFACT); + vfModuleCustomization.setVfModule(vfModule); + vfModuleCustomization.setVfModuleModelUuid(VF_MODULE_MODEL_UUID); + vfModuleCustomization.setHeatEnvironmentArtifactUuid(HEAT_ENV_ARTIFACT_UUID); + vfModuleCustomization.setVolEnvironmentArtifactUuid(VOL_ENV_ARTIFACT_UUID); + return vfModuleCustomization; + } + + private HeatTemplate createHeatTemplate() { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(MAIN_TEMPLATE_NAME); + heatTemplate.setTemplateBody(MAIN_TEMPLATE_BODY); + heatTemplate.setArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID); + return heatTemplate; + } + + private Map createNestedTemplates() { + Map map = new HashMap<>(); + map.put(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE); + return map; + } + + private Map createHeatFileMap() { + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileName(HEAT_FILE_NAME); + heatFiles.setFileBody(HEAT_FILE_BODY); + Map map = new HashMap<>(); + map.put("heatFileKey", heatFiles); + return map; + } + + private HeatEnvironment createHeatEnvironment() { + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setName(HEAT_ENV_NAME); + heatEnvironment.setEnvironment(HEAT_ENV); + return heatEnvironment; + } + + + private VduArtifact[] createExpectedResultArray() { + VduArtifact[] vduArtifactsArray = new VduArtifact[4]; + vduArtifactsArray[0] = new VduArtifact(MAIN_TEMPLATE_NAME, MAIN_TEMPLATE_BODY.getBytes(), + ArtifactType.MAIN_TEMPLATE); + vduArtifactsArray[1] = new VduArtifact(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE.getBytes(), + ArtifactType.NESTED_TEMPLATE); + vduArtifactsArray[2] = createVduArtifact(HEAT_FILE_NAME, HEAT_FILE_BODY, ArtifactType.TEXT_FILE); + vduArtifactsArray[3] = createVduArtifact(HEAT_ENV_NAME, HEAT_ENV, ArtifactType.ENVIRONMENT); + return vduArtifactsArray; + } + + private VduArtifact createVduArtifact(String name, String content, ArtifactType artifactType) { + VduArtifact vduArtifact = new VduArtifact(); + vduArtifact.setName(name); + vduArtifact.setContent(content.getBytes()); + vduArtifact.setType(artifactType); + return vduArtifact; + } + +} 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/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java deleted file mode 100644 index ffa6bcd961..0000000000 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============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.adapters.vdu.mapper; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -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.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({CatalogDatabase.class}) -public class VfModuleCustomizationToVduMapperTest { - - private static final String HEAT_TEMPLATE_ARTIFACT_UUID = "testHeatTemplate"; - private static final String VF_MODULE_MODEL_UUID = "vfModuleUuid"; - private static final String HEAT_ENV_ARTIFACT_UUID = "heatEnvArtifactUuid"; - private static final String MAIN_TEMPLATE_NAME = "testTempName"; - private static final String MAIN_TEMPLATE_BODY = "testTempBody"; - private static final String NESTED_TEMPLATE_KEY = "testKey"; - private static final String NESTED_TEMPLATE_VALUE = "nestedTemplateTest"; - private static final String HEAT_FILE_NAME = "heatFileName"; - private static final String HEAT_FILE_BODY = "heatFileBodyTest"; - private static final String HEAT_ENV_NAME = "heatEnvName"; - private static final String HEAT_ENV = "heatEnv"; - private static final String VOL_HEAT_TEMPLATE_ARTIFACT = "volEnvArtifact"; - private static final String VOL_ENV_ARTIFACT_UUID = "volEnvArtifactUuid"; - - private VfModuleCustomizationToVduMapper testedObject; - private CatalogDatabase catalogDatabaseMock; - - @Before - public void init() { - PowerMockito.mockStatic(CatalogDatabase.class); - catalogDatabaseMock = mock(CatalogDatabase.class); - testedObject = new VfModuleCustomizationToVduMapper(); - PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(catalogDatabaseMock); - when(catalogDatabaseMock.getNestedTemplates(HEAT_TEMPLATE_ARTIFACT_UUID)).thenReturn(createNestedTemplates()); - when(catalogDatabaseMock.getHeatFilesForVfModule(VF_MODULE_MODEL_UUID)).thenReturn(createHeatFileMap()); - } - - @Test - public void mapVfModuleCustomizationToVdu_successful() { - when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID)) - .thenReturn(createHeatTemplate()); - when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(HEAT_ENV_ARTIFACT_UUID)) - .thenReturn(createHeatEnvironment()); - VduModelInfo result = testedObject.mapVfModuleCustomizationToVdu(createVfModuleCustomization()); - assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); - } - - @Test - public void mapVfModuleCustVolumeToVdu_successful() { - when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(VOL_HEAT_TEMPLATE_ARTIFACT)) - .thenReturn(createHeatTemplate()); - when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(VOL_ENV_ARTIFACT_UUID)) - .thenReturn(createHeatEnvironment()); - VduModelInfo result = testedObject.mapVfModuleCustVolumeToVdu(createVfModuleCustomization()); - assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); - } - - private VfModuleCustomization createVfModuleCustomization() { - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - VfModule vfModule = new VfModule(); - vfModule.setHeatTemplateArtifactUUId(HEAT_TEMPLATE_ARTIFACT_UUID); - vfModule.setVolHeatTemplateArtifactUUId(VOL_HEAT_TEMPLATE_ARTIFACT); - vfModuleCustomization.setVfModule(vfModule); - vfModuleCustomization.setVfModuleModelUuid(VF_MODULE_MODEL_UUID); - vfModuleCustomization.setHeatEnvironmentArtifactUuid(HEAT_ENV_ARTIFACT_UUID); - vfModuleCustomization.setVolEnvironmentArtifactUuid(VOL_ENV_ARTIFACT_UUID); - return vfModuleCustomization; - } - - private HeatTemplate createHeatTemplate() { - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setTemplateName(MAIN_TEMPLATE_NAME); - heatTemplate.setTemplateBody(MAIN_TEMPLATE_BODY); - heatTemplate.setArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID); - return heatTemplate; - } - - private Map createNestedTemplates() { - Map map = new HashMap<>(); - map.put(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE); - return map; - } - - private Map createHeatFileMap() { - HeatFiles heatFiles = new HeatFiles(); - heatFiles.setFileName(HEAT_FILE_NAME); - heatFiles.setFileBody(HEAT_FILE_BODY); - Map map = new HashMap<>(); - map.put("heatFileKey", heatFiles); - return map; - } - - private HeatEnvironment createHeatEnvironment() { - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setName(HEAT_ENV_NAME); - heatEnvironment.setEnvironment(HEAT_ENV); - return heatEnvironment; - } - - - private VduArtifact[] createExpectedResultArray() { - VduArtifact[] vduArtifactsArray = new VduArtifact[4]; - vduArtifactsArray[0] = new VduArtifact(MAIN_TEMPLATE_NAME, MAIN_TEMPLATE_BODY.getBytes(), - ArtifactType.MAIN_TEMPLATE); - vduArtifactsArray[1] = new VduArtifact(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE.getBytes(), - ArtifactType.NESTED_TEMPLATE); - vduArtifactsArray[2] = createVduArtifact(HEAT_FILE_NAME, HEAT_FILE_BODY, ArtifactType.TEXT_FILE); - vduArtifactsArray[3] = createVduArtifact(HEAT_ENV_NAME, HEAT_ENV, ArtifactType.ENVIRONMENT); - return vduArtifactsArray; - } - - private VduArtifact createVduArtifact(String name, String content, ArtifactType artifactType) { - VduArtifact vduArtifact = new VduArtifact(); - vduArtifact.setName(name); - vduArtifact.setContent(content.getBytes()); - vduArtifact.setType(artifactType); - return vduArtifact; - } - -} 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 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 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 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 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 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 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 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 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 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 map = new HashMap<>(); - map.put("key1", "value1"); - Map 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 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 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 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 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 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 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 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 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 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 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 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 map = new HashMap<>(); - map.put("key1", "value1"); - Map 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 map = new HashMap<>(); - map.put("key1", "value1"); - Map stackOutputs = new HashMap<>(); - LinkedHashMap 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 map = new HashMap<>(); - map.put("key1", "value1"); - Map 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 map = new HashMap<>(); - map.put("key1", "value1"); - Map stackOutputs = new HashMap<>(); - List 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 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 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 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 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 vnfExists = new Holder<>(); - Holder vnfId = new Holder<>(); - Holder status = new Holder<>(); - Holder> 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 vnfExists = new Holder<>(); - Holder vnfId = new Holder<>(); - Holder status = new Holder<>(); - Holder> 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 vnfExists = new Holder<>(); - Holder vnfId = new Holder<>(); - Holder status = new Holder<>(); - Holder> 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 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 vnfId = new Holder<>(); - Holder> outputs = new Holder<>(); - Holder 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 vnfExists = new Holder<>(); - Holder vnfId = new Holder<>(); - Holder status = new Holder<>(); - Holder> 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 templateFiles; - private Map 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 outputs; - private Map 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)); - } - -} -- cgit 1.2.3-korg