diff options
author | kurczews <krzysztof.kurczewski@nokia.com> | 2018-08-13 12:42:35 +0200 |
---|---|---|
committer | kurczews <krzysztof.kurczewski@nokia.com> | 2018-08-13 12:46:44 +0200 |
commit | 5015d4aa2a7ba17d5e7024bf9ef344e7b320b9ab (patch) | |
tree | 785a347ef14348ee75746dc8e465b629819719dd /vid-automation/src/main/java/org/onap/simulator | |
parent | 5ac1100c02912f7a45d2949d94cd33d054283139 (diff) |
Renaming vid-automation #2
Change-Id: Ide2d71658369e0f0d953e1aa1752f48e9a4bbe96
Issue-ID: VID-205
Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
Diffstat (limited to 'vid-automation/src/main/java/org/onap/simulator')
15 files changed, 395 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java new file mode 100644 index 00000000..3e99a38d --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java @@ -0,0 +1,12 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +/** + * Created by itzikliderman on 27/12/2017. + */ +public abstract class BaseAAIPreset extends BasePreset { + + @Override + protected String getRootPath() { + return "/aai/v.."; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseEcompPortalPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseEcompPortalPreset.java new file mode 100644 index 00000000..d4f4b182 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseEcompPortalPreset.java @@ -0,0 +1,12 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +/** + * Created by itzikliderman on 27/12/2017. + */ +public abstract class BaseEcompPortalPreset extends BasePreset { + + @Override + protected String getRootPath() { + return "/ecompportal_att/auxapi"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java new file mode 100644 index 00000000..8194d87a --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPreset.java @@ -0,0 +1,30 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +import vid.automation.test.infra.Features; + +/** + * Created by itzikliderman on 27/12/2017. + */ +public abstract class BaseMSOPreset extends BasePreset { + + public static String getRequestBodyWithTestApiOnly() { + if (Features.FLAG_ADD_MSO_TESTAPI_FIELD.isActive()) { + return "" + + "{" + + " \"requestDetails\": { " + + " \"requestParameters\": { " + + " \"testApi\": \"GR_API\" " + + " } " + + " } " + + "} " + + ""; + } else { + return null; + } + } + + @Override + protected String getRootPath() { + return "/mso"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPresetServiceInstanceOperationsPost.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPresetServiceInstanceOperationsPost.java new file mode 100644 index 00000000..e790c0c0 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseMSOPresetServiceInstanceOperationsPost.java @@ -0,0 +1,33 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +import org.springframework.http.HttpMethod; + +/** + * Created by itzikliderman on 21/12/2017. + */ +public abstract class BaseMSOPresetServiceInstanceOperationsPost extends BaseMSOPreset { + @Override + protected String getRootPath() { + return super.getRootPath() + "/cloudResources/v1/operationalEnvironments/ENV-UUID"; + } + + @Override + public Object getResponseBody() { + return "{"+ + " \"requestReferences\": {"+ + " \"instanceId\": \"dbe54591-c8ed-46d3-abc7-d3a24873dfbd\","+ + " \"requestId\": \"dbe54591-c8ed-46d3-abc7-d3a24873sssa\""+ + " }"+ + " }"; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.POST; + } + + @Override + public int getResponseCode() { + return 202; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BasePreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BasePreset.java new file mode 100644 index 00000000..16236736 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BasePreset.java @@ -0,0 +1,47 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest; +import org.springframework.http.HttpMethod; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by itzikliderman on 13/12/2017. + */ +public abstract class BasePreset { + + public RegistrationRequest generateScenario() { + Map<String, String> headers = new HashMap<>(); + headers.put("Content-Type", getContentType()); + + return new RegistrationRequest( + new RegistrationRequest.SimulatorRequest(getReqMethod(), getReqPath(), getQueryParams(), getRequestBody()), + new RegistrationRequest.SimulatorResponse(getResponseCode(), headers, getResponseBody(), getFile())); + } + + public Object getResponseBody() { return null; }; + + public String getContentType() { + return "application/json"; + } + + public String getFile() { + return null; + } + + public int getResponseCode() { return 200; } + + public abstract HttpMethod getReqMethod(); + + public abstract String getReqPath(); + + public Object getRequestBody() { + return null; + } + + public Map<String, List> getQueryParams() { return null; } + + protected abstract String getRootPath(); +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java new file mode 100644 index 00000000..d5f8b84c --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseSDCPreset.java @@ -0,0 +1,12 @@ +package org.onap.simulator.presetGenerator.presets.BasePresets; + +/** + * Created by itzikliderman on 27/12/2017. + */ +public abstract class BaseSDCPreset extends BasePreset { + + @Override + protected String getRootPath() { + return "/sdc/v1/catalog/services"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/EcompPortalPresetsUtils.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/EcompPortalPresetsUtils.java new file mode 100644 index 00000000..6470677d --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/EcompPortalPresetsUtils.java @@ -0,0 +1,18 @@ +package org.onap.simulator.presetGenerator.presets.ecompportal_att; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; + +import java.util.Arrays; +import java.util.List; + +public class EcompPortalPresetsUtils { + + private final static List<BasePreset> ecompPortalPresets = Arrays.asList( + new PresetGetUserGet(), + new PresetGetSessionSlotCheckIntervalGet(), + new PresetExtendSessionTimeOutsPost()); + + public static List<BasePreset> getEcompPortalPresets() { + return ecompPortalPresets; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetExtendSessionTimeOutsPost.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetExtendSessionTimeOutsPost.java new file mode 100644 index 00000000..4e10b0a8 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetExtendSessionTimeOutsPost.java @@ -0,0 +1,18 @@ +package org.onap.simulator.presetGenerator.presets.ecompportal_att; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseEcompPortalPreset; +import org.springframework.http.HttpMethod; + +public class PresetExtendSessionTimeOutsPost extends BaseEcompPortalPreset { + public Object getResponseBody() { + return "300000"; + } + + public HttpMethod getReqMethod() { + return HttpMethod.POST; + } + + public String getReqPath() { + return getRootPath() + "//extendSessionTimeOuts"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetSessionSlotCheckIntervalGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetSessionSlotCheckIntervalGet.java new file mode 100644 index 00000000..55cc3dbc --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetSessionSlotCheckIntervalGet.java @@ -0,0 +1,18 @@ +package org.onap.simulator.presetGenerator.presets.ecompportal_att; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseEcompPortalPreset; +import org.springframework.http.HttpMethod; + +public class PresetGetSessionSlotCheckIntervalGet extends BaseEcompPortalPreset { + public Object getResponseBody() { + return "300000"; + } + + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + public String getReqPath() { + return getRootPath() + "//getSessionSlotCheckInterval"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetUserGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetUserGet.java new file mode 100644 index 00000000..f2fb247c --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/ecompportal_att/PresetGetUserGet.java @@ -0,0 +1,20 @@ +package org.onap.simulator.presetGenerator.presets.ecompportal_att; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseEcompPortalPreset; +import org.springframework.http.HttpMethod; + +import java.util.Collections; + +public class PresetGetUserGet extends BaseEcompPortalPreset { + public Object getResponseBody() { + return Collections.EMPTY_LIST; + } + + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + public String getReqPath() { + return getRootPath() + "/context/get_user"; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/RegistrationRequest.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/RegistrationRequest.java new file mode 100644 index 00000000..680dabe9 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/RegistrationRequest.java @@ -0,0 +1,54 @@ +package org.onap.simulator.presetGenerator.presets.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.springframework.http.HttpMethod; + +import java.util.List; +import java.util.Map; + +public class RegistrationRequest { + + public static class SimulatorRequest { + public final HttpMethod method; + public final String path; + + @JsonInclude(JsonInclude.Include.NON_NULL) + public final Map<String,List> queryParams; + + @JsonInclude(JsonInclude.Include.NON_NULL) + public final Object body; + + public SimulatorRequest(HttpMethod method, String path, Map<String, List> queryParams, Object body) { + this.method = method; + this.path = path; + this.queryParams = queryParams; + this.body = body; + } + } + + public static class SimulatorResponse { + public final int responseCode; + public final Map<String,String> responseHeaders; + + @JsonInclude(JsonInclude.Include.NON_NULL) + public final Object body; + + @JsonInclude(JsonInclude.Include.NON_NULL) + public final String file; + + public SimulatorResponse(int responseCode, Map<String, String> responseHeaders, Object body, String file) { + this.responseCode = responseCode; + this.responseHeaders = responseHeaders; + this.body = body; + this.file = file; + } + } + + public SimulatorRequest simulatorRequest; + public SimulatorResponse simulatorResponse; + + public RegistrationRequest(SimulatorRequest simulatorRequest, SimulatorResponse simulatorResponse) { + this.simulatorRequest = simulatorRequest; + this.simulatorResponse = simulatorResponse; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/Subscriber.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/Subscriber.java new file mode 100644 index 00000000..27f3f9bb --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/model/Subscriber.java @@ -0,0 +1,19 @@ +package org.onap.simulator.presetGenerator.presets.model; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Subscriber { + + @JsonProperty("global-customer-id") + public String globalCustomerId; + + @JsonProperty("subscriber-name") + public String subscriberName; + + @JsonProperty("subscriber-type") + public String subscriberType; + + @JsonProperty("resource-version") + public String resourceVersion; +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceMetadataGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceMetadataGet.java new file mode 100644 index 00000000..9b1ea80a --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceMetadataGet.java @@ -0,0 +1,50 @@ +package org.onap.simulator.presetGenerator.presets.sdc; + +import org.springframework.http.HttpMethod; + +/** + * Created by itzikliderman on 21/12/2017. + */ +public class PresetSDCGetServiceMetadataGet extends SdcPresetWithModelVersionId { + + public PresetSDCGetServiceMetadataGet(String modelVersionId, String modelInvariantId, String zipFileName) { + super(modelVersionId); + this.modelInvariantId = modelInvariantId; + this.zipFileName = zipFileName; + } + + private final String zipFileName; + private final String modelInvariantId; + + + @Override + public Object getResponseBody() { + return "{" + + " \"uuid\": \""+getModelVersionId()+"\"," + + " \"invariantUUID\": \""+getModelInvariantId()+"\"," + + " \"name\": \"action-data\"," + + " \"version\": \"1.0\"," + + " \"toscaModelURL\": \"./"+zipFileName+"\"," + + " \"category\": \"Mobility\"," + + " \"lifecycleState\": \"CERTIFIED\"," + + " \"lastUpdaterUserId\": \"rg276b\"," + + " \"lastUpdaterFullName\": null," + + " \"distributionStatus\": \"DISTRIBUTED\"," + + " \"artifacts\": null," + + " \"resources\": null" + + " }"; + } + + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return super.getReqPath()+"/metadata"; + } + + public String getModelInvariantId() { + return modelInvariantId; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceToscaModelGet.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceToscaModelGet.java new file mode 100644 index 00000000..e243dc32 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/PresetSDCGetServiceToscaModelGet.java @@ -0,0 +1,30 @@ +package org.onap.simulator.presetGenerator.presets.sdc; + +import org.springframework.http.HttpMethod; + +/** + * Created by itzikliderman on 21/12/2017. + */ +public class PresetSDCGetServiceToscaModelGet extends SdcPresetWithModelVersionId { + + private String file; + + public PresetSDCGetServiceToscaModelGet(String modelVersionId, String file) { + super(modelVersionId); + this.file = file; + } + + public HttpMethod getReqMethod() { + return HttpMethod.GET; + } + + @Override + public String getReqPath() { + return super.getReqPath()+"/toscaModel"; + } + + @Override + public String getFile() { + return file; + } +} diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/SdcPresetWithModelVersionId.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/SdcPresetWithModelVersionId.java new file mode 100644 index 00000000..c3319d6c --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/sdc/SdcPresetWithModelVersionId.java @@ -0,0 +1,22 @@ +package org.onap.simulator.presetGenerator.presets.sdc; + +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseSDCPreset; + +public abstract class SdcPresetWithModelVersionId extends BaseSDCPreset { + + public SdcPresetWithModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + protected String modelVersionId; + + public String getModelVersionId() { + return modelVersionId; + } + + public String getReqPath() { + return getRootPath() + "/"+getModelVersionId(); + } + + +} |