diff options
Diffstat (limited to 'vid-automation/src/test/java/org')
16 files changed, 330 insertions, 233 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index 952aa522d..b7c6e0e46 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -1,44 +1,15 @@ package org.onap.vid.api; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofL3Network; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofServiceInstance; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofVlanTag; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.ofVnf; -import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPortalPresetsUtils.getEcompPortalPresets; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; -import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; - +import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.util.UUID; import net.javacrumbs.jsonunit.JsonAssert; import net.javacrumbs.jsonunit.core.Configuration; import net.javacrumbs.jsonunit.core.Option; import org.apache.commons.text.StringEscapeUtils; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIBadBodyForGetServicesGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegion; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionInvalidRequest; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetInstanceGroupsByCloudRegionRequiredMissing; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetails; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsInvalidRequest; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkCollectionDetailsRequiredMissing; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePortsError; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetRelatedInstanceGroupsByVnfId; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet; +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; +import org.onap.simulator.presetGenerator.presets.aai.*; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import org.onap.vid.model.aai.AaiResponse; @@ -58,6 +29,24 @@ import vid.automation.test.infra.Features; import vid.automation.test.services.SimulatorApi; import vid.automation.test.utils.TestHelper; +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.util.List; +import java.util.UUID; + +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.*; +import static org.onap.simulator.presetGenerator.presets.ecompportal_att.EcompPortalPresetsUtils.getEcompPortalPresets; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.utils.TestHelper.GET_SERVICE_MODELS_BY_DISTRIBUTION_STATUS; + public class AaiApiTest extends BaseApiAaiTest { private static final String AAI_HOMING_DATA_RESPONSE = "viewEdit/aaiHomingDataResponse.json"; @@ -217,6 +206,7 @@ public class AaiApiTest extends BaseApiAaiTest { " }],\n" + " \"readOnly\": false\n" + "}"; + private static final String AAI_GET_ACTIVE_NETWORKS = "/aai_get_active_networks"; private String getGetOperationEnvironmentsUri() { return uri.toASCIIString() + "/get_operational_environments"; @@ -270,7 +260,7 @@ public class AaiApiTest extends BaseApiAaiTest { AaiResponse<OperationalEnvironmentList> response = loginAndDoGetWithUrl(url); assertEquals(HttpStatus.OK.value(), response.getHttpCode()); OperationalEnvironmentList list = response.getT(); - assertNotEquals(null, list.getOperationalEnvironment()); + assertNotNull(list.getOperationalEnvironment()); assertEquals(2, list.getOperationalEnvironment().size()); assertEquals(uuidOfOperationalEnvironment, list.getOperationalEnvironment().get(0).getOperationalEnvironmentId()); assertEquals(1, list.getOperationalEnvironment().get(0).getRelationshipList().getRelationship().size()); @@ -681,12 +671,14 @@ public class AaiApiTest extends BaseApiAaiTest { ImmutableMultimap.of("vlan-tag", vlanTagPreset3.getReqPath(), "vlan-tag", vlanTagPreset4.getReqPath()), "Created"); PresetAAIStandardQueryGet vnfPreset1 = ofVnf("c015cc0f-0f37-4488-aabf-53795fd93cd3", - ImmutableMultimap.of("l3-network", l3NetworkPreset1.getReqPath() , "l3-network", l3NetworkPreset2.getReqPath())); + ImmutableMultimap.of("l3-network", l3NetworkPreset1.getReqPath() , "l3-network", l3NetworkPreset2.getReqPath()), + defaultPlacement()); PresetAAIStandardQueryGet l3NetworkPreset3 = ofL3Network("12aa7f3d-2bc2-48f5-aaf8-418520c54330","XXXYYYZZZ", "Network", ImmutableMultimap.of("vlan-tag", vlanTagPreset5.getReqPath(), "vlan-tag", vlanTagPreset6.getReqPath()), "Created"); - PresetAAIStandardQueryGet vnfPreset2 = ofVnf("c55da606-cf38-42c7-bc3c-be8e23b19299", ImmutableMultimap.of("l3-network", l3NetworkPreset3.getReqPath())); + PresetAAIStandardQueryGet vnfPreset2 = ofVnf("c55da606-cf38-42c7-bc3c-be8e23b19299", ImmutableMultimap.of("l3-network", l3NetworkPreset3.getReqPath()), + defaultPlacement()); PresetAAIStandardQueryGet serviceInstance = ofServiceInstance("9cdd1b2a-43a7-47bc-a88e-759ba2399f0b", "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "6e59c5de-f052-46fa-aa7e-2fca9d674c44", globalCustomerId, serviceType, @@ -716,7 +708,7 @@ public class AaiApiTest extends BaseApiAaiTest { SimulatorApi.registerExpectation(AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON, APPEND); - String url = uri + "/get_vnf_data_by_globalid_and_service_type/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/vFlowLogic"; + String url = uri + "/get_vnf_data_by_globalid_and_service_type/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/vRichardson"; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); //reduced_vnf_data_by_globalid_and_service_type.json @@ -727,6 +719,58 @@ public class AaiApiTest extends BaseApiAaiTest { } + @Test + public void getVpnList() { + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetVpnsByType(), CLEAR_THEN_SET); + String url = uri + "/aai_get_vpn_list"; + ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); + String expected = getResourceAsString("viewEdit/aaiGetVpnList.json"); + assertThat(response.getBody(), jsonEquals(expected).when(Option.IGNORING_ARRAY_ORDER).when(Option.IGNORING_EXTRA_FIELDS)); + } + + @DataProvider + public static Object[][] getActiveNetworkAaiStates() { + return new Object[][] { + {1, "viewEdit/aaiGetActiveNetworks.json"}, + {2, "viewEdit/aaiGetActiveNetworks2.json"} + }; + } + + @Test(dataProvider = "getActiveNetworkAaiStates") + public void getActiveNetworks_givenSpecificAAIState_cypressPresetMatch(int state, String expectedResultFileName) { + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + new PresetAAIGetL3NetworksByCloudRegionSpecificState(state), + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AUK51A_TO_ATT_NC + ), CLEAR_THEN_SET); + String url = uri + AAI_GET_ACTIVE_NETWORKS + + "?cloudRegion=" + AAIBaseGetL3NetworksByCloudRegionPreset.DEFAULT_CLOUD_REGION_ID + + "&tenantId=" + AAIBaseGetL3NetworksByCloudRegionPreset.DEFAULT_TENANT_ID; + String response = restTemplate.getForObject(url, String.class); + System.out.println("response = " + response); + String expected = getResourceAsString(expectedResultFileName); + assertThat(response, jsonEquals(expected)); + } + + @Test + public void getActiveNetworks() throws JsonProcessingException { + String networkRole = "Some role"; + PresetAAIGetL3NetworksByCloudRegion presetAAIGetL3NetworksByCloudRegion = new PresetAAIGetL3NetworksByCloudRegion(networkRole); + List<BasePreset> presets = ImmutableList.of( + presetAAIGetL3NetworksByCloudRegion, + PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AUK51A_TO_ATT_NC + ); + SimulatorApi.registerExpectationFromPresets(presets, CLEAR_THEN_SET); + String url = uri + AAI_GET_ACTIVE_NETWORKS + + "?cloudRegion=" + presetAAIGetL3NetworksByCloudRegion.getCloudRegionId() + + "&tenantId=" + presetAAIGetL3NetworksByCloudRegion.getTenantId() + + "&networkRole=" + networkRole; + ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); + + assertResponse(JsonAssert.when(Option.IGNORING_EXTRA_FIELDS, Option.IGNORING_ARRAY_ORDER), + presetAAIGetL3NetworksByCloudRegion.getActiveNetworksWithNameAndRelatedToVpnBindingAsJsonString(), + response.getBody()); + } + private void assertResponse(Object expected, String response) { assertResponse(Configuration.empty(), expected, response); } diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java index 539e857c9..1a93a23d0 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java @@ -1,39 +1,12 @@ package org.onap.vid.api; -import static java.util.Collections.emptyMap; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_INSTANCE_ID; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; - import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember; +import org.onap.simulator.presetGenerator.presets.mso.*; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseDelete; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarteCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteServiceCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleALaCarteCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteCypress2; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfGroup; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteALaCarteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceGroup; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import org.onap.vid.model.asyncInstantiation.JobAuditStatus; @@ -51,7 +24,22 @@ import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.SimulatorApi; import vid.automation.test.services.SimulatorApi.RegistrationStrategy; -@FeatureTogglingTest({Features.FLAG_ASYNC_JOBS, Features.FLAG_ASYNC_INSTANTIATION, Features.FLAG_ASYNC_ALACARTE_VNF}) +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static java.util.Collections.emptyMap; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_INSTANCE_ID; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; + +@FeatureTogglingTest({Features.FLAG_ASYNC_ALACARTE_VNF}) public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { private static final String CREATE_BULK_OF_ALACARTE_REQUEST = "asyncInstantiation/vidRequestCreateALaCarte.json"; @@ -484,12 +472,12 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { } private void assertServiceInfoSpecific2(String jobId, JobStatus jobStatus, String serviceInstanceName, ServiceAction serviceAction) { - assertExpectedStatusAndServiceInfo(jobStatus, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(jobStatus, jobId, PATIENCE_LEVEL.FAIL_VERY_SLOW, new ServiceInfo( "us16807000", jobStatus, false, "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", "JAG1", null, "092eb9e8e4b7412e8787dd091bc58e86", null, - "JANET25", null, + "AAIAIC25", null, "TYLER SILVIA", null, null, serviceInstanceName, "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "action-data", "1.0", @@ -498,7 +486,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { } private void assertServiceInfoSpecificDeletion(String jobId, JobStatus jobStatus, String serviceInstanceName, String serviceType) { - assertExpectedStatusAndServiceInfo(jobStatus, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(jobStatus, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", jobStatus, false, null, null, null, null, null, @@ -512,7 +500,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { } private void assertServiceInfoSpecificUpdate(String jobId, JobStatus jobStatus, String serviceInstanceName) { - assertExpectedStatusAndServiceInfo(jobStatus, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(jobStatus, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", jobStatus, false, null, null, null, null, null, diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest2.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest2.java index 54f2cc66f..b38d3da91 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest2.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest2.java @@ -1,34 +1,13 @@ package org.onap.vid.api; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; - import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.UUID; import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseDelete; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2ErrorResponse; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteALaCarteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGetErrorResponse; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGetByRequestId; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGetByServiceInstanceId; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; +import org.onap.simulator.presetGenerator.presets.mso.*; import org.onap.vid.model.asyncInstantiation.JobAuditStatus; import org.onap.vid.model.asyncInstantiation.JobAuditStatus.SourceStatus; import org.onap.vid.model.asyncInstantiation.ServiceInfo; @@ -43,7 +22,22 @@ import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.SimulatorApi; import vid.automation.test.services.SimulatorApi.RegistrationStrategy; -@FeatureTogglingTest({Features.FLAG_ASYNC_JOBS, Features.FLAG_ASYNC_INSTANTIATION, Features.FLAG_ASYNC_ALACARTE_VNF}) +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; + +@FeatureTogglingTest({Features.FLAG_ASYNC_ALACARTE_VNF}) public class AsyncInstantiationALaCarteApiTest2 extends AsyncInstantiationBase { private static final String CREATE_BULK_OF_ALACARTE_MULTIPLE_VNF_NETWORK_REQUEST_CYPRESS = "a-la-carte/redux-multiple-vnf-network.json"; @@ -190,7 +184,7 @@ public class AsyncInstantiationALaCarteApiTest2 extends AsyncInstantiationBase { } private void assertServiceInfoSpecificDeletion(String jobId, JobStatus jobStatus, String serviceInstanceName, String serviceType) { - assertExpectedStatusAndServiceInfo(jobStatus, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(jobStatus, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", jobStatus, false, null, null, null, null, null, diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java index eed6ee90b..12ad325d5 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java @@ -1,50 +1,15 @@ package org.onap.vid.api; -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.RELATED_VNF1_ACTION; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.RELATED_VNF2_ACTION; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.VNF_GROUP1_ACTION; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; - import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Function; import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAISearchNodeQueryNonEmptyResult; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember; +import org.onap.simulator.presetGenerator.presets.mso.*; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarteServiceCypress2; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceMultipleVnfsServiceCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteServiceCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteServiceCypress2; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfGroup; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteBaseVfModuleCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetworkAlaCarteCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModuleCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnfAlaCarteCypress; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import org.onap.vid.model.asyncInstantiation.JobAuditStatus; @@ -61,7 +26,25 @@ import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.SimulatorApi; import vid.automation.test.services.SimulatorApi.RegistrationStrategy; -@FeatureTogglingTest({Features.FLAG_ASYNC_JOBS, Features.FLAG_ASYNC_INSTANTIATION, Features.FLAG_ASYNC_ALACARTE_VNF}) +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.function.Function; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.*; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; + +@FeatureTogglingTest({Features.FLAG_ASYNC_ALACARTE_VNF}) public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { private static final String CREATE_BULK_OF_ALACARTE_REQUEST = "asyncInstantiation/vidRequestCreateALaCarte.json"; @@ -385,12 +368,12 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { assertThat(uuids, hasSize(1)); String jobId = uuids.get(0); - assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", JobStatus.COMPLETED, false, "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", "JAG1", "YUDFJULP-JAG1", "092eb9e8e4b7412e8787dd091bc58e86", "USP-SIP-IC-24335-T-01", - "JANET25", null, + "AAIAIC25", null, "TYLER SILVIA", null, null, "InstanceName", "6b528779-44a3-4472-bdff-9cd15ec93450", "action-data", "1.0", @@ -417,12 +400,12 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { assertThat(uuids, hasSize(1)); String jobId = uuids.get(0); - assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", JobStatus.COMPLETED, false, "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", "JAG1", "YUDFJULP-JAG1", "092eb9e8e4b7412e8787dd091bc58e86", "USP-SIP-IC-24335-T-01", - "JANET25", null, + "AAIAIC25", null, "TYLER SILVIA", null, null, "InstanceName", "6b528779-44a3-4472-bdff-9cd15ec93450", "action-data", "1.0", @@ -460,7 +443,7 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { assertThat(uuids, hasSize(1)); String jobId = uuids.get(0); - assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", JobStatus.COMPLETED, false, "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", "NFT1", "NFTJSSSS-NFT1", @@ -492,7 +475,7 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { assertThat(uuids, hasSize(1)); String jobId = uuids.get(0); - assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", JobStatus.COMPLETED, false, "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", "NFT1", "NFTJSSSS-NFT1", @@ -549,7 +532,7 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase { } private void assertServiceInfoSpecific3(String jobId, JobStatus jobStatus, String serviceInstanceName) { - assertExpectedStatusAndServiceInfo(jobStatus, jobId, true, new ServiceInfo( + assertExpectedStatusAndServiceInfo(jobStatus, jobId, PATIENCE_LEVEL.FAIL_SLOW, new ServiceInfo( "us16807000", jobStatus, false, "aaa1", "aaa1", "yyy1", "YYY1", "UUUAIAAI-YYY1", diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java index 5c4d8a876..1f0b0f3aa 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationMacroApiTest.java @@ -1,11 +1,13 @@ package org.onap.vid.api; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import net.bytebuddy.utility.RandomString; import net.javacrumbs.jsonunit.JsonAssert; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.hamcrest.collection.IsCollectionWithSize; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; @@ -21,9 +23,9 @@ import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.infra.FeatureTogglingTest; -import vid.automation.test.infra.Features; import vid.automation.test.infra.Wait; import vid.automation.test.model.JobStatus; +import vid.automation.test.model.ServiceAction; import vid.automation.test.services.SimulatorApi; import java.util.*; @@ -35,15 +37,16 @@ import static java.util.stream.Collectors.*; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; import static vid.automation.test.infra.Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection; -@FeatureTogglingTest({Features.FLAG_ASYNC_JOBS, Features.FLAG_ASYNC_INSTANTIATION}) -public class AsyncInstantiationApiTest extends AsyncInstantiationBase { - private static final Logger logger = LogManager.getLogger(AsyncInstantiationApiTest.class); +public class AsyncInstantiationMacroApiTest extends AsyncInstantiationBase { + private static final Logger logger = LogManager.getLogger(AsyncInstantiationMacroApiTest.class); private static final String MSO_BASE_ERROR = "Received error from SDN-C: java.lang.IllegalArgumentException: All keys must be specified for class org."+ @@ -55,6 +58,8 @@ public class AsyncInstantiationApiTest extends AsyncInstantiationBase { private static final String INSTANCE_GROUP_LABEL = "instanceGroup"; + private static final String DELETE_MACRO_SERVICE_FILE_NAME = "asyncInstantiation/vidRequestDeleteMacroService.json"; + @Test public void createBulkOfCreateInstances(){ Map<Keys, String> names = generateNames(); @@ -352,7 +357,7 @@ public class AsyncInstantiationApiTest extends AsyncInstantiationBase { @Test(dataProvider = "macroAndALaCarteBulk", expectedExceptions = HttpClientErrorException.class) @FeatureTogglingTest(FLAG_1906_INSTANTIATION_API_USER_VALIDATION) public void verifyCreateBulkOfInstancesUserPermissionValidation(String requestDetailsFileName) { - login(new UserCredentials("mo57174000", "mo57174000", null, null, null)); + login(new UserCredentials("em1536000", "em1536000", null, null, null)); try { createBulkOfInstances(false, 1, Collections.EMPTY_MAP, requestDetailsFileName); } catch (HttpClientErrorException e){ @@ -365,4 +370,31 @@ public class AsyncInstantiationApiTest extends AsyncInstantiationBase { } + @Test + public void deleteMacroService_getAuditStatus_verifyCompleted() { + String deleteServiceRequestId = UUID.randomUUID().toString(); + String serviceInstanceId = "service-instance-id"; + registerExpectationFromPresets(ImmutableList.of( + new PresetAAIGetSubscribersGet(), + new PresetMSODeleteMacroService(deleteServiceRequestId, serviceInstanceId), + new PresetMSOOrchestrationRequestGet(COMPLETE, deleteServiceRequestId) + ), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET); + + List<String> uuids = createBulkOfInstances(false, 1, ImmutableMap.of(), DELETE_MACRO_SERVICE_FILE_NAME); + assertThat(uuids, IsCollectionWithSize.hasSize(1)); + String jobId = uuids.get(0); + + assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_FAST, new ServiceInfo( + "us16807000", JobStatus.COMPLETED, false, + "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS", + "JAG1", "YUDFJULP-JAG1", + "092eb9e8e4b7412e8787dd091bc58e86", "USP-SIP-IC-24335-T-01", + "AAIAIC25", null, + "service-instance-type", null, + null, "InstanceName", + "f028b2e2-7080-4b13-91b2-94944d4c42d8", "Service with VRF", "5.0", + jobId, null, ServiceAction.DELETE, false) + ); + } + } diff --git a/vid-automation/src/test/java/org/onap/vid/api/CategoryParametersApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/CategoryParametersApiTest.java index c04d2ff0d..762a0091c 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/CategoryParametersApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/CategoryParametersApiTest.java @@ -17,7 +17,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.List; -import java.util.Random; import java.util.UUID; import java.util.stream.Collectors; @@ -27,8 +26,7 @@ import static org.testng.AssertJUnit.assertEquals; //This is integration test that require running tomcat public class CategoryParametersApiTest extends BaseApiTest { - public static final String GET_CATEGORY_PARAMETER_PROPERTIES = "maintenance/category_parameter"; - public static final String DELETE_CATEGORY_PARAMETER_PROPERTIES = "maintenance/delete_category_parameter"; + public static final String MAINTENANCE_CATEGORY_PARAMETER = "maintenance/category_parameter"; public static final String PROPERTY_NAME = "owningEntity"; public static final String PROPERTY_FAMILY = "PARAMETER_STANDARDIZATION"; @@ -56,7 +54,7 @@ public class CategoryParametersApiTest extends BaseApiTest { findPropertyNameInGetResponse(UPDATE_PARAMETER_PROPERTY_NAME); CategoryParameterOption deleteReq = new CategoryParameterOption(); deleteReq.setName(UPDATE_PARAMETER_PROPERTY_NAME); - deleteCPPropertiesRequest(HttpMethod.POST, deleteReq, HttpStatus.OK); + deleteCPPropertiesRequest(HttpMethod.DELETE, deleteReq, HttpStatus.OK); } @Test(groups = { "worksOnlyWithLocalhostVID" }) @@ -89,7 +87,7 @@ public class CategoryParametersApiTest extends BaseApiTest { } private Response getCPPropertiesRequest(String method, HttpStatus exceptedHttpStatus) throws IOException { - UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromUri(uri).path("/"+GET_CATEGORY_PARAMETER_PROPERTIES) + UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromUri(uri).path("/"+ MAINTENANCE_CATEGORY_PARAMETER) .queryParam("familyName", PROPERTY_FAMILY); WebTarget webTarget = client.target(urlBuilder.toUriString()); Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).method(method, Entity.json(null)); @@ -98,22 +96,22 @@ public class CategoryParametersApiTest extends BaseApiTest { } private Response addCPPropertiesRequest(String method, AddCategoryOptionsRequest request, HttpStatus exceptedHttpStatus) throws IOException { - WebTarget webTarget = client.target(uri).path(GET_CATEGORY_PARAMETER_PROPERTIES+"/"+PROPERTY_NAME); + WebTarget webTarget = client.target(uri).path(MAINTENANCE_CATEGORY_PARAMETER +"/"+PROPERTY_NAME); Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).method(method, Entity.json(request)); TestUtils.assertHttpStatus(request, webTarget, response, exceptedHttpStatus); return response; } private Response updateCPPropertiesRequest(String method, CategoryParameterOptionRep request, HttpStatus exceptedHttpStatus) throws IOException { - WebTarget webTarget = client.target(uri).path(GET_CATEGORY_PARAMETER_PROPERTIES+"/"+PROPERTY_NAME); + WebTarget webTarget = client.target(uri).path(MAINTENANCE_CATEGORY_PARAMETER +"/"+PROPERTY_NAME); Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).method(method, Entity.json(request)); TestUtils.assertHttpStatus(request, webTarget, response, exceptedHttpStatus); return response; } private Response deleteCPPropertiesRequest(String method, CategoryParameterOption request, HttpStatus exceptedHttpStatus) throws IOException { - WebTarget webTarget = client.target(uri).path(DELETE_CATEGORY_PARAMETER_PROPERTIES+"/"+PROPERTY_NAME); - Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).method(method, Entity.json(request)); + WebTarget webTarget = client.target(uri).path(MAINTENANCE_CATEGORY_PARAMETER+"/"+PROPERTY_NAME+"/"+request.getName()); + Response response = webTarget.request(MediaType.APPLICATION_JSON_TYPE).method(method, Entity.json(null)); TestUtils.assertHttpStatus(request, webTarget, response, exceptedHttpStatus); return response; } diff --git a/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java index e38617b39..a550cde4c 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java @@ -1,17 +1,6 @@ package org.onap.vid.api; -import static org.hamcrest.CoreMatchers.anyOf; -import static org.hamcrest.CoreMatchers.both; -import static org.hamcrest.CoreMatchers.endsWith; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.startsWith; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; - import com.google.common.collect.ImmutableList; -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -21,13 +10,13 @@ import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGetInvalidResponse; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsManyStatusesGet; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsManyStatusesInvalidResponseGet; -import org.onap.simulator.presetGenerator.presets.scheduler.PresetGetSchedulerChangeManagementInvalidResponse; -import org.onap.simulator.presetGenerator.presets.scheduler.PresetGetSchedulerChangeManagements; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGetEmptyResult; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGetInvalidResponse; import org.onap.vid.model.probe.ExternalComponentStatus; import org.onap.vid.model.probe.HttpRequestMetadata; +import org.onap.simulator.presetGenerator.presets.scheduler.PresetGetSchedulerChangeManagementInvalidResponse; +import org.onap.simulator.presetGenerator.presets.scheduler.PresetGetSchedulerChangeManagements; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; @@ -36,6 +25,13 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import vid.automation.test.services.SimulatorApi; +import java.lang.reflect.Method; +import java.util.Collection; +import java.util.List; + +import static org.hamcrest.CoreMatchers.*; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; + public class ProbeApiTest extends BaseApiTest { private static final String MSO_QUERY_PARAMS = "filter=requestExecutionDate:EQUALS:01-01-2100"; @@ -65,7 +61,7 @@ public class ProbeApiTest extends BaseApiTest { new HttpRequestMetadata(HttpMethod.GET, 200, AAI_QUERY_PARMAS, - "{\"customer\":[{\"global-customer-id\":\"CAR_2020_ER\",\"subscriber-name\":\"CAR_2020_ER\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1494001902987\",\"relationship-list\":null},{\"global-customer-id\":\"21014aa2-526b-11e6-beb8-9e71128cae77\",\"subscriber-name\":\"JULIO ERICKSON\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1494001776295\",\"relationship-list\":null},{\"global-customer-id\":\"DHV1707-TestSubscriber-2\",\"subscriber-name\":\"DALE BRIDGES\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1498751754450\",\"relationsh", + "{\"customer\":[{\"global-customer-id\":\"CAR_2020_ER\",\"subscriber-name\":\"CAR_2020_ER\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1494001902987\",\"relationship-list\":null},{\"global-customer-id\":\"21014aa2-526b-11e6-beb8-9e71128cae77\",\"subscriber-name\":\"JULIO ERICKSON\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1494001776295\",\"relationship-list\":null},{\"global-customer-id\":\"DHV1707-TestSubscriber-2\",\"subscriber-name\":\"DALE BRIDGES\",\"subscriber-type\":\"INFRA\",\"resource-version\":\"1498751754450\",\"relat", "OK" ) ), new ExternalComponentStatus(ExternalComponentStatus.Component.MSO, diff --git a/vid-automation/src/test/java/org/onap/vid/api/SampleApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SampleApiTest.java index 9d7a08120..c57a90aef 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SampleApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SampleApiTest.java @@ -11,7 +11,6 @@ import vid.automation.test.services.SimulatorApi; import java.io.IOException; -import static java.util.Collections.singletonList; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java index 7735d59af..329291838 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java @@ -1,16 +1,5 @@ package org.onap.vid.api; -import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNot.not; -import static org.testng.Assert.assertFalse; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; -import static vid.automation.test.services.SimulatorApi.registerExpectation; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; -import static vid.automation.test.utils.ReadFile.loadResourceAsString; - import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; @@ -25,6 +14,17 @@ import org.testng.annotations.Test; import vid.automation.test.infra.FeatureTogglingTest; import vid.automation.test.infra.Features; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNot.not; +import static org.testng.Assert.assertFalse; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.services.SimulatorApi.registerExpectation; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; +import static vid.automation.test.utils.ReadFile.loadResourceAsString; + public class SdcApiTest extends BaseApiTest { private static final String SDC_GET_SERVICE_MODEL = "/rest/models/services/"; @@ -170,7 +170,7 @@ public class SdcApiTest extends BaseApiTest { // using json-pointers instead of path, because vnf name has // dots and spaces - final String myVnf = "vMMEvProbe_FE_AIC3-11.2.1_VF 1"; + final String myVnf = "vFLORENCEvProbe_FE_AIC3-11.2.1_VF 1"; final String base = "/vnfs/" + myVnf; assertFalse(response.at(base).isMissingNode(), diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java index 40ce80ba6..ef582099d 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java @@ -2,8 +2,6 @@ package org.onap.vid.api; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.io.IOException; -import java.net.URISyntaxException; import org.apache.commons.text.StringEscapeUtils; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration; @@ -13,8 +11,9 @@ import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndClou import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.testng.annotations.Test; -import vid.automation.test.infra.FeatureTogglingTest; -import vid.automation.test.infra.Features; + +import java.io.IOException; +import java.net.URISyntaxException; public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ @@ -64,7 +63,6 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ } @Test - @FeatureTogglingTest(Features.FLAG_UNASSIGN_SERVICE) public void testUnassignServiceInstanceSucceed() throws Exception { String requestBody = TestUtils.convertRequest(objectMapper, DELETE_AND_UNASSIGN_SERVICE_REQUEST_DETAILS); callMsoWithFineRequest(UNASSIGN_OK_JSON, ImmutableMap.of(), buildUri(MSO_UNASSIGN_SERVICE_INSTANCE), requestBody, @@ -73,7 +71,6 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ @Test - @FeatureTogglingTest(Features.FLAG_UNASSIGN_SERVICE) public void testDeleteServiceInstanceSucceed() throws Exception { String requestBody = TestUtils.convertRequest(objectMapper, DELETE_AND_UNASSIGN_SERVICE_REQUEST_DETAILS); callMsoWithFineRequest(UNASSIGN_OK_JSON, ImmutableMap.of( @@ -82,16 +79,7 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ HttpStatus.ACCEPTED.value(), EXPECTED_SUCCESS_MSO_RESPONSE, HttpMethod.POST); } - @Test - @FeatureTogglingTest(value = Features.FLAG_UNASSIGN_SERVICE, flagActive = false) - public void testUnassignServiceInstanceBecomesDelete() throws Exception { - String requestBody = TestUtils.convertRequest(objectMapper, DELETE_AND_UNASSIGN_SERVICE_REQUEST_DETAILS); - callMsoWithFineRequest(DELETE_SERVICE_REQUEST_DETAILS, ImmutableMap.of(), buildUri(MSO_DELETE_SERVICE_INSTANCE), requestBody, - HttpStatus.ACCEPTED.value(), EXPECTED_SUCCESS_MSO_RESPONSE, HttpMethod.POST); - } - @Test(dataProvider = "errorCodes") - @FeatureTogglingTest(Features.FLAG_UNASSIGN_SERVICE) public void testUnassignServiceInstanceFailed(int errorCode) throws IOException { String requestBody = TestUtils.convertRequest(objectMapper, DELETE_AND_UNASSIGN_SERVICE_REQUEST_DETAILS); callMsoWithSimulatedErrorResponse(DELETE_OR_UNASSIGN_FAILED_JSON, @@ -101,7 +89,6 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ } @Test(dataProvider = "errorCodes") - @FeatureTogglingTest(Features.FLAG_UNASSIGN_SERVICE) public void testDeleteServiceInstanceFailed(int errorCode) throws IOException { String requestBody = TestUtils.convertRequest(objectMapper, DELETE_AND_UNASSIGN_SERVICE_REQUEST_DETAILS); callMsoWithSimulatedErrorResponse(DELETE_OR_UNASSIGN_FAILED_JSON, diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServicePermissionsApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServicePermissionsApiTest.java index 385ec9b0d..78fe143c9 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServicePermissionsApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServicePermissionsApiTest.java @@ -1,18 +1,19 @@ package org.onap.vid.api; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - import com.google.common.collect.ImmutableMap; -import java.util.Map; -import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.model.User; import vid.automation.test.services.SimulatorApi; +import java.util.Map; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; + public class ServicePermissionsApiTest extends BaseApiTest { private final String emanuelSubscriberId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java index 52aa2e388..4ece31dfc 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java @@ -16,10 +16,15 @@ import vid.automation.test.services.SimulatorApi; import java.util.UUID; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS; import static org.apache.commons.text.StringEscapeUtils.escapeJson; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsString; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.*; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; public class ServiceTreeApiTest extends BaseApiTest { @@ -106,15 +111,15 @@ public class ServiceTreeApiTest extends BaseApiTest { "\"in-maint\": true,", ImmutableMultimap.of("instance-group", instanceGroup2.getReqPath())); Multimap<String, String> serviceInstance1 = ImmutableMultimap.<String, String>builder() - .putAll("generic-vnf", vnfPreset1.getReqPath()) - .putAll("generic-vnf", vnfPreset3.getReqPath()) - .build(); + .putAll("generic-vnf", vnfPreset1.getReqPath()) + .putAll("generic-vnf", vnfPreset3.getReqPath()) + .build(); Multimap<String, String> serviceInstance2 = ImmutableMultimap.<String, String>builder() - .putAll("generic-vnf", vnfPreset2.getReqPath()) - .putAll("generic-vnf", vnfPreset4.getReqPath()) - .putAll("generic-vnf", vnfPreset5.getReqPath()) - .build(); + .putAll("generic-vnf", vnfPreset2.getReqPath()) + .putAll("generic-vnf", vnfPreset4.getReqPath()) + .putAll("generic-vnf", vnfPreset5.getReqPath()) + .build(); PresetAAIGetServiceInstancesByInvariantId serviceInstancesList = new PresetAAIGetServiceInstancesByInvariantId( "global-customer-id", "service-instance-type", "24632e6b-584b-4f45-80d4-fefd75fd9f14", @@ -207,16 +212,22 @@ public class ServiceTreeApiTest extends BaseApiTest { PresetAAIStandardQueryGet instanceGroup1 = PresetAAIStandardQueryGet.ofInstanceGroup("L3-NETWORK", "Ruby Figueroa", ImmutableMultimap.of()); PresetAAIStandardQueryGet collection1 = - PresetAAIStandardQueryGet.ofCollectionResource("Assigned", - ImmutableMultimap.of("instance-group", instanceGroup1.getReqPath())); + PresetAAIStandardQueryGet.ofCollectionResource( + "Assigned", + ImmutableMultimap.of("instance-group", instanceGroup1.getReqPath()), + "081ceb56-eb71-4566-a72d-3e7cbee5cdf1", + "ce8c98bc-4691-44fb-8ff0-7a47487c11c4" + ); PresetAAIStandardQueryGet vnfPreset1 = PresetAAIStandardQueryGet.ofVnf(randUuid(), - ImmutableMultimap.of("l3-network", l3NetworkPreset1.getReqPath(), "l3-network", l3NetworkPreset2.getReqPath())); + ImmutableMultimap.of("l3-network", l3NetworkPreset1.getReqPath(), "l3-network", l3NetworkPreset2.getReqPath()), + new Placement(ATT_NC, olson3, "229bcdc6eaeb4ca59d55221141d01f8e")); PresetAAIStandardQueryGet vnfPreset2 = PresetAAIStandardQueryGet.ofVnf(randUuid(), "d6557200-ecf2-4641-8094-5393ae3aae60","91415b44-753d-494c-926a-456a9172bbb9", - "\"in-maint\": true,", ImmutableMultimap.of("volume-group", volumeGroup1.getReqPath())); + "\"in-maint\": true,", ImmutableMultimap.of("volume-group", volumeGroup1.getReqPath()), + new Placement(ATT_AIC, hvf6, "88a6ca3ee0394ade9403f075db23167e")); PresetAAIGetVfModulesByVnf vfModules2 = new PresetAAIGetVfModulesByVnf(vnfPreset2.getInstanceId()); @@ -264,12 +275,21 @@ public class ServiceTreeApiTest extends BaseApiTest { assertJsonEquals(response, expected); } + @Override + protected void assertJsonEquals(String actual, String expected) { + assertThat(actual, jsonEquals(expected) + .when(IGNORING_ARRAY_ORDER) + .when(IGNORING_EXTRA_FIELDS) + ); + } + @Test public void serviceWithVnfGotError_exceptionIsThrown() { PresetAAIStandardQueryGet vnfPreset = PresetAAIStandardQueryGet.ofVnf(randUuid(), - ImmutableMultimap.of("l3-network", "/aai/v../I'm a wrong path")); + ImmutableMultimap.of("l3-network", "/aai/v../I'm a wrong path"), + defaultPlacement()); final PresetAAIStandardQueryGet serviceInstance = PresetAAIStandardQueryGet.ofServiceInstance("service-instance-id", "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "service-instance-model-invariant-id", "global-customer-id", "service-instance-type", @@ -364,7 +384,61 @@ public class ServiceTreeApiTest extends BaseApiTest { assertJsonEquals(response, expected); } + @Test + public void serviceWithVrf_resultAsExpected(){ + PresetAAIStandardQueryGet vpnBindingPreset = + PresetAAIStandardQueryGet.ofVpn("Active", ImmutableMultimap.of(), "mock-global-1", "mock-role-x", "VPN1260","USA,EMEA"); + + // in order to verify thst only one route target is parsed from the Vpn - binding of the network + PresetAAIStandardQueryGet vpnBindingPresetOnlyForTheNetwork = + PresetAAIStandardQueryGet.ofVpn("Active", ImmutableMultimap.of(), "shouldNotBeOnResult", "shouldNotBeOnResult","shouldNotBeOnResult","shouldNotBeOnResult"); + + PresetAAIStandardQueryGet l3NetworkPreset = + PresetAAIStandardQueryGet.ofL3Network("SR-IOV-PROVIDER2-2", "Assigned", + ImmutableMultimap.of("vpn-binding", vpnBindingPreset.getReqPath(), + "vpn-binding", vpnBindingPresetOnlyForTheNetwork.getReqPath())); + + PresetAAIStandardQueryGet vrfPreset = + PresetAAIStandardQueryGet.ofVrf("Create", + ImmutableMultimap.of( + "l3-network", l3NetworkPreset.getReqPath(), + "vpn-binding", vpnBindingPreset.getReqPath())); + + final PresetAAIStandardQueryGet serviceInstance = + PresetAAIStandardQueryGet.ofServiceInstance("service-instance-id", "BONDING", "INFRASTRUCTURE-VPN", "f028b2e2-7080-4b13-91b2-94944d4c42d8", + "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb", "global-customer-id", "service-instance-type", "GARBAGE DATA", + ImmutableMultimap.of("configuration", vrfPreset.getReqPath())); + + String expected = TestUtils.convertRequest(objectMapper, "aaiGetInstanceTopology/serviceWithVrfTopology.json"); + expected = expected + .replace("SERVICE_INSTANCE_NAME", serviceInstance.getInstanceName()) + .replace("VRF_INSTANCE_ID", vrfPreset.getInstanceId()) + .replace("VRF_INSTANCE_NAME", vrfPreset.getInstanceName()) + .replace("VPN_INSTANCE_ID", vpnBindingPreset.getInstanceId()) + .replace("VPN_INSTANCE_NAME", vpnBindingPreset.getInstanceName()) + .replace("NETWORK_INSTANCE_NAME", l3NetworkPreset.getInstanceName()) + .replace("NETWORK_INSTANCE_ROLE", l3NetworkPreset.getInstanceRole()) + .replace("NETWORK_INSTANCE_ID", l3NetworkPreset.getInstanceId()); + + SimulatorApi.registerExpectationFromPresets(ImmutableList.of( + serviceInstance, + vrfPreset, + vpnBindingPreset, + l3NetworkPreset, + new PresetAAIModelsByInvariantIdGet(ImmutableList.of("network-instance-model-invariant-id", "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb", "b67a289b-1688-496d-86e8-1583c828be0a" )), + new PresetGetSessionSlotCheckIntervalGet(), + new PresetAAIGetSubscribersGet(), + new PresetSDCGetServiceMetadataGet("f028b2e2-7080-4b13-91b2-94944d4c42d8", "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb", "service-Infravpn-csar.zip"), + new PresetSDCGetServiceToscaModelGet("f028b2e2-7080-4b13-91b2-94944d4c42d8", "service-Infravpn-csar.zip") + ), CLEAR_THEN_SET); + + final String response = restTemplate.getForObject(buildUri(API_URL), String.class, "global-customer-id", "service-instance-type", "service-instance-id"); + + assertJsonEquals(response, expected); + } + private String randUuid() { return UUID.randomUUID().toString(); } + } diff --git a/vid-automation/src/test/java/org/onap/vid/api/VidConfigurationApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/VidConfigurationApiTest.java index ec479d900..38ce8613d 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/VidConfigurationApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/VidConfigurationApiTest.java @@ -4,7 +4,6 @@ import org.springframework.http.ResponseEntity; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import static java.util.Collections.singletonList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; diff --git a/vid-automation/src/test/java/org/onap/vid/api/pProbeAaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/pProbeAaiApiTest.java index db10fdc57..ff52f2b04 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/pProbeAaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/pProbeAaiApiTest.java @@ -1,13 +1,6 @@ package org.onap.vid.api; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy; -import static vid.automation.test.services.SimulatorApi.registerExpectation; - import com.google.common.collect.ImmutableMap; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.util.ArrayList; import org.apache.commons.text.StringEscapeUtils; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -16,6 +9,14 @@ import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.util.ArrayList; + +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy; +import static vid.automation.test.services.SimulatorApi.registerExpectation; + public class pProbeAaiApiTest extends BaseApiAaiTest { @@ -35,7 +36,7 @@ public class pProbeAaiApiTest extends BaseApiAaiTest { //URIs private static final String GET_SERVICE_INSTANCE_PNFS = "aai_get_service_instance_pnfs/31739f3e-526b-11e6-beb8-9e71128cae77/AIM Transport/f36f5734-e9df-4fbf-9f35-61be13f028a1"; private static final String GET_SPECIFIC_PNF_URI = "aai_get_pnfs/pnf/DEAAI78"; - private static final String GET_PNF_BY_REGION = "aai_get_pnf_instances/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/8a84e59b-45fe-4851-8ff1-34225a0b32c3/83b458fd-5dd3-419b-a9e3-7335814a0911/JANET25/Cisco/Nexus 3048-TP"; + private static final String GET_PNF_BY_REGION = "aai_get_pnf_instances/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/8a84e59b-45fe-4851-8ff1-34225a0b32c3/83b458fd-5dd3-419b-a9e3-7335814a0911/AAIAIC25/Cisco/Nexus 3048-TP"; diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java index 7ca29f854..d72337f3d 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java +++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java @@ -1,14 +1,6 @@ package org.onap.vid.more; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.junit.Assert.assertThat; - import com.fasterxml.jackson.databind.JsonNode; -import java.net.URI; -import java.util.HashMap; -import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,11 +11,20 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import vid.automation.test.services.SimulatorApi; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.junit.Assert.assertThat; + public class LoggerFormatTest extends BaseApiTest { - // See: https://www.openecomp.org/KSAT/REST-based+Log+Checker - private final static String logChecker = "http://eelf.onap.org:31820/validate"; + // See: https://wiki.web.att.com/display/KSAT/REST-based+Log+Checker + private final static String logChecker = "http://eelflogcheck.it.att.com:31820/validate"; private final Logger logger = LogManager.getLogger(LoggerFormatTest.class); @BeforeClass diff --git a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java index 0a0045d4d..73ad53e19 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java +++ b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java @@ -20,7 +20,7 @@ import java.util.UUID; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; -import static org.onap.vid.api.CategoryParametersApiTest.GET_CATEGORY_PARAMETER_PROPERTIES; +import static org.onap.vid.api.CategoryParametersApiTest.MAINTENANCE_CATEGORY_PARAMETER; import static org.onap.vid.api.pProbeMsoApiTest.MSO_CREATE_CONFIGURATION; import static org.springframework.http.HttpHeaders.AUTHORIZATION; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; @@ -90,7 +90,7 @@ public class RequestIdFilterInstalled extends BaseApiTest { final Pair<HttpEntity, String> responseAndUuid = makeRequest( HttpMethod.GET, - "/" + GET_CATEGORY_PARAMETER_PROPERTIES + "?familyName=PARAMETER_STANDARDIZATION", + "/" + MAINTENANCE_CATEGORY_PARAMETER + "?familyName=PARAMETER_STANDARDIZATION", null ); assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid); |