aboutsummaryrefslogtreecommitdiffstats
path: root/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java')
-rw-r--r--validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
new file mode 100644
index 00000000..cbb2a26a
--- /dev/null
+++ b/validate/sample-mock-generator/src/main/java/org/onap/cli/http/mock/MockRequest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.
+ */
+
+package org.onap.cli.http.mock;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class MockRequest {
+ private String method;
+ private String uri;
+ private Map<String, String> headers;
+ private JsonNode json;
+
+ public String getMethod() {
+ return method;
+ }
+
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String url) throws IOException {
+ URL urlt;
+ urlt = new URL(url);
+ this.uri = urlt.getPath();
+ }
+
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+ public JsonNode getJson() {
+ return json;
+ }
+
+ public void setJson(String json) throws IOException {
+ if (!json.isEmpty()) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ this.json = objectMapper.readTree(json);
+ }
+
+ }
+}