/*
* Copyright (C) 2020 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.wehotel.fizz.input;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author linwaiwai
* @author francis
*
*/
public class ClientInputConfig extends InputConfig {
private boolean debug;
private String path;
private String method;
private Map headers = new HashMap();
private Map langDef;
private Map bodyDef;
private Map headersDef;
private Map paramsDef;
private Map scriptValidate;
private Map validateResponse;
@SuppressWarnings("unchecked")
public ClientInputConfig(Map configBody) {
if(configBody.get("debug") != null) {
this.debug = (boolean) configBody.get("debug");
}
this.path = (String) configBody.get("path");
if (configBody.get("headers") != null) {
setHeaders((Map) configBody.get("headers"));
}
if (configBody.get("method") != null) {
setMethod((String) configBody.get("method"));
} else {
setMethod("GET");
}
if (configBody.get("langDef") != null) {
langDef = ((Map) configBody.get("langDef"));
}
if (configBody.get("bodyDef") != null) {
bodyDef = ((Map) configBody.get("bodyDef"));
}
if (configBody.get("paramsDef") != null) {
paramsDef = ((Map) configBody.get("paramsDef"));
}
if (configBody.get("headersDef") != null) {
headersDef = ((Map) configBody.get("headersDef"));
}
if (configBody.get("scriptValidate") != null) {
scriptValidate = ((Map) configBody.get("scriptValidate"));
}
if (configBody.get("validateResponse") != null) {
validateResponse = ((Map) configBody.get("validateResponse"));
}
}
public ClientInputConfig() {
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Map getLangDef() {
return langDef;
}
public void setLangDef(Map langDef) {
this.langDef = langDef;
}
public Map getHeaders() {
return headers;
}
public void setHeaders(Map headers) {
this.headers = headers;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Map getBodyDef() {
return bodyDef;
}
public void setBodyDef(Map bodyDef) {
this.bodyDef = bodyDef;
}
public Map getHeadersDef() {
return headersDef;
}
public void setHeadersDef(Map headersDef) {
this.headersDef = headersDef;
}
public Map getParamsDef() {
return paramsDef;
}
public void setParamsDef(Map paramsDef) {
this.paramsDef = paramsDef;
}
public Map getScriptValidate() {
return scriptValidate;
}
public void setScriptValidate(Map scriptValidate) {
this.scriptValidate = scriptValidate;
}
public Map getValidateResponse() {
return validateResponse;
}
public void setValidateResponse(Map validateResponse) {
this.validateResponse = validateResponse;
}
}