aboutsummaryrefslogtreecommitdiffstats
path: root/test-apis-ci/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'test-apis-ci/src/main/java')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java31
2 files changed, 33 insertions, 0 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index f85f326f03..a4338fb272 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -422,4 +422,6 @@ public interface Urls {
String DELETE_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
String GET_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
+ //VSP Validation Operation
+ final String VSP_VALIDATION_CONFIGURATION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/externaltesting/config";
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
index 4f03767a85..8b5f91b53d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -27,6 +27,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import java.util.*;
@@ -138,6 +139,36 @@ public class OnboardingUtils {
return response;
}
+ public static String getVspValidationConfiguration() throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendGet(url, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot get configuration file");
+ //return response;
+ }
+
+ public static String putVspValidationConfiguration(boolean value) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ String body = String.format("{\"enabled\": \"%s\"}", value);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPut(url, body, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot set configuration file");
+ //return response;
+ }
+
protected static Map<String, String> prepareHeadersMap(String userId) {
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");