diff options
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/services')
3 files changed, 63 insertions, 63 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java index 0f0839537..2d04af9cb 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java +++ b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java @@ -1,35 +1,9 @@ package vid.automation.test.services; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC; -import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; - import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByOwningEntity; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByProject; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; -import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModule; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDelete; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceOrchestrationRequestGet; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetwork; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModule; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnf; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVolumeGroup; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.aai.*; +import org.onap.simulator.presetGenerator.presets.mso.*; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOActOnConfiguration; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOCreateConfiguration; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSODeleteConfiguration; @@ -37,6 +11,12 @@ import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMsoEna import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; import vid.automation.test.Constants; +import vid.automation.test.Constants.ViewEdit; + +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; public class BulkRegistration { @@ -74,7 +54,7 @@ public class BulkRegistration { new PresetSDCGetServiceToscaModelGet(serviceFabricSriovService), new PresetAAIGetNetworkZones(), new PresetMSOActivateFabricConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f61234"), - new PresetMSOOrchestrationRequestGet("COMPLETE", "318cc766-b673-4a50-b9c5-471f68914584", "Success")), + new PresetMSOOrchestrationRequestGet(COMPLETE, "318cc766-b673-4a50-b9c5-471f68914584", "Success", false)), SimulatorApi.RegistrationStrategy.APPEND); } @@ -137,11 +117,14 @@ public class BulkRegistration { public static void searchExistingServiceInstancePortMirroring(String orchStatus, boolean isMirrored, String desiredCloudRegionId) { genericSearchExistingServiceInstance(); final String configurationId = "9533-config-LB1113"; + final String configurationId2 = "9533-config-LB1114"; final String portInterfaceId = "d35bf534-7d8e-4cb4-87f9-0a8bb6cd47b2"; final String modelToReplaceWith ="pm1111_equip_model_rename.zip"; SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId, desiredCloudRegionId), APPEND); - SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, "i'm a port", isMirrored), APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, ViewEdit.COMMON_PORT_MIRRORING_PORT_NAME, isMirrored), APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId2, desiredCloudRegionId), APPEND); + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId2, portInterfaceId, "i'm not your port", isMirrored), APPEND); SimulatorApi.registerExpectationFromPreset(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, APPEND); SimulatorApi.registerExpectation( new String [] { @@ -284,7 +267,7 @@ public class BulkRegistration { SimulatorApi.registerExpectationFromPresets(ImmutableList.of( createInstancePreset, cloudOwnerPreset, - new PresetMSOOrchestrationRequestGet(PresetMSOOrchestrationRequestGet.COMPLETE, createInstancePreset.getRequestId(), "Success")), + new PresetMSOOrchestrationRequestGet(COMPLETE, createInstancePreset.getRequestId(), "Success", false)), SimulatorApi.RegistrationStrategy.APPEND); } @@ -423,7 +406,11 @@ public class BulkRegistration { new PresetMSOCreateVfModule("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", "c015cc0f-0f37-4488-aabf-53795fd93cd3", ATT_NC, vfModuleName, "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "ComplexService"), - new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)), + new PresetMSOOrchestrationRequestGet( + COMPLETE, + "c0011670-0e1a-4b74-945d-8bf5aede1d9c", + Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT, + false)), SimulatorApi.RegistrationStrategy.APPEND); } @@ -434,7 +421,11 @@ public class BulkRegistration { new PresetAAIGetTenants(), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, new PresetMSOCreateVfModule(serviceInstanceId,vnfInstanceId, ATT_NC), - new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)), + new PresetMSOOrchestrationRequestGet( + COMPLETE, + "c0011670-0e1a-4b74-945d-8bf5aede1d9c", + Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT, + false)), SimulatorApi.RegistrationStrategy.APPEND); } diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java index 65ef3679c..087449624 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java +++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java @@ -1,26 +1,8 @@ package vid.automation.test.services; -import static org.testng.Assert.assertEquals; -import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString; -import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.net.URI; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.function.UnaryOperator; -import java.util.stream.Collectors; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider; import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider; @@ -32,6 +14,25 @@ import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import vid.automation.test.utils.ReadFile; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.net.URI; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; + +import static org.testng.Assert.assertEquals; +import static vid.automation.test.services.DropTestApiField.dropFieldCloudOwnerFromString; +import static vid.automation.test.services.DropTestApiField.dropTestApiFieldFromString; + public class SimulatorApi { public enum RegistrationStrategy { @@ -62,7 +63,7 @@ public class SimulatorApi { ImmutableList.of(dropTestApiFieldFromString(), dropFieldCloudOwnerFromString()); static { - String host = System.getProperty("VID_HOST", "10.0.0.10" ); + String host = System.getProperty("VID_HOST", "127.0.0.1" ); Integer port = Integer.valueOf(System.getProperty("SIM_PORT", System.getProperty("VID_PORT", "8080"))); //port for registration uri = new JerseyUriBuilder().host(host).port(port).scheme("http").path("vidSimulator").build(); client = ClientBuilder.newClient(); @@ -116,6 +117,12 @@ public class SimulatorApi { registerToSimulatorAndAssertSuccess(preset.getClass().getCanonicalName(), content, registrationStrategy); } + public static void registerExpectationFromPresetsCollections(Collection<Collection<BasePreset>> presets, RegistrationStrategy registrationStrategy) { + registerExpectationFromPresets(presets.stream() + .flatMap(Collection::stream) + .collect(Collectors.toList()), registrationStrategy); + } + public static void registerExpectationFromPresets(Collection<BasePreset> presets, RegistrationStrategy registrationStrategy) { if (registrationStrategy == RegistrationStrategy.CLEAR_THEN_SET) { clearRegistrations(); diff --git a/vid-automation/src/main/java/vid/automation/test/services/UsersService.java b/vid-automation/src/main/java/vid/automation/test/services/UsersService.java index aae7917f7..84345ebd1 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/UsersService.java +++ b/vid-automation/src/main/java/vid/automation/test/services/UsersService.java @@ -1,10 +1,13 @@ package vid.automation.test.services; -import static org.hamcrest.CoreMatchers.everyItem; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; - +//import com.automation.common.report_portal_integration.annotations.Step; import com.google.common.primitives.Ints; +import org.apache.commons.lang3.StringUtils; +import vid.automation.test.model.User; +import vid.automation.test.model.UsersObject; +import vid.automation.test.utils.DB_CONFIG; +import vid.automation.test.utils.ReadFile; + import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @@ -13,11 +16,10 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -import org.apache.commons.lang3.StringUtils; -import vid.automation.test.model.User; -import vid.automation.test.model.UsersObject; -import vid.automation.test.utils.DB_CONFIG; -import vid.automation.test.utils.ReadFile; + +import static org.hamcrest.CoreMatchers.everyItem; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.greaterThan; /** * Created by itzikliderman on 08/09/2017. @@ -36,6 +38,7 @@ public class UsersService { return usersObject.users; } + //@Step("${method} with id: ${userId}") public User getUser(String userId) { User res = users.get(userId); System.out.println("getUser userId='" + userId + "' returned: " + res); @@ -52,7 +55,7 @@ public class UsersService { /* Creates a user in the DB, were: - Login user name is a deterministic number, hashed from the userId string, with 3 trailing zeroes, - and two leading letters from the userId itself; e.g. "mo26063000" for emanuel. + and two leading letters from the userId itself; e.g. "em97331000" for emanuel. - Login user name == user password - 'user.credentials.userId' and 'user.credentials.password' input fields are overridden with the generated values. - Roles are "read" (roleId==16) and all other roles in object (like subscriberName___serviceType___tenant). @@ -79,7 +82,6 @@ public class UsersService { "VALUES (" + userNumber + ", '" + user.credentials.userId + "', '" + userId + "', '" + user.credentials.userId + "', '" + user.credentials.password + "')"); List<String> roles = user.roles != null ? user.roles : new LinkedList<>(); - roles.add("Standard User"); ListIterator<String> iter = roles.listIterator(); while (iter.hasNext()) { |