diff options
Diffstat (limited to 'vid-automation/src/test/java/org/opencomp')
22 files changed, 0 insertions, 1118 deletions
diff --git a/vid-automation/src/test/java/org/opencomp/vid/model/aai/AaiResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/aai/AaiResponse.java deleted file mode 100644 index 3124ca407..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/aai/AaiResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opencomp.vid.model.aai; - -import com.google.common.base.MoreObjects; -import org.opencomp.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/opencomp/vid/model/asyncInstantiation/JobAuditStatus.java b/vid-automation/src/test/java/org/opencomp/vid/model/asyncInstantiation/JobAuditStatus.java deleted file mode 100644 index 254eb9c00..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/asyncInstantiation/JobAuditStatus.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.opencomp.vid.model.asyncInstantiation; - -import com.google.common.collect.ImmutableList; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import vid.automation.test.model.JobStatus; - -import java.util.Date; -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/opencomp/vid/model/asyncInstantiation/ServiceInfo.java b/vid-automation/src/test/java/org/opencomp/vid/model/asyncInstantiation/ServiceInfo.java deleted file mode 100644 index ee3cd7a77..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/asyncInstantiation/ServiceInfo.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/category/AddCategoryOptionResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/category/AddCategoryOptionResponse.java deleted file mode 100644 index 9cfaec954..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/category/AddCategoryOptionResponse.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.opencomp.vid.model.category; - -import org.opencomp.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/opencomp/vid/model/category/AddCategoryOptionsRequest.java b/vid-automation/src/test/java/org/opencomp/vid/model/category/AddCategoryOptionsRequest.java deleted file mode 100644 index 2c3edfde5..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/category/AddCategoryOptionsRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/category/CategoryParameterOption.java b/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParameterOption.java deleted file mode 100644 index 2aa839247..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParameterOption.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/category/CategoryParameterOptionRep.java b/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParameterOptionRep.java deleted file mode 100644 index 27b42e66f..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParameterOptionRep.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/category/CategoryParametersResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParametersResponse.java deleted file mode 100644 index 9b9cc8408..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/category/CategoryParametersResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/probe/ExternalComponentStatus.java b/vid-automation/src/test/java/org/opencomp/vid/model/probe/ExternalComponentStatus.java deleted file mode 100644 index 8d548842f..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/probe/ExternalComponentStatus.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/probe/HttpRequestMetadata.java b/vid-automation/src/test/java/org/opencomp/vid/model/probe/HttpRequestMetadata.java deleted file mode 100644 index 4ab5ae4a8..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/probe/HttpRequestMetadata.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/GetVnfWorkflowRelationRequest.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/GetVnfWorkflowRelationRequest.java deleted file mode 100644 index e2f15ba95..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/GetVnfWorkflowRelationRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/GetWorkflowsResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/GetWorkflowsResponse.java deleted file mode 100644 index f1005b2aa..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/GetWorkflowsResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/ListOfErrorsResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/ListOfErrorsResponse.java deleted file mode 100644 index 60b733fe4..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/ListOfErrorsResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/VnfDetails.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfDetails.java deleted file mode 100644 index a7b27356c..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfDetails.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/VnfDetailsWithWorkflows.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfDetailsWithWorkflows.java deleted file mode 100644 index 953e25b77..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfDetailsWithWorkflows.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/VnfWorkflowRelationAllResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationAllResponse.java deleted file mode 100644 index 3f0cc3ef9..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationAllResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/VnfWorkflowRelationRequest.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationRequest.java deleted file mode 100644 index 86ac2b40c..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationRequest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/VnfWorkflowRelationResponse.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationResponse.java deleted file mode 100644 index fdc57ad17..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/VnfWorkflowRelationResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opencomp.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/opencomp/vid/model/workflow/WorkflowsDetail.java b/vid-automation/src/test/java/org/opencomp/vid/model/workflow/WorkflowsDetail.java deleted file mode 100644 index a67f724c8..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/model/workflow/WorkflowsDetail.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.opencomp.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/opencomp/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/opencomp/vid/more/LoggerFormatTest.java deleted file mode 100644 index 8b3d244b5..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/more/LoggerFormatTest.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.opencomp.vid.more; - -import com.fasterxml.jackson.databind.JsonNode; -import org.apache.commons.lang3.StringUtils; -import org.opencomp.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; -import org.opencomp.vid.api.BaseApiTest; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.web.client.RestTemplate; -import org.testng.SkipException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import vid.automation.test.services.SimulatorApi; - -import java.net.URI; -import java.time.LocalDate; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static java.util.Collections.singletonList; -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/opencomp/vid/more/RequestIdFilterInstalled.java b/vid-automation/src/test/java/org/opencomp/vid/more/RequestIdFilterInstalled.java deleted file mode 100644 index 637904766..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/more/RequestIdFilterInstalled.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.opencomp.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.opencomp.vid.api.BaseApiTest; -import org.opencomp.vid.api.OperationalEnvironmentControllerApiTest; -import org.opencomp.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.opencomp.vid.api.CategoryParametersApiTest.GET_CATEGORY_PARAMETER_PROPERTIES; -import static org.opencomp.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/opencomp/vid/more/SimulatorLoaderTest.java b/vid-automation/src/test/java/org/opencomp/vid/more/SimulatorLoaderTest.java deleted file mode 100644 index 2bcf0698f..000000000 --- a/vid-automation/src/test/java/org/opencomp/vid/more/SimulatorLoaderTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.opencomp.vid.more; - -import org.opencomp.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.opencomp.simulator.presetGenerator.presets.aai.*; -import org.opencomp.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.opencomp.simulator.presetGenerator.presets.ecompportal_att.PresetGetUserGet; -import org.opencomp.simulator.presetGenerator.presets.mso.PresetActivateServiceInstancePost; -import org.opencomp.simulator.presetGenerator.presets.mso.PresetDeactivateServiceInstancePost; -import org.opencomp.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstancePost; -import org.opencomp.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; -import org.opencomp.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; -import org.opencomp.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; -import org.opencomp.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); - } - -} |