diff options
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/rest')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java | 72 | ||||
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java | 8 |
2 files changed, 8 insertions, 72 deletions
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 deleted file mode 100644 index 54ee6464f..000000000 --- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MockedWorkflowsRestClient.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -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.SOWorkflowParameterDefinitions; -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)); - } - - public MsoResponseWrapper2<SOWorkflowParameterDefinitions> getWorkflowParameterDefinitions(Long workflowId) { - return new MsoResponseWrapper2<>(syncRestClient - .get((workflowId <= 3 && workflowId > 0) ? getParametersUrl(workflowId) : getParametersUrl(), - Collections.emptyMap(), - Collections.emptyMap(), - SOWorkflowParameterDefinitions.class)); - } - - @NotNull - private String getWorkflowsUrl() { - return baseUrl + "so/workflows"; - } - - - @NotNull - private String getParametersUrl() { - return baseUrl + "so/workflow-parameters"; - } - - @NotNull - private String getParametersUrl(Long workflowId) { - return baseUrl + "so/workflow-parameters/" + workflowId; - } -} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java index ff7acffcf..0c05b80e2 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java @@ -21,6 +21,7 @@ package org.onap.vid.mso.rest; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; import io.joshworks.restclient.http.HttpResponse; import io.joshworks.restclient.http.JsonNode; import java.text.DateFormat; @@ -40,6 +41,7 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.changeManagement.WorkflowRequestDetail; import org.onap.vid.client.SyncRestClient; import org.onap.vid.model.RequestReferencesContainer; +import org.onap.vid.model.SOWorkflowList; import org.onap.vid.mso.MsoInterface; import org.onap.vid.mso.MsoProperties; import org.onap.vid.mso.MsoResponseWrapper; @@ -473,6 +475,12 @@ public class MsoRestClientNew extends RestMsoImplementation implements MsoInterf } + public HttpResponse<SOWorkflowList> getWorkflowListByModelId(String endpoint){ + String path = baseUrl + endpoint; + + return client.get(path, commonHeaders, Maps.newHashMap(), SOWorkflowList.class); + } + private MsoResponseWrapper createInstance(Object request, String path) { String methodName = "createInstance"; logger.debug(methodName + START); |