diff options
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/mso')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java | 32 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java | 33 |
2 files changed, 49 insertions, 16 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java index fff14ebc3..3bda76406 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoResponseWrapper2.java @@ -28,8 +28,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.joshworks.restclient.http.HttpResponse; @JsonPropertyOrder({ - "status", - "entity" + "status", + "entity" }) /* @@ -41,8 +41,8 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface { static final ObjectMapper objectMapper = new ObjectMapper(); - private final int status; - private final T entity; + private final int status; + private T entity; private final String raw; public MsoResponseWrapper2(RestObject<T> msoResponse) { @@ -51,23 +51,23 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface { this.raw = msoResponse.getRaw(); } - public MsoResponseWrapper2(HttpResponse<T> msoResponse) { - this.status = msoResponse.getStatus(); - this.entity = msoResponse.getBody(); - this.raw = msoResponse.getBody().toString(); - } + public MsoResponseWrapper2(HttpResponse<T> msoResponse) { + this.status = msoResponse.getStatus(); + this.entity = msoResponse.getBody(); + this.raw = msoResponse.getBody().toString(); + } public MsoResponseWrapper2( - @JsonProperty(value = "status", required = true) int status, - @JsonProperty(value = "entity", required = true) T entity) { + @JsonProperty(value = "status", required = true) int status, + @JsonProperty(value = "entity", required = true) T entity) { this.status = status; this.entity = entity; this.raw = null; } public int getStatus() { - return status; - } + return status; + } @Override @JsonIgnore @@ -80,8 +80,8 @@ public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface { } @JsonProperty - public Object getEntity() { - return entity != null ? entity : raw; - } + public Object getEntity() { + return entity != null ? entity : raw; + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java new file mode 100644 index 000000000..313710ebd --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java @@ -0,0 +1,33 @@ +package org.onap.vid.mso.rest; + +import java.util.Collections; +import org.jetbrains.annotations.NotNull; +import org.onap.vid.client.SyncRestClient; +import org.onap.vid.model.SOWorkflows; +import org.onap.vid.mso.MsoResponseWrapper2; + +public class MockedWorkflowsRestClient { + + private SyncRestClient syncRestClient; + private String baseUrl; + + public MockedWorkflowsRestClient(SyncRestClient syncRestClient, String baseUrl) { + this.syncRestClient = syncRestClient; + this.baseUrl = baseUrl; + } + + public MsoResponseWrapper2<SOWorkflows> getWorkflows(String vnfName) { + // Temporary skip vnfName and call mocked service + return new MsoResponseWrapper2<>(syncRestClient + .get(getWorkflowsUrl(), + Collections.emptyMap(), + Collections.emptyMap(), + SOWorkflows.class)); + } + + @NotNull + private String getWorkflowsUrl() { + return baseUrl + "so/workflows"; + } + +} |