aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/test/java/org/onap
diff options
context:
space:
mode:
authorkurczews <krzysztof.kurczewski@nokia.com>2018-08-14 11:23:35 +0200
committerkurczews <krzysztof.kurczewski@nokia.com>2018-08-14 11:23:35 +0200
commit05dd5d2fd893f526eb6a807afb5725c8e426dd52 (patch)
tree780c4506ed6e69d053b49c5c116f5727648838d9 /vid-automation/src/test/java/org/onap
parenta55efc25f0ec1cca1a1accedb2bb7fce66d597a9 (diff)
Renaming vid-automation #6
Change-Id: I0971c966ddcd76927bdf1a4c4d47afc900987ddf Issue-ID: VID-205 Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
Diffstat (limited to 'vid-automation/src/test/java/org/onap')
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/aai/AaiResponse.java34
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java121
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/ServiceInfo.java75
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionResponse.java15
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionsRequest.java13
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOption.java34
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOptionRep.java31
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/category/CategoryParametersResponse.java27
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/probe/ExternalComponentStatus.java28
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/probe/HttpRequestMetadata.java49
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/GetVnfWorkflowRelationRequest.java28
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/GetWorkflowsResponse.java24
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/ListOfErrorsResponse.java24
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetails.java66
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetailsWithWorkflows.java27
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationAllResponse.java23
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationRequest.java31
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationResponse.java14
-rw-r--r--vid-automation/src/test/java/org/onap/vid/model/workflow/WorkflowsDetail.java43
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java91
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java184
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/SimulatorLoaderTest.java133
22 files changed, 1115 insertions, 0 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/model/aai/AaiResponse.java b/vid-automation/src/test/java/org/onap/vid/model/aai/AaiResponse.java
new file mode 100644
index 000000000..389cdd88e
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/aai/AaiResponse.java
@@ -0,0 +1,34 @@
+package org.onap.vid.model.aai;
+
+import com.google.common.base.MoreObjects;
+import org.onap.vid.model.mso.ProxyResponse;
+
+/**
+ * Created by Oren on 7/10/17.
+ */
+public class AaiResponse<T> extends ProxyResponse {
+
+ T t;
+
+ public AaiResponse() {
+ }
+
+ public AaiResponse(T t, String errorMessage, int aaiHttpCode) {
+ this.t = t;
+ this.errorMessage = errorMessage;
+ this.httpCode = aaiHttpCode;
+ }
+
+ public T getT() {
+ return t;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("httpCode", httpCode)
+ .add("errorMessage", errorMessage)
+ .add("t", t)
+ .toString();
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java b/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java
new file mode 100644
index 000000000..7c1481562
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/JobAuditStatus.java
@@ -0,0 +1,121 @@
+package org.onap.vid.model.asyncInstantiation;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.UUID;
+
+
+public class JobAuditStatus {
+
+ public JobAuditStatus(){}
+
+
+ public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source){
+ this.jobId = jobId;
+ this.jobStatus = jobStatus;
+ this.source = source;
+ this.isFinal = isFinal();
+ }
+
+ public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo, Boolean isFinal) {
+ this(jobId, jobStatus, source);
+ this.requestId = requestId;
+ this.additionalInfo = additionalInfo;
+ this.isFinal = isFinal;
+ }
+
+
+
+ public enum SourceStatus {
+ MSO,
+ VID
+ }
+
+ private UUID jobId;
+ private String jobStatus;
+ private SourceStatus source;
+ private UUID requestId;
+ private String additionalInfo;
+
+
+
+ private Boolean isFinal;
+
+ public String getJobStatus() {
+ return jobStatus;
+ }
+
+ public UUID getJobId() {
+ return jobId;
+ }
+
+ public SourceStatus getSource() {
+ return source;
+ }
+
+ public String getAdditionalInfo() {
+ return additionalInfo;
+ }
+
+ public UUID getRequestId() {
+ return requestId;
+ }
+
+
+
+ public Boolean isFinal(){
+ return isFinal;
+ }
+
+ public void setFinal(Boolean aFinal) {
+ isFinal = aFinal;
+ }
+
+ @Override
+ public String toString() {
+ return "JobAuditStatus{" +
+ "jobId=" + jobId +
+ ", jobStatus='" + jobStatus + '\'' +
+ ", source=" + source +
+ ", requestId=" + requestId +
+ ", additionalInfo='" + additionalInfo + '\'' +
+ ", isFinal=" + isFinal +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+
+ if (o == null || getClass() != o.getClass()) return false;
+
+ JobAuditStatus that = (JobAuditStatus) o;
+
+ return new EqualsBuilder()
+ .append(jobId, that.jobId)
+ .append(jobStatus, that.jobStatus)
+ .append(source, that.source)
+ .append(requestId, that.requestId)
+ .append(additionalInfo, that.additionalInfo)
+ .append(isFinal, that.isFinal)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37)
+ .append(jobId)
+ .append(jobStatus)
+ .append(source)
+ .append(requestId)
+ .append(additionalInfo)
+ .append(isFinal)
+ .toHashCode();
+ }
+
+
+
+
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/ServiceInfo.java b/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/ServiceInfo.java
new file mode 100644
index 000000000..371aaf81e
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/asyncInstantiation/ServiceInfo.java
@@ -0,0 +1,75 @@
+package org.onap.vid.model.asyncInstantiation;
+
+
+import vid.automation.test.model.JobStatus;
+
+import java.util.Date;
+
+public class ServiceInfo {
+
+ public String jobId;
+ public String templateId;
+ public String userId;
+ public JobStatus jobStatus;
+ public Date statusModifiedDate;
+ public boolean hidden;
+ public boolean pause;
+ public String owningEntityId;
+ public String owningEntityName;
+ public String project;
+ public String aicZoneId;
+ public String aicZoneName;
+ public String tenantId;
+ public String tenantName;
+ public String regionId;
+ public String regionName;
+ public String serviceType;
+ public String subscriberName;
+ public String serviceInstanceId;
+ public String serviceInstanceName;
+ public String serviceModelId;
+ public String serviceModelName;
+ public String serviceModelVersion;
+ public Date createdBulkDate;
+
+ public ServiceInfo(){
+
+ }
+
+ public ServiceInfo(String userId, JobStatus jobStatus, boolean pause, String owningEntityId, String owningEntityName, String project, String aicZoneId, String aicZoneName, String tenantId, String tenantName, String regionId, String regionName, String serviceType, String subscriberName, String serviceInstanceId, String serviceInstanceName, String serviceModelId, String serviceModelName, String serviceModelVersion, String jobId, String templateId) {
+ this.userId = userId;
+ this.jobStatus = jobStatus;
+ this.pause = pause;
+ this.owningEntityId = owningEntityId;
+ this.owningEntityName = owningEntityName;
+ this.project = project;
+ this.aicZoneId = aicZoneId;
+ this.aicZoneName = aicZoneName;
+ this.tenantId = tenantId;
+ this.tenantName = tenantName;
+ this.regionId = regionId;
+ this.regionName = regionName;
+ this.serviceType = serviceType;
+ this.subscriberName = subscriberName;
+ this.serviceInstanceId = serviceInstanceId;
+ this.serviceInstanceName = serviceInstanceName;
+ this.serviceModelId = serviceModelId;
+ this.serviceModelName = serviceModelName;
+ this.serviceModelVersion = serviceModelVersion;
+ this.jobId = jobId;
+ this.templateId = templateId;
+ }
+
+ public JobStatus getJobStatus() {
+ return jobStatus;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionResponse.java b/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionResponse.java
new file mode 100644
index 000000000..eb60b85f0
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionResponse.java
@@ -0,0 +1,15 @@
+package org.onap.vid.model.category;
+
+import org.onap.vid.model.workflow.ListOfErrorsResponse;
+
+import java.util.List;
+
+public class AddCategoryOptionResponse extends ListOfErrorsResponse {
+
+ public AddCategoryOptionResponse() {
+ }
+
+ public AddCategoryOptionResponse(List<String> errors) {
+ super(errors);
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionsRequest.java b/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionsRequest.java
new file mode 100644
index 000000000..dc12a79a2
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/category/AddCategoryOptionsRequest.java
@@ -0,0 +1,13 @@
+package org.onap.vid.model.category;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AddCategoryOptionsRequest {
+
+ public List<String> options;
+
+ public AddCategoryOptionsRequest() {
+ options = new ArrayList<>();
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOption.java b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOption.java
new file mode 100644
index 000000000..39e7eb76f
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOption.java
@@ -0,0 +1,34 @@
+package org.onap.vid.model.category;
+
+public class CategoryParameterOption {
+
+ private String appId;
+ private String name;
+
+
+ public CategoryParameterOption() {
+ }
+
+ public CategoryParameterOption(String appId, String name) {
+ setAppId(appId);
+ setName(name);
+ }
+
+ public String getAppId() {
+ return appId;
+ }
+
+ public void setAppId(String appId) {
+ this.appId = appId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOptionRep.java b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOptionRep.java
new file mode 100644
index 000000000..fd554ef6a
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParameterOptionRep.java
@@ -0,0 +1,31 @@
+package org.onap.vid.model.category;
+
+public class CategoryParameterOptionRep {
+
+ private String id;
+ private String name;
+
+ public CategoryParameterOptionRep() {
+ }
+
+ public CategoryParameterOptionRep(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParametersResponse.java b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParametersResponse.java
new file mode 100644
index 000000000..721c01e5b
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/category/CategoryParametersResponse.java
@@ -0,0 +1,27 @@
+package org.onap.vid.model.category;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+import java.util.Map;
+
+public class CategoryParametersResponse {
+
+ private Map<String, List<CategoryParameterOptionRep>> categoryParameters;
+
+ public CategoryParametersResponse() {
+ }
+
+ public CategoryParametersResponse(Map<String, List<CategoryParameterOptionRep>> categoryParameters) {
+ this.categoryParameters = categoryParameters;
+ }
+
+ @JsonProperty("categoryParameters")
+ public Map<String, List<CategoryParameterOptionRep>> getCategoryParameters() {
+ return categoryParameters;
+ }
+
+ public void setCategoryParameters(Map<String, List<CategoryParameterOptionRep>> categoryParameters) {
+ this.categoryParameters = categoryParameters;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/probe/ExternalComponentStatus.java b/vid-automation/src/test/java/org/onap/vid/model/probe/ExternalComponentStatus.java
new file mode 100644
index 000000000..439764945
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/probe/ExternalComponentStatus.java
@@ -0,0 +1,28 @@
+package org.onap.vid.model.probe;
+
+public class ExternalComponentStatus {
+ public enum Component {AAI, MSO}
+ private Component component;
+ private boolean available;
+ private HttpRequestMetadata metadata;
+
+ public ExternalComponentStatus(){}
+
+ public ExternalComponentStatus(Component component, boolean isAvailable, HttpRequestMetadata metadata) {
+ this.component = component;
+ this.available = isAvailable;
+ this.metadata = metadata;
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public boolean isAvailable() {
+ return available;
+ }
+
+ public HttpRequestMetadata getMetadata() {
+ return metadata;
+ }
+} \ No newline at end of file
diff --git a/vid-automation/src/test/java/org/onap/vid/model/probe/HttpRequestMetadata.java b/vid-automation/src/test/java/org/onap/vid/model/probe/HttpRequestMetadata.java
new file mode 100644
index 000000000..1443c4660
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/probe/HttpRequestMetadata.java
@@ -0,0 +1,49 @@
+package org.onap.vid.model.probe;
+
+import org.springframework.http.HttpMethod;
+
+public class HttpRequestMetadata {
+
+
+ public HttpMethod getHttpMethod() {
+ return httpMethod;
+ }
+
+ public int getHttpCode() {
+ return httpCode;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getRawData() {
+ return rawData;
+ }
+
+ public float getDuration() {
+ return duration;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ private HttpMethod httpMethod;
+ private int httpCode;
+ private String url;
+ private String rawData;
+ private String description;
+ private float duration;
+
+ public HttpRequestMetadata(){
+ }
+
+ public HttpRequestMetadata(HttpMethod httpMethod,int httpCode, String url, String rawData, String description) {
+ this.httpMethod = httpMethod;
+ this.httpCode = httpCode;
+ this.url = url;
+ this.rawData = rawData;
+ this.description = description;
+ }
+} \ No newline at end of file
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/GetVnfWorkflowRelationRequest.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/GetVnfWorkflowRelationRequest.java
new file mode 100644
index 000000000..3e831747f
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/GetVnfWorkflowRelationRequest.java
@@ -0,0 +1,28 @@
+package org.onap.vid.model.workflow;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class GetVnfWorkflowRelationRequest {
+
+ public GetVnfWorkflowRelationRequest() {
+ }
+
+ public GetVnfWorkflowRelationRequest(List<VnfDetails> vnfsDetails) {
+ this.vnfsDetails = vnfsDetails;
+ }
+
+ @JsonProperty("vnfsDetails")
+ private List<VnfDetails> vnfsDetails;
+
+ @JsonProperty("vnfsDetails")
+ public List<VnfDetails> getVnfDetails() {
+ return vnfsDetails;
+ }
+
+ @JsonProperty("vnfsDetails")
+ public void setVnfDetails(List<VnfDetails> vnfDetails) {
+ this.vnfsDetails = vnfDetails;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/GetWorkflowsResponse.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/GetWorkflowsResponse.java
new file mode 100644
index 000000000..cc52017e4
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/GetWorkflowsResponse.java
@@ -0,0 +1,24 @@
+package org.onap.vid.model.workflow;
+
+import java.util.List;
+
+public class GetWorkflowsResponse {
+ private List<String> workflows;
+
+ public GetWorkflowsResponse() {
+ }
+
+ public GetWorkflowsResponse(List<String> workflows) {
+ this.workflows = workflows;
+ }
+
+ public List<String> getWorkflows() {
+ return workflows;
+ }
+
+ public void setWorkflows(List<String> workflows) {
+ this.workflows = workflows;
+ }
+
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/ListOfErrorsResponse.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/ListOfErrorsResponse.java
new file mode 100644
index 000000000..0f38c2f4f
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/ListOfErrorsResponse.java
@@ -0,0 +1,24 @@
+package org.onap.vid.model.workflow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ListOfErrorsResponse {
+ protected List<String> errors;
+
+ public ListOfErrorsResponse() {
+ this.errors = new ArrayList<>();
+ }
+
+ public ListOfErrorsResponse(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<String> errors) {
+ this.errors = errors;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetails.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetails.java
new file mode 100644
index 000000000..7e04dc0d1
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetails.java
@@ -0,0 +1,66 @@
+package org.onap.vid.model.workflow;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class VnfDetails {
+
+ public VnfDetails() {
+ }
+
+ public VnfDetails(String UUID, String invariantUUID) {
+ this.UUID = UUID;
+ this.invariantUUID = invariantUUID;
+ }
+
+ @JsonProperty("UUID")
+ private String UUID;
+
+ @JsonProperty("invariantUUID")
+ private String invariantUUID;
+
+ @JsonProperty("UUID")
+ public String getUUID() {
+ return UUID;
+ }
+
+ @JsonProperty("UUID")
+ public void setUUID(String uUID) {
+ UUID = uUID;
+ }
+
+ @JsonProperty("invariantUUID")
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ @JsonProperty("invariantUUID")
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ VnfDetails that = (VnfDetails) o;
+
+ if (getUUID() != null ? !getUUID().equals(that.getUUID()) : that.getUUID() != null) return false;
+ return getInvariantUUID() != null ? getInvariantUUID().equals(that.getInvariantUUID()) : that.getInvariantUUID() == null;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getUUID() != null ? getUUID().hashCode() : 0;
+ result = 31 * result + (getInvariantUUID() != null ? getInvariantUUID().hashCode() : 0);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "VnfDetails{" +
+ "UUID='" + UUID + '\'' +
+ ", invariantUUID='" + invariantUUID + '\'' +
+ '}';
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetailsWithWorkflows.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetailsWithWorkflows.java
new file mode 100644
index 000000000..92d227de9
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfDetailsWithWorkflows.java
@@ -0,0 +1,27 @@
+package org.onap.vid.model.workflow;
+
+
+import java.util.List;
+
+public class VnfDetailsWithWorkflows extends VnfDetails {
+
+ private List<String> workflows;
+
+ public VnfDetailsWithWorkflows() {
+ }
+
+
+ @SuppressWarnings("WeakerAccess")
+ public VnfDetailsWithWorkflows(String UUID, String invariantUUID, List<String> workflows) {
+ super(UUID, invariantUUID);
+ this.workflows = workflows;
+ }
+
+ public List<String> getWorkflows() {
+ return workflows;
+ }
+
+ public void setWorkflows(List<String> workflows) {
+ this.workflows = workflows;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationAllResponse.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationAllResponse.java
new file mode 100644
index 000000000..2a4f0aa37
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationAllResponse.java
@@ -0,0 +1,23 @@
+package org.onap.vid.model.workflow;
+
+import java.util.List;
+
+public class VnfWorkflowRelationAllResponse {
+
+ private List<VnfDetailsWithWorkflows> vnfs;
+
+ public VnfWorkflowRelationAllResponse() {
+ }
+
+ public VnfWorkflowRelationAllResponse(List<VnfDetailsWithWorkflows> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ public List<VnfDetailsWithWorkflows> getVnfs() {
+ return vnfs;
+ }
+
+ public void setVnfs(List<VnfDetailsWithWorkflows> vnfs) {
+ this.vnfs = vnfs;
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationRequest.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationRequest.java
new file mode 100644
index 000000000..b9553bcc5
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationRequest.java
@@ -0,0 +1,31 @@
+package org.onap.vid.model.workflow;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.util.List;
+
+public class VnfWorkflowRelationRequest {
+
+ public VnfWorkflowRelationRequest() {
+ }
+
+ public VnfWorkflowRelationRequest(List<WorkflowsDetail> workflowsDetails) {
+ this.workflowsDetails = workflowsDetails;
+ }
+
+ @JsonProperty("workflowsDetails")
+ private List<WorkflowsDetail> workflowsDetails;
+
+ @JsonProperty("workflowsDetails")
+ public List<WorkflowsDetail> getWorkflowsDetails() {
+ return workflowsDetails;
+ }
+
+ @JsonProperty("workflowsDetails")
+ public void setWorkflowsDetails(List<WorkflowsDetail> workflowsDetails) {
+ this.workflowsDetails = workflowsDetails;
+ }
+
+
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationResponse.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationResponse.java
new file mode 100644
index 000000000..1badf169a
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/VnfWorkflowRelationResponse.java
@@ -0,0 +1,14 @@
+package org.onap.vid.model.workflow;
+
+
+import java.util.List;
+
+public class VnfWorkflowRelationResponse extends ListOfErrorsResponse {
+
+ public VnfWorkflowRelationResponse() {
+ }
+
+ public VnfWorkflowRelationResponse(List<String> errors) {
+ super(errors);
+ }
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/model/workflow/WorkflowsDetail.java b/vid-automation/src/test/java/org/onap/vid/model/workflow/WorkflowsDetail.java
new file mode 100644
index 000000000..609804c68
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/model/workflow/WorkflowsDetail.java
@@ -0,0 +1,43 @@
+package org.onap.vid.model.workflow;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class WorkflowsDetail {
+
+ public WorkflowsDetail() {
+ }
+
+ public WorkflowsDetail(VnfDetails vnfDetails, String workflowName) {
+ this.vnfDetails = vnfDetails;
+ this.workflowName = workflowName;
+ }
+
+ @JsonProperty("vnfDetails")
+ private VnfDetails vnfDetails;
+
+ @JsonProperty("workflowName")
+ private String workflowName;
+
+ @JsonProperty("vnfDetails")
+ public VnfDetails getVnfDetails() {
+ return vnfDetails;
+ }
+ @JsonProperty("vnfDetails")
+ public void setVnfDetails(VnfDetails vnfDetails) {
+ this.vnfDetails = vnfDetails;
+ }
+ @JsonProperty("workflowName")
+ public String getWorkflowName() {
+ return workflowName;
+ }
+ @JsonProperty("workflowName")
+ public void setWorkflowName(String workflowName) {
+ this.workflowName = workflowName;
+ }
+
+ @Override
+ public String toString() {
+ return vnfDetails +
+ ", workflowName='" + workflowName;
+ }
+}
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
new file mode 100644
index 000000000..6656a6c6b
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java
@@ -0,0 +1,91 @@
+package org.onap.vid.more;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
+import org.onap.vid.api.BaseApiTest;
+import org.springframework.web.client.RestTemplate;
+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://wiki.web.att.com/display/KSAT/REST-based+Log+Checker
+ private final static String logChecker = "http://eelflogcheck.it.att.com:31820/validate";
+
+ @BeforeClass
+ public void login() {
+ super.login();
+ }
+
+ @BeforeClass
+ public void setAaiSubscribers() {
+ SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
+ }
+
+ @Test
+ public void validateAuditLogsFormat() {
+ validateLogsFormat("audit");
+ }
+
+ @Test(enabled = false) // no total-score is returned for error-log
+ public void validateErrorLogsFormat() {
+ validateLogsFormat("error");
+ }
+
+ @Test
+ public void validateMetricsLogsFormat() {
+ validateLogsFormat("metrics", "metric");
+ }
+
+ private void validateLogsFormat(String logName) {
+ validateLogsFormat(logName, logName);
+ }
+
+ private void validateLogsFormat(String logName, String logType) {
+
+ String logLines = getLogLines(logName);
+ JsonNode response = getCheckerResults(logType, logLines);
+
+ System.out.println(response);
+ double fieldscore = response.path("summary").path("score").path("fieldscore").asDouble();
+ double overall = response.path("summary").path("score").path("overallscore").asDouble();
+
+ assertThat(fieldscore, is(greaterThan(0.95)));
+ assertThat(overall, is(greaterThan(0.95)));
+
+ }
+
+ private String getLogLines(String logname) {
+ return getLogLines(logname, 5000, 30, restTemplate, uri);
+ }
+
+ public static String getLogLines(String logname, int maxRows, int minRows, RestTemplate restTemplate, URI uri) {
+ String logLines = restTemplate.getForObject(uri + "/logger/" + logname + "?limit={maxRows}", String.class, maxRows);
+ assertThat("expecting at least " + minRows + " rows in " + logname,
+ StringUtils.countMatches(logLines, '\n') + 1,
+ is(greaterThanOrEqualTo(minRows)));
+ return logLines;
+ }
+
+ private JsonNode getCheckerResults(String logtype, String logLines) {
+ Map<String, String> params = new HashMap<>();
+ params.put("format", "raw");
+ params.put("type", logtype);
+ params.put("component", "vid");
+ params.put("data", logLines);
+
+ return restTemplate.postForObject(logChecker, params, JsonNode.class);
+ }
+}
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
new file mode 100644
index 000000000..5a0a0f845
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java
@@ -0,0 +1,184 @@
+package org.onap.vid.more;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.onap.vid.api.OperationalEnvironmentControllerApiTest;
+import org.onap.vid.api.BaseApiTest;
+import org.onap.vid.api.ServiceInstanceMsoApiTest;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import vid.automation.test.services.SimulatorApi;
+
+import java.util.UUID;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.onap.vid.api.CategoryParametersApiTest.GET_CATEGORY_PARAMETER_PROPERTIES;
+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;
+
+public class RequestIdFilterInstalled extends BaseApiTest {
+
+ /*
+ Tests whether every incoming request to VID goes through
+ the requestId filter. This happens by checking the log
+ AND by checking the echoed header.
+
+ The correctness of the Filter itself is done by unit-
+ tests.
+
+ The outgoing (outgress) headers are checked by the REST
+ Clients unit-tests.
+ */
+
+ private static final String ECOMP_REQUEST_ID = "x-ecomp-requestid";
+ private final String ECOMP_REQUEST_ID_ECHO = ECOMP_REQUEST_ID + "-echo";
+
+ @BeforeClass
+ public void login() {
+ super.login();
+ }
+
+ @Test
+ public void frontendApi_doGET_RequestIdReceived() {
+
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.GET,
+ "/operationalEnvironment/requestStatus?requestId=" + OperationalEnvironmentControllerApiTest.GET_STATUS_REQUEST_UUID,
+ null,
+ OperationalEnvironmentControllerApiTest.GET_CLOUD_RESOURCES_REQUEST_STATUS
+ );
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+
+ }
+
+ @Test
+ public void frontendApi_doPOST_RequestIdReceived() {
+
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.POST,
+ "/" + ServiceInstanceMsoApiTest.MSO_DEACTIVATE_SERVICE_INSTANCE,
+ "{}",
+ ServiceInstanceMsoApiTest.DEACTIVATE_OK_JSON
+ );
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+ }
+
+ @Test
+ public void frontendApi_doPOSTWithClientError_RequestIdReceived() {
+
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.POST,
+ "/" + MSO_CREATE_CONFIGURATION,
+ "i'm not a json"
+ );
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+
+ }
+
+
+ @Test(groups = { "worksOnlyWithLocalhostVID" })
+ public void mopOwningEntityApi_doGET_RequestIdReceived() {
+
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.GET,
+ "/" + GET_CATEGORY_PARAMETER_PROPERTIES + "?familyName=PARAMETER_STANDARDIZATION",
+ null
+ );
+
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+
+ /*
+ test should be for:
+ x few FE requests;
+ x few FE errors requests;
+ - few UI elements requests;
+ x scheduler callback;
+ - MOP of workflows;
+ x MOP of OE;
+ - health-check
+ */
+ }
+
+ @Test
+ public void schedulerApi_doPOST_RequestIdReceived() {
+
+ final String anyInstanceId = "any instance id";
+ SimulatorApi.registerExpectation(
+ "mso_in_place_software_update_ok.json",
+ ImmutableMap.of("SERVICE_INSTANCE_ID", anyInstanceId, "VNF_INSTANCE_ID", anyInstanceId), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.POST,
+ "/change-management/workflow/" + anyInstanceId,
+ "{}"
+ );
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+
+ }
+
+ @Test
+ public void healthcheck_doGET_RequestIdReceived(){
+ final Pair<HttpEntity, String> responseAndUuid = makeRequest(
+ HttpMethod.GET, "/healthCheck", null
+ );
+ assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
+ }
+
+ private void assertThatUuidInResponseAndUuidIsInARecentLog(Pair<HttpEntity, String> responseAndUuid) {
+ assertThatResponseHasUuid(responseAndUuid.getLeft(), responseAndUuid.getRight());
+ assertThatTermIsInARecentLog(responseAndUuid.getRight());
+ }
+
+ private void assertThatResponseHasUuid(HttpEntity response, String uuid) {
+ // THIS TEST IS NOT JUST NICE TO HAVE, it also lets us know
+ // that the request/response ran through our "promise request
+ // id" filter, which is great!
+ assertThat(response, not(nullValue()));
+ assertThat(response.getHeaders().get(ECOMP_REQUEST_ID_ECHO), containsInAnyOrder(uuid));
+ }
+
+ private void assertThatTermIsInARecentLog(String uuid) {
+ final ImmutableList<String> logLines = ImmutableList.of(
+ LoggerFormatTest.getLogLines("audit", 5, 0, restTemplate, uri),
+ LoggerFormatTest.getLogLines("error", 5, 0, restTemplate, uri)
+ );
+
+ // Assert that audit *OR* error has the uuid
+ assertThat("uuid not found in any log", logLines, hasItem(containsString(uuid)));
+ }
+
+ private Pair<HttpEntity, String> makeRequest(HttpMethod httpMethod, String url, String body) {
+ return makeRequest(httpMethod, url, body, null);
+ }
+
+ private Pair<HttpEntity, String> makeRequest(HttpMethod httpMethod, String url, String body, String expectationFilename) {
+ final String uuid = UUID.randomUUID().toString();
+ final HttpHeaders headers = new HttpHeaders();
+ headers.add(ECOMP_REQUEST_ID, uuid);
+ headers.add(AUTHORIZATION, "Basic 123==");
+
+ SimulatorApi.clearExpectations();
+ if (!StringUtils.isEmpty(expectationFilename)) {
+ SimulatorApi.registerExpectation(expectationFilename, APPEND);
+ }
+ SimulatorApi.registerExpectation("aai_get_full_subscribers.json", APPEND);
+ SimulatorApi.registerExpectation("ecompportal_getSessionSlotCheckInterval.json", APPEND);
+
+ HttpEntity entity = new HttpEntity<>(body, headers);
+ ResponseEntity<String> response = null;
+ response = restTemplateErrorAgnostic.exchange(uri + url,
+ httpMethod, entity, String.class);
+
+ return Pair.of(response, uuid);
+ }
+
+}
diff --git a/vid-automation/src/test/java/org/onap/vid/more/SimulatorLoaderTest.java b/vid-automation/src/test/java/org/onap/vid/more/SimulatorLoaderTest.java
new file mode 100644
index 000000000..bc550ae19
--- /dev/null
+++ b/vid-automation/src/test/java/org/onap/vid/more/SimulatorLoaderTest.java
@@ -0,0 +1,133 @@
+package org.onap.vid.more;
+
+import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIBadBodyForGetServicesGet;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPNFByRegionErrorPut;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAISearchNodeQueryEmptyResult;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIServiceDesignAndCreationPut;
+import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
+import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetUserGet;
+import org.onap.simulator.presetGenerator.presets.mso.PresetActivateServiceInstancePost;
+import org.onap.simulator.presetGenerator.presets.mso.PresetDeactivateServiceInstancePost;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstancePost;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet;
+import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet;
+import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet;
+import org.onap.vid.api.BaseApiTest;
+import org.springframework.http.HttpMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import vid.automation.test.services.SimulatorApi;
+import vid.automation.test.services.SimulatorApi.RegistrationStrategy;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
+
+public class SimulatorLoaderTest extends BaseApiTest {
+
+
+ protected Invocation.Builder createSimulatorRequestBuilder(BasePreset preset) {
+ WebTarget webTarget = client.target(SimulatorApi.getSimulationUri() + preset.getReqPath());
+ webTarget = addQueryParamsToWebTarget(preset, webTarget);
+ return webTarget.request()
+ .accept("application/json");
+ }
+
+ private WebTarget addQueryParamsToWebTarget(BasePreset preset, WebTarget webTarget) {
+ if (preset.getQueryParams() != null) {
+ for (Map.Entry<String, List> entry : preset.getQueryParams().entrySet()) {
+ webTarget = webTarget.queryParam(entry.getKey(), entry.getValue().toArray());
+ }
+ }
+ return webTarget;
+ }
+
+ @DataProvider
+ public static Object[][] presetClassesWithPutPost(Method test) {
+ return new Object[][]{
+ {new PresetAAIGetPNFByRegionErrorPut()},
+ {new PresetAAIServiceDesignAndCreationPut("a","b")},
+ {new PresetDeactivateServiceInstancePost()},
+ {new PresetActivateServiceInstancePost()},
+ {new PresetMSOCreateServiceInstancePost()}
+ };
+ }
+
+ @Test(dataProvider = "presetClassesWithPutPost")
+ public<C extends BasePreset> void presetPutPost_WhenLoaded_SimulatorReturnsFakeValues(C preset) {
+ registerExpectationFromPreset(preset, RegistrationStrategy.CLEAR_THEN_SET);
+
+ Response cres = createSimulatorRequestBuilder(preset)
+ .method(preset.getReqMethod().name(),
+ Entity.entity(preset.getRequestBody(), MediaType.APPLICATION_JSON));
+
+ int status = cres.getStatus();
+
+ assertEquals(status, preset.getResponseCode());
+ }
+
+ @DataProvider
+ public static Object[][] presetWithGetInstances(Method test) {
+ return new Object[][]{
+ {new PresetAAIGetSubscribersGet()},
+ {new PresetGetSessionSlotCheckIntervalGet()},
+ {new PresetGetUserGet()},
+ {new PresetAAIGetServicesGet()},
+ {new PresetSDCGetServiceMetadataGet("a" , "b", "serviceCreationTest.zip")},
+ {new PresetSDCGetServiceToscaModelGet( "a", "serviceCreationTest.zip")},
+ {new PresetMSOOrchestrationRequestGet()},
+ {new PresetAAIGetNetworkZones()},
+ {new PresetAAISearchNodeQueryEmptyResult()},
+ {new PresetAAIBadBodyForGetServicesGet("not a json")},
+ };
+ }
+
+ @Test(dataProvider = "presetWithGetInstances")
+ public <C extends BasePreset> void assertPresetWithGetMethod(C preset) {
+ registerExpectationFromPreset(preset, RegistrationStrategy.CLEAR_THEN_SET);
+
+ Response cres = createSimulatorRequestBuilder(preset).get();
+
+ int status = cres.getStatus();
+
+ assertEquals(status, preset.getResponseCode());
+ }
+
+ @Test(expectedExceptions = { RuntimeException.class }, expectedExceptionsMessageRegExp = ".*SimulatorLoaderTest.*")
+ public void assertPresetThatThrowException() {
+
+ registerExpectationFromPresets(Collections.singletonList(
+ new BasePreset() {
+
+ @Override
+ public HttpMethod getReqMethod() {
+ throw new RuntimeException();
+ }
+
+ @Override
+ public String getReqPath() {
+ return null;
+ }
+
+ @Override
+ protected String getRootPath() {
+ return null;
+ }
+ }), RegistrationStrategy.CLEAR_THEN_SET);
+ }
+
+}