diff options
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/mso')
4 files changed, 105 insertions, 152 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 207e63579..4ddbc0f41 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -21,82 +21,77 @@ package org.onap.vid.mso; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.tuple; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.hasEntry; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.ArgumentMatchers.endsWith; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.onap.vid.controller.MsoController.CONFIGURATION_ID; +import static org.onap.vid.controller.MsoController.REQUEST_TYPE; +import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID; +import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID; +import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath; + import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import com.google.gson.Gson; import io.joshworks.restclient.http.HttpResponse; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.ws.rs.BadRequestException; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.NotNull; -import org.mockito.hamcrest.MockitoHamcrest; -import org.onap.vid.changeManagement.WorkflowRequestDetail; -import org.onap.vid.model.SOWorkflowList; -import org.onap.vid.model.probes.ExternalComponentStatus; -import org.onap.vid.mso.rest.RequestList; -import org.onap.vid.mso.rest.RequestWrapper; -import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import org.mockito.ArgumentMatcher; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.mockito.hamcrest.MockitoHamcrest; import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.changeManagement.ChangeManagementRequest; +import org.onap.vid.changeManagement.WorkflowRequestDetail; import org.onap.vid.controller.OperationalEnvironmentController; import org.onap.vid.exceptions.GenericUncheckedException; -import org.onap.vid.model.RequestReferencesContainer; +import org.onap.vid.model.SOWorkflowList; import org.onap.vid.model.SoftDeleteRequest; +import org.onap.vid.model.probes.ExternalComponentStatus; import org.onap.vid.mso.model.CloudConfiguration; import org.onap.vid.mso.model.ModelInfo; import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo; import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo; import org.onap.vid.mso.model.RequestInfo; import org.onap.vid.mso.model.RequestParameters; -import org.onap.vid.mso.model.RequestReferences; import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails; import org.onap.vid.mso.rest.Request; import org.onap.vid.mso.rest.RequestDetails; import org.onap.vid.mso.rest.RequestDetailsWrapper; +import org.onap.vid.mso.rest.RequestList; +import org.onap.vid.mso.rest.RequestWrapper; import org.onap.vid.mso.rest.Task; -import org.onap.vid.properties.Features; import org.springframework.http.HttpStatus; import org.springframework.test.context.ContextConfiguration; -import org.togglz.core.manager.FeatureManager; - -import javax.ws.rs.BadRequestException; -import java.io.IOException; -import java.net.URL; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.hasEntry; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.argThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.ArgumentMatchers.endsWith; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.onap.vid.controller.MsoController.CONFIGURATION_ID; -import static org.onap.vid.controller.MsoController.REQUEST_TYPE; -import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID; -import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID; -import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; @ContextConfiguration(classes = {SystemProperties.class}) public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { @@ -104,9 +99,6 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { private static final ObjectMapper objectMapper = new ObjectMapper(); @Mock - private FeatureManager featureManager; - - @Mock private MsoInterface msoInterface; @Mock @@ -126,7 +118,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { @BeforeClass public void setUp() { MockitoAnnotations.initMocks(this); - msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface, featureManager); + msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface); } @Test @@ -282,39 +274,48 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { assertThat(response).isEqualToComparingFieldByField(expectedResponse); } - @Test - public void shouldProperlyDeleteSvcInstanceWithProperParametersAndFalseFeatureFlag() { + @DataProvider + public Object[][] deleteSvcInstanceShouldDelete() { + return new Object[][]{{"Active"}, {"unexpected-status"}}; + } + + @DataProvider + public Object[][] deleteSvcInstanceShouldUnassign() { + return new Object[][]{{"Created"}, {"Pendingdelete"}, {"pending-Delete"}, {"Assigned"}}; + } + + + @Test(dataProvider = "deleteSvcInstanceShouldDelete") + public void shouldProperlyDeleteSvcInstanceWithProperParametersShouldDelete(String status) { // given - String endpointTemplate = "/serviceInstances/v5/%s"; + String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s"; String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; String svcEndpoint = String.format(endpointTemplate, serviceInstanceId); RequestDetails requestDetails = new RequestDetails(); MsoResponseWrapper expectedResponse = createOkResponse(); given(msoInterface.deleteSvcInstance(requestDetails, svcEndpoint)).willReturn(expectedResponse); - given(featureManager.isActive(Features.FLAG_UNASSIGN_SERVICE)).willReturn(false); // when MsoResponseWrapper msoResponseWrapper = msoBusinessLogic - .deleteSvcInstance(requestDetails, serviceInstanceId, "unAssignOrDeleteParams"); + .deleteSvcInstance(requestDetails, serviceInstanceId, status); // then assertThat(msoResponseWrapper).isEqualToComparingFieldByField(expectedResponse); } - @Test - public void shouldProperlyDeleteSvcInstanceWithProperParametersAndTrueFeatureFlag() { + @Test(dataProvider = "deleteSvcInstanceShouldUnassign") + public void shouldProperlyDeleteSvcInstanceWithProperParametersShouldUnassign(String status) { // given - String endpointTemplate = "/serviceInstantiation/v5/serviceInstances/%s/unassign"; + String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/unassign"; String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; String svcEndpoint = String.format(endpointTemplate, serviceInstanceId); RequestDetails requestDetails = new RequestDetails(); MsoResponseWrapper expectedResponse = createOkResponse(); given(msoInterface.unassignSvcInstance(requestDetails, svcEndpoint)).willReturn(expectedResponse); - given(featureManager.isActive(Features.FLAG_UNASSIGN_SERVICE)).willReturn(true); // when MsoResponseWrapper msoResponseWrapper = msoBusinessLogic - .deleteSvcInstance(requestDetails, serviceInstanceId, "assigned"); + .deleteSvcInstance(requestDetails, serviceInstanceId, status); // then assertThat(msoResponseWrapper).isEqualToComparingFieldByField(expectedResponse); @@ -323,7 +324,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { @Test public void shouldProperlyDeleteVnfWithProperParameters() { // when - String endpointTemplate = "/serviceInstances/v5/%s/vnfs/%s"; + String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s"; String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; String vnfInstanceId = "testVnfInstanceTempId"; String vnfEndpoint = String.format(endpointTemplate, serviceInstanceId, vnfInstanceId); @@ -342,7 +343,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { @Test public void shouldProperlyDeleteVfModuleWithProperParameters() { // when - String endpointTemplate = "/serviceInstances/v7/%s/vnfs/%s/vfModules/%s"; + String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s/vfModules/%s"; String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d"; String vnfInstanceId = "testVnfInstanceTempId"; String vfModuleId = "testVfModuleId"; @@ -906,58 +907,6 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { } @Test - public void shouldProperlyDeactivateAndCloudDeleteWithProperParameters() { - // given - String serviceInstanceId = "testServiceId"; - String vnfInstanceId = "testVnfInstanceId"; - String vfModuleInstanceId = "testVfModuleInstanceId"; - RequestDetails requestDetails = new RequestDetails(); - - String path = msoBusinessLogic.getDeactivateAndCloudDeletePath(serviceInstanceId, vnfInstanceId, vfModuleInstanceId); - - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("testInstance"); - requestReferences.setRequestId("testRequest"); - - HttpResponse<RequestReferencesContainer> expectedResponse = HttpResponse.fallback(new RequestReferencesContainer(requestReferences)); - - MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse); - - given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse); - - // when - MsoResponseWrapper2 response = msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails); - - // then - assertThat(response).isEqualToComparingFieldByField(responseWrapped); - } - - @Test - public void shouldProperlyActivateFabricConfigurationWithProperParameters() { - // given - String serviceInstanceId = "testServiceId"; - RequestDetails requestDetails = new RequestDetails(); - - String path = msoBusinessLogic.getActivateFabricConfigurationPath(serviceInstanceId); - - RequestReferences requestReferences = new RequestReferences(); - requestReferences.setInstanceId("testInstance"); - requestReferences.setRequestId("testRequest"); - - HttpResponse<RequestReferencesContainer> expectedResponse = HttpResponse.fallback(new RequestReferencesContainer(requestReferences)); - - MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse); - - given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse); - - // when - MsoResponseWrapper2 response = msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails); - - // then - assertThat(response).isEqualToComparingFieldByField(responseWrapped); - } - - @Test public void shouldProperlyUpdateVnfSoftwareWithProperParameters() { // given String serviceInstanceId = "testServiceId"; diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java index 891192c75..0ea5f2947 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java @@ -25,6 +25,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableListMultimap; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; @@ -40,17 +47,9 @@ import org.skyscreamer.jsonassert.JSONCompareMode; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import java.io.IOException; -import java.net.URL; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - public class MsoOperationalEnvironmentTest { - private MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogicImpl(null,null); + private MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogicImpl(null); private static final Logger logger = LogManager.getLogger(MsoOperationalEnvironmentTest.class); @Test(dataProvider = "getOperationalEnvironmentActivationPermutations") diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java index d4abfae38..6cf7d487e 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java @@ -38,8 +38,8 @@ import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Properties; import java.util.UUID; +import org.apache.commons.configuration.PropertiesConfiguration; import org.glassfish.grizzly.http.util.HttpStatus; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -61,7 +61,7 @@ public class MsoRestClientNewTest { private static StubServer server; private static StubServer securedServer; - private static Properties props = new Properties(); + private static PropertiesConfiguration props = new PropertiesConfiguration(); private static String msoCreateServiceInstanceJson; private static String msoScaleOutVfModule; private final static String CREATE_INSTANCE_RESPONSE_STR = @@ -76,7 +76,7 @@ public class MsoRestClientNewTest { @BeforeClass - public static void start() throws IOException { + public static void start() throws Exception { server = new StubServer().run(); securedServer = new StubServer().secured().run(); @@ -109,7 +109,7 @@ public class MsoRestClientNewTest { @Test public void testCreateSvcInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_CONFIGURATIONS); + String endpoint = props.getString(MsoProperties.MSO_REST_API_CONFIGURATIONS); endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( server, @@ -122,7 +122,7 @@ public class MsoRestClientNewTest { @Test public void testCreateVnf() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VNF_INSTANCE); endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( server, @@ -136,7 +136,7 @@ public class MsoRestClientNewTest { @Test public void testCreateNwInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); String nw_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( server, @@ -149,7 +149,7 @@ public class MsoRestClientNewTest { @Test public void testCreateVolumeGroupInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); String vnf_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); vnf_endpoint = vnf_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( @@ -163,7 +163,7 @@ public class MsoRestClientNewTest { @Test public void testCreateVfModuleInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); String partial_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String vf_module_endpoint = partial_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); @@ -195,7 +195,7 @@ public class MsoRestClientNewTest { @Ignore @Test public void testDeleteSvcInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE); endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); @@ -211,7 +211,7 @@ public class MsoRestClientNewTest { @Ignore @Test public void testDeleteVnf() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VNF_INSTANCE); endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( @@ -226,7 +226,7 @@ public class MsoRestClientNewTest { @Ignore @Test public void testDeleteVfModule() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); String part_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String vf_modules_endpoint = part_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); String delete_vf_endpoint = vf_modules_endpoint + '/' + SAMPLE_VNF_MODULE_ID; @@ -243,7 +243,7 @@ public class MsoRestClientNewTest { @Ignore @Test public void testDeleteVolumeGroupInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String vnf_endpoint = svc_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); String delete_volume_group_endpoint = vnf_endpoint + "/" + SAMPLE_VNF_MODULE_ID; @@ -260,7 +260,7 @@ public class MsoRestClientNewTest { @Ignore @Test public void testDeleteNwInstance() throws Exception { - String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); + String endpoint = props.getString(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String delete_nw_endpoint = svc_endpoint + "/" + SAMPLE_NETWORK_INSTANCE_ID; @@ -275,7 +275,7 @@ public class MsoRestClientNewTest { @Test public void testGetOrchestrationRequest() { - String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ); + String p = props.getString(MsoProperties.MSO_REST_API_GET_ORC_REQ); String path = p + "/" + SAMPLE_REQUEST_ID; try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( @@ -289,7 +289,7 @@ public class MsoRestClientNewTest { @Test public void testGetManualTasksByRequestId() { - String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ); + String p = props.getString(MsoProperties.MSO_REST_API_GET_ORC_REQ); String path = p + "/" + UUID.randomUUID(); String validResponse = "" + "{ " @@ -376,7 +376,7 @@ public class MsoRestClientNewTest { @Test public void testSetConfigurationActiveStatus() throws Exception { - String endpoint = "/serviceInstances/v5/<service_instance_id>/configurations/<configuration_id>"; + String endpoint = "/serviceInstances/v7/<service_instance_id>/configurations/<configuration_id>"; endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); endpoint = endpoint.replace(MsoController.CONFIGURATION_ID, SAMPLE_CONFIGURATION_ID); endpoint = endpoint + "/activate"; @@ -448,7 +448,7 @@ public class MsoRestClientNewTest { @Test public void testRemoveRelationshipFromServiceInstance() throws Exception { - String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE); + String serviceEndpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE); String removeRelationshipsPath = serviceEndpoint + "/" + SERVICE_INSTANCE_ID + "/removeRelationships"; try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( @@ -476,7 +476,7 @@ public class MsoRestClientNewTest { } @Test public void testScaleOutVfModule() throws IOException { - String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT); + String serviceEndpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT); String partial_endpoint = serviceEndpoint.replaceFirst(SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java index 575ceab7c..7f30b0f2d 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java @@ -20,23 +20,24 @@ package org.onap.vid.mso.rest; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.testng.AssertJUnit.assertEquals; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; import org.assertj.core.api.AssertionsForClassTypes; import org.onap.vid.exceptions.NotFoundException; +import org.onap.vid.testUtils.TestUtils; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.testng.AssertJUnit.assertEquals; - public class RequestDetailsTest { @@ -48,6 +49,10 @@ public class RequestDetailsTest { private static final ImmutableList<String> LCP_CLOUD_REGION_ID_PATH = ImmutableList.of("requestDetails", "cloudConfiguration", "lcpCloudRegionId"); + @BeforeClass + public static void registerValueGenerator() { + TestUtils.registerCloudConfigurationValueGenerator(); + } @BeforeMethod public void setUp() { |