Merge branch 'develop' into feature/core

This commit is contained in:
linwaiwai
2021-07-20 14:12:16 +08:00
committed by GitHub
26 changed files with 693 additions and 298 deletions

View File

@@ -4,7 +4,7 @@ English | [简体中文](./README.md)
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a> <a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p> </p>
<p> <p>
<img alt="Version" src="https://img.shields.io/badge/version-2.1.0-blue.svg?cacheSeconds=2592000" /> <img alt="Version" src="https://img.shields.io/badge/version-2.2.0-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank"> <a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a> </a>
@@ -104,6 +104,7 @@ Starting from v1.3.0, the frontend and backend of the management backend are mer
| v1.5.1 | v1.5.1 | | v1.5.1 | v1.5.1 |
| v2.0.0 | v2.0.0 | | v2.0.0 | v2.0.0 |
| v2.1.0 | v2.1.0 | | v2.1.0 | v2.1.0 |
| v2.2.0 | v2.2.0 |
Please download the corresponding management backend version according to the version of the community version Please download the corresponding management backend version according to the version of the community version

View File

@@ -3,7 +3,7 @@
<a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a> <a href="https://www.fizzgate.com"><img src="https://raw.githubusercontent.com/wiki/wehotel/fizz-gateway-community/img/icon-color.png" width="70%"></a>
</p> </p>
<p> <p>
<img alt="Version" src="https://img.shields.io/badge/version-2.1.0-blue.svg?cacheSeconds=2592000" /> <img alt="Version" src="https://img.shields.io/badge/version-2.2.0-blue.svg?cacheSeconds=2592000" />
<a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank"> <a href="http://www.fizzgate.com/fizz-gateway-community/" target="_blank">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
</a> </a>
@@ -104,6 +104,7 @@ API地址http://demo.fizzgate.com/proxy/[服务名]/[API_Path]
| v1.5.1 | v1.5.1 | | v1.5.1 | v1.5.1 |
| v2.0.0 | v2.0.0 | | v2.0.0 | v2.0.0 |
| v2.1.0 | v2.1.0 | | v2.1.0 | v2.1.0 |
| v2.2.0 | v2.2.0 |
请根据社区版的版本下载对应的管理后台版本 请根据社区版的版本下载对应的管理后台版本

View File

@@ -190,6 +190,36 @@ var common = {
} }
var result = ctx[stepName]['result'] || {}; var result = ctx[stepName]['result'] || {};
return field ? result[field] : result; return field ? result[field] : result;
},
/**
* 获取步骤循环结果
* @param {*} ctx 上下文 【必填】
* @param {*} stepName 步骤名【必填】
*/
getStepCircle: function (ctx, stepName){
if(!ctx || !stepName || !ctx[stepName]){
return null;
}
// 返回循环结果数组
return ctx[stepName]['circle'];
},
/**
* 获取请求的循环结果
* @param {*} ctx 上下文 【必填】
* @param {*} stepName 步骤名【必填】
*/
getRequestCircle: function (ctx, stepName, requestName){
if(!ctx || !stepName || !requestName){
return null;
}
if(!ctx[stepName] || !ctx[stepName]['requests'] || !ctx[stepName]['requests'][requestName] ||
!ctx[stepName]['requests'][requestName]['request']){
return null;
}
// 返回循环结果数组
return ctx[stepName]['requests'][requestName]['circle'];
} }
/* *********** step request end ************ */ /* *********** step request end ************ */

View File

@@ -35,6 +35,28 @@ var context = {
requests: { requests: {
// 接口1 // 接口1
request1: { request1: {
// 请求相关参数
request:{
url: "",
method: "GET/POST",
headers: {},
body: {}
},
// 根据转换规则转换后的接口响应
response: {
headers: {},
body: {}
},
// 请求循环组件当前循环对象
item: null,
// 请求循环组件当前循环对象的下标
index: null,
// 请求循环的结果
circle: [{
// 循环对象
item: null,
// 循环对象的下标
index: null,
// 请求相关参数 // 请求相关参数
request:{ request:{
url: "", url: "",
@@ -47,6 +69,11 @@ var context = {
headers: {}, headers: {},
body: {} body: {}
} }
}],
// 条件组件的执行结果
conditionResults: [
{'我的条件1': true}
]
}, },
// 接口2 // 接口2
request2: { request2: {
@@ -56,16 +83,55 @@ var context = {
headers: {}, headers: {},
body: {} body: {}
}, },
response: {
headers: {},
body: {}
},
// 请求循环组件当前循环对象
item: null,
// 请求循环组件当前循环对象的下标
index: null,
// 请求循环的结果
circle: [{
// 循环对象
item: null,
// 循环对象的下标
index: null,
// 请求相关参数
request:{
url: "",
method: "GET/POST",
headers: {},
body: {}
},
// 根据转换规则转换后的接口响应
response: { response: {
headers: {}, headers: {},
body: {} body: {}
} }
}],
// 条件组件的执行结果
conditionResults: [
{'我的条件1': true}
]
} }
//... //...
}, },
// 步骤结果
result: {},
// 步骤循环组件当前循环对象
item: null,
// 步骤循环组件当前循环对象的下标
index: null,
// 步骤循环的结果
circle:[{
// 循环对象
item: null,
// 循环对象的下标
index: null,
// 步骤结果 // 步骤结果
result: {} result: {}
}]
} }
} }

View File

@@ -12,7 +12,7 @@
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<artifactId>fizz-bootstrap</artifactId> <artifactId>fizz-bootstrap</artifactId>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>

View File

@@ -190,6 +190,36 @@ var common = {
} }
var result = ctx[stepName]['result'] || {}; var result = ctx[stepName]['result'] || {};
return field ? result[field] : result; return field ? result[field] : result;
},
/**
* 获取步骤循环结果
* @param {*} ctx 上下文 【必填】
* @param {*} stepName 步骤名【必填】
*/
getStepCircle: function (ctx, stepName){
if(!ctx || !stepName || !ctx[stepName]){
return null;
}
// 返回循环结果数组
return ctx[stepName]['circle'];
},
/**
* 获取请求的循环结果
* @param {*} ctx 上下文 【必填】
* @param {*} stepName 步骤名【必填】
*/
getRequestCircle: function (ctx, stepName, requestName){
if(!ctx || !stepName || !requestName){
return null;
}
if(!ctx[stepName] || !ctx[stepName]['requests'] || !ctx[stepName]['requests'][requestName] ||
!ctx[stepName]['requests'][requestName]['request']){
return null;
}
// 返回循环结果数组
return ctx[stepName]['requests'][requestName]['circle'];
} }
/* *********** step request end ************ */ /* *********** step request end ************ */

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -17,6 +17,7 @@
package we.util; package we.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -36,6 +37,10 @@ import org.springframework.util.MultiValueMap;
*/ */
public class MapUtil { public class MapUtil {
private static final String KEY = "key";
private static final String VALUE = "value";
public static HttpHeaders toHttpHeaders(Map<String, Object> params) { public static HttpHeaders toHttpHeaders(Map<String, Object> params) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
@@ -66,7 +71,6 @@ public class MapUtil {
return headers; return headers;
} }
public static MultiValueMap<String, String> toMultiValueMap(Map<String, Object> params) { public static MultiValueMap<String, String> toMultiValueMap(Map<String, Object> params) {
MultiValueMap<String, String> mvmap = new LinkedMultiValueMap<>(); MultiValueMap<String, String> mvmap = new LinkedMultiValueMap<>();
@@ -124,15 +128,16 @@ public class MapUtil {
return mvmap; return mvmap;
} }
/** /**
* Extract form data from multipart map exclude file * Extract form data from multipart map exclude file
*
* @param params * @param params
* @param fileKeyPrefix * @param fileKeyPrefix
* @param filePartMap Map * @param filePartMap Map
* @return * @return
*/ */
public static Map<String, Object> extractFormData(MultiValueMap<String, Part> params, String fileKeyPrefix, Map<String, FilePart> filePartMap) { public static Map<String, Object> extractFormData(MultiValueMap<String, Part> params, String fileKeyPrefix,
Map<String, FilePart> filePartMap) {
HashMap<String, Object> m = new HashMap<>(); HashMap<String, Object> m = new HashMap<>();
if (params == null || params.isEmpty()) { if (params == null || params.isEmpty()) {
return m; return m;
@@ -174,11 +179,13 @@ public class MapUtil {
/** /**
* Replace file field with FilePart object * Replace file field with FilePart object
*
* @param params * @param params
* @param fileKeyPrefix * @param fileKeyPrefix
* @param filePartMap * @param filePartMap
*/ */
public static void replaceWithFilePart(MultiValueMap<String, Object> params, String fileKeyPrefix, Map<String, FilePart> filePartMap) { public static void replaceWithFilePart(MultiValueMap<String, Object> params, String fileKeyPrefix,
Map<String, FilePart> filePartMap) {
if (params == null || params.isEmpty() || filePartMap == null || filePartMap.isEmpty()) { if (params == null || params.isEmpty() || filePartMap == null || filePartMap.isEmpty()) {
return; return;
} }
@@ -255,9 +262,24 @@ public class MapUtil {
return rs; return rs;
} }
public static MultiValueMap<String, Object> upperCaseKey(MultiValueMap<String, Object> m) {
MultiValueMap<String, Object> rs = new LinkedMultiValueMap<>();
if (m == null || m.isEmpty()) {
return rs;
}
for (Entry<String, List<Object>> entry : m.entrySet()) {
rs.put(entry.getKey().toUpperCase(), entry.getValue());
}
return rs;
}
/** /**
* Set value by pathsupport multiple levelsega.b.c <br> * Set value by pathsupport multiple levelsega.b.c <br>
* Do NOT use this method if field name contains a dot <br> * Do NOT use this method if field name contains a dot <br>
*
* @param data * @param data
* @param path * @param path
* @param value * @param value
@@ -287,6 +309,7 @@ public class MapUtil {
/** /**
* Get value by path, support multiple levelsega.b.c <br> * Get value by path, support multiple levelsega.b.c <br>
* Do NOT use this method if field name contains a dot <br> * Do NOT use this method if field name contains a dot <br>
*
* @param data * @param data
* @param path * @param path
* @return * @return
@@ -316,6 +339,7 @@ public class MapUtil {
/** /**
* Merge maps, merge src to target * Merge maps, merge src to target
*
* @param target * @param target
* @param src * @param src
* @return * @return
@@ -339,4 +363,70 @@ public class MapUtil {
return target; return target;
} }
/**
* Convert list to map and merge multiple values<br>
* Example: <br>
* List as:<br>
* [{"key": "abc", "value": "aaa"},{"key": "abc", "value": "xyz"},{"key":
* "a123", "value": 666}]<br>
* Merge Result:<br>
* {"abc": ["aaa","xyz"], "a123": 666} <br>
*
* @param obj
* @return
*/
@SuppressWarnings("unchecked")
public static Map<String, Object> list2Map(Object obj) {
// Compatible with older version configuration
if (obj instanceof Map) {
return (Map<String, Object>) obj;
}
if (obj instanceof List) {
Map<String, Object> rs = new HashMap<>();
List<Map<String, Object>> list = (List<Map<String, Object>>) obj;
if (list == null || list.size() == 0) {
return rs;
}
for (Map<String, Object> m : list) {
String k = m.get(KEY).toString();
Object v = m.get(VALUE);
if (rs.containsKey(k)) {
List<Object> vals = null;
if (rs.get(k) instanceof List) {
vals = (List<Object>) rs.get(k);
} else {
vals = new ArrayList<>();
vals.add(rs.get(k));
}
vals.add(v);
rs.put(k, vals);
} else {
rs.put(k, v);
}
}
return rs;
}
return null;
}
/**
* Convert list to MultiValueMap<br>
* List format example:<br>
* [{"key": "abc", "value": "aaa"},{"key": "abc", "value": "xyz"},,{"key":
* "a123", "value": 666}]<br>
*
* @param list
* @return
*/
public static MultiValueMap<String, Object> listToMultiValueMap(List<Map<String, Object>> list) {
MultiValueMap<String, Object> mvmap = new LinkedMultiValueMap<>();
if (list == null || list.size() == 0) {
return mvmap;
}
for (Map<String, Object> m : list) {
mvmap.add(m.get(KEY).toString(), m.get(VALUE));
}
return mvmap;
}
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -32,6 +32,7 @@ import reactor.core.publisher.Mono;
import we.exception.ExecuteScriptException; import we.exception.ExecuteScriptException;
import we.exception.RedirectException; import we.exception.RedirectException;
import we.exception.StopAndResponseException; import we.exception.StopAndResponseException;
import we.fizz.exception.FizzRuntimeException;
import we.flume.clients.log4j2appender.LogService; import we.flume.clients.log4j2appender.LogService;
import we.legacy.RespEntity; import we.legacy.RespEntity;
import we.util.JacksonUtils; import we.util.JacksonUtils;
@@ -81,6 +82,19 @@ public class FilterExceptionHandlerConfig {
return resp.writeWith(Mono.just(resp.bufferFactory().wrap(rs.toString().getBytes()))); return resp.writeWith(Mono.just(resp.bufferFactory().wrap(rs.toString().getBytes())));
} }
} }
if (t instanceof FizzRuntimeException) {
FizzRuntimeException ex = (FizzRuntimeException) t;
resp.getHeaders().add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
RespEntity rs = null;
String reqId = exchange.getRequest().getId();
if (ex.getStepContext() != null && ex.getStepContext().returnContext()) {
rs = new RespEntity(HttpStatus.INTERNAL_SERVER_ERROR.value(), t.getMessage(), reqId, ex.getStepContext());
return resp.writeWith(Mono.just(resp.bufferFactory().wrap(JacksonUtils.writeValueAsString(rs).getBytes())));
} else {
rs = new RespEntity(HttpStatus.INTERNAL_SERVER_ERROR.value(), t.getMessage(), reqId);
return resp.writeWith(Mono.just(resp.bufferFactory().wrap(rs.toString().getBytes())));
}
}
Mono<Void> vm; Mono<Void> vm;
Object fc = exchange.getAttributes().get(WebUtils.FILTER_CONTEXT); Object fc = exchange.getAttributes().get(WebUtils.FILTER_CONTEXT);
if (fc == null) { // t came from flow control filter if (fc == null) { // t came from flow control filter

View File

@@ -119,12 +119,12 @@ public class Pipeline {
}else { }else {
LinkedList<Step> opSteps = (LinkedList<Step>) steps.clone(); LinkedList<Step> opSteps = (LinkedList<Step>) steps.clone();
Step step1 = opSteps.removeFirst(); Step step1 = opSteps.removeFirst();
Mono<List<StepResponse>> result = runStep(step1, null).expand(response -> { Mono<List<StepResponse>> result = runStep(step1, null).expand(lastStepResponse -> {
if (opSteps.isEmpty() || response.isStop()) { if (opSteps.isEmpty() || lastStepResponse.isStop()) {
return Mono.empty(); return Mono.empty();
} }
Step step = opSteps.pop(); Step step = opSteps.pop();
return runStep(step, response); return runStep(step, lastStepResponse);
}).flatMap(response -> Flux.just(response)).collectList(); }).flatMap(response -> Flux.just(response)).collectList();
return result.flatMap(clientResponse -> { return result.flatMap(clientResponse -> {
return handleOutput(input); return handleOutput(input);
@@ -132,7 +132,9 @@ public class Pipeline {
} }
} }
private Mono<StepResponse> runStep(Step step, StepResponse response){ private Mono<StepResponse> runStep(Step step, StepResponse lastStepResponse){
StepResponse stepResponse = new StepResponse(step, null, new HashMap<String, Map<String, Object>>());
stepContext.put(step.getName(), stepResponse);
List<IComponent> components = step.getComponents(); List<IComponent> components = step.getComponents();
if (components != null && components.size() > 0) { if (components != null && components.size() > 0) {
StepContextPosition stepCtxPos = new StepContextPosition(step.getName()); StepContextPosition stepCtxPos = new StepContextPosition(step.getName());

View File

@@ -115,8 +115,7 @@ public class Step {
public void beforeRun(StepContext<String, Object> stepContext2, StepResponse response ) { public void beforeRun(StepContext<String, Object> stepContext2, StepResponse response ) {
stepContext = stepContext2; stepContext = stepContext2;
lastStepResponse = response; lastStepResponse = response;
StepResponse stepResponse = new StepResponse(this, null, new HashMap<String, Map<String, Object>>()); StepResponse stepResponse = (StepResponse) stepContext.get(this.name);
stepContext.put(name, stepResponse);
Map<String, InputConfig> configs = this.getRequestConfigs(); Map<String, InputConfig> configs = this.getRequestConfigs();
for(String configName :configs.keySet()) { for(String configName :configs.keySet()) {
InputConfig inputConfig = configs.get(configName); InputConfig inputConfig = configs.get(configName);

View File

@@ -801,6 +801,48 @@ public class StepContext<K, V> extends ConcurrentHashMap<K, V> {
circle.add(circleResult); circle.add(circleResult);
} }
/**
* 设置判断条件组件结果<br>
* Set result of condition components <br>
*
* @param stepName step name
* @param requestName request name
* @param conditionDesc condition description, such as: <br>
* circle[0]-execCondition:my condition 1<br>
* circle[1]-breakCondition:my condition 2<br>
* condition:my condition 3<br>
* @param rs result of condition component
*/
public void addConditionResult(String stepName, String requestName, String conditionDesc, boolean rs) {
if (requestName == null) {
StepResponse stepResponse = (StepResponse) this.get(stepName);
if (stepResponse == null) {
return;
}
List<Map<String, Object>> results = (List<Map<String, Object>>) stepResponse.getConditionResults();
if (results == null) {
results = new ArrayList<>();
stepResponse.setConditionResults(results);
}
Map<String, Object> result = new HashMap<>();
result.put(conditionDesc, rs);
results.add(result);
} else {
Map<String, Object> request = getStepRequest(stepName, requestName);
if (request == null) {
return;
}
List<Map<String, Object>> results = (List<Map<String, Object>>) request.get("conditionResults");
if (results == null) {
results = new ArrayList<>();
request.put("conditionResults", results);
}
Map<String, Object> result = new HashMap<>();
result.put(conditionDesc, rs);
results.add(result);
}
}
/** /**
* 获取请求的循环对象<br> * 获取请求的循环对象<br>
* Returns the current circle item of request<br> * Returns the current circle item of request<br>
@@ -808,12 +850,12 @@ public class StepContext<K, V> extends ConcurrentHashMap<K, V> {
* @param stepName * @param stepName
* @param requestName * @param requestName
*/ */
public List<Map<String, Object>> getRequestCircleItem(String stepName, String requestName) { public Object getRequestCircleItem(String stepName, String requestName) {
Map<String, Object> request = getStepRequest(stepName, requestName); Map<String, Object> request = getStepRequest(stepName, requestName);
if (request == null) { if (request == null) {
return null; return null;
} }
return (List<Map<String, Object>>) request.get("circle"); return request.get("item");
} }
/** /**
@@ -823,12 +865,12 @@ public class StepContext<K, V> extends ConcurrentHashMap<K, V> {
* @param stepName * @param stepName
* @param requestName * @param requestName
*/ */
public Object getRequestCircle(String stepName, String requestName) { public List<Map<String, Object>> getRequestCircle(String stepName, String requestName) {
Map<String, Object> request = getStepRequest(stepName, requestName); Map<String, Object> request = getStepRequest(stepName, requestName);
if (request == null) { if (request == null) {
return null; return null;
} }
return request.get("item"); return (List<Map<String, Object>>) request.get("circle");
} }
private Object deepCopy(Object obj) { private Object deepCopy(Object obj) {

View File

@@ -35,6 +35,8 @@ public class StepResponse {
private Integer index; private Integer index;
// circle results // circle results
private List<Map<String,Object>> circle; private List<Map<String,Object>> circle;
// result of condition components
private List<Map<String,Object>> conditionResults;
public StepResponse(Step aStep, HashMap item, Map<String, Map<String, Object>> requests) { public StepResponse(Step aStep, HashMap item, Map<String, Map<String, Object>> requests) {
setStepName(aStep.getName()); setStepName(aStep.getName());
@@ -96,5 +98,11 @@ public class StepResponse {
public void setIndex(Integer index) { public void setIndex(Integer index) {
this.index = index; this.index = index;
} }
public List<Map<String, Object>> getConditionResults() {
return conditionResults;
}
public void setConditionResults(List<Map<String, Object>> conditionResults) {
this.conditionResults = conditionResults;
}
} }

View File

@@ -98,60 +98,20 @@ public class ComponentHelper {
if (conditions != null && conditions.size() > 0) { if (conditions != null && conditions.size() > 0) {
ONode ctxNode = toONode(stepContext); ONode ctxNode = toONode(stepContext);
for (Condition c : conditions) { for (Condition c : conditions) {
if (!c.exec(ctxNode)) { boolean rs = c.exec(ctxNode);
return null; stepContext.addConditionResult(stepCtxPos.getStepName(), stepCtxPos.getRequestName(), c.getDesc(),
rs);
if (!rs) {
return Mono.empty();
} }
} }
} }
if (circle != null) { if (circle != null) {
return circle.exec(stepContext, stepCtxPos, f); return circle.exec(stepContext, stepCtxPos, f);
} else {
return f.apply(stepContext, stepCtxPos);
} }
// // conditions before circle component
// List<Condition> conditions1 = new ArrayList<>();
// // conditions after circle component
// List<Condition> conditions2 = new ArrayList<>();
// Circle circle = null;
// for (IComponent component : components) {
// if (ComponentTypeEnum.CIRCLE == component.getType()) {
// circle = (Circle) component;
// }
// if (circle == null && ComponentTypeEnum.CONDITION == component.getType()) {
// conditions1.add((Condition) component);
// }
// if (circle != null && ComponentTypeEnum.CONDITION == component.getType()) {
// conditions2.add((Condition) component);
// }
// }
//
// if (conditions1 != null && conditions1.size() > 0) {
// ONode ctxNode = toONode(stepContext);
// for (Condition c : conditions1) {
// if (!c.exec(ctxNode)) {
// return null;
// }
// }
// }
//
// if (circle != null) {
// return circle.exec(stepContext, (ctx) -> {
// boolean canRun = true;
// if (conditions2 != null && conditions2.size() > 0) {
// ONode ctxNode = toONode(ctx);
// for (Condition c : conditions2) {
// if (!c.exec(ctxNode)) {
// canRun = false;
// }
// }
// }
// if (canRun) {
// return f.apply(ctx);
// } else {
// return Mono.empty();
// }
//
// });
// }
} }
return Mono.empty(); return Mono.empty();
} }

View File

@@ -25,9 +25,9 @@ package we.fizz.component;
*/ */
public enum OperatorEnum { public enum OperatorEnum {
EQ("eq"), NE("ne"), GT("gt"), GE("ge"), LT("lt"), LE("le"), CONTAINS("contains"), NOT_CONTAIN("notContain"), CONTAINS_ANY("containsAny"), EQ("eq"), NE("ne"), GT("gt"), GE("ge"), LT("lt"), LE("le"), CONTAINS("contains"), NOTCONTAIN("notContain"), CONTAINSANY("containsAny"),
IS_NULL("isNull"), IS_NOT_NULL("isNotNull"), IS_BLANK("isBlank"), IS_NOT_BLANK("isNotBlank"), IS_EMPTY("isEmpty"), ISNULL("isNull"), ISNOTNULL("isNotNull"), ISBLANK("isBlank"), ISNOTBLANK("isNotBlank"), ISEMPTY("isEmpty"),
IS_NOT_EMPTY("isNotEmpty"); ISNOTEMPTY("isNotEmpty");
private String code; private String code;

View File

@@ -21,11 +21,8 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Function;
import org.noear.snack.ONode; import org.noear.snack.ONode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.Data; import lombok.Data;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
@@ -39,7 +36,6 @@ import we.fizz.component.ValueTypeEnum;
import we.fizz.component.condition.Condition; import we.fizz.component.condition.Condition;
import we.fizz.exception.FizzRuntimeException; import we.fizz.exception.FizzRuntimeException;
import we.fizz.input.PathMapping; import we.fizz.input.PathMapping;
import we.fizz.input.RPCInput;
/** /**
* Circle component * Circle component
@@ -102,7 +98,7 @@ public class Circle implements IComponent {
/** /**
* Reference value of dataSource * Reference value of dataSource
*/ */
private List<Object> refValue; private Object refValue;
private boolean refReadFlag; private boolean refReadFlag;
@@ -113,8 +109,12 @@ public class Circle implements IComponent {
if (dataSource == null) { if (dataSource == null) {
return fixedValue; return fixedValue;
} }
if (dataSource instanceof Integer || dataSource instanceof Long) { if (dataSource instanceof Integer || dataSource instanceof Long || dataSource instanceof String) {
try {
fixedValue = Integer.valueOf(dataSource.toString()); fixedValue = Integer.valueOf(dataSource.toString());
} catch (Exception e) {
throw new FizzRuntimeException("invalid data source, fixed data source must be a positive integer");
}
if (fixedValue.intValue() < 1) { if (fixedValue.intValue() < 1) {
throw new FizzRuntimeException("invalid data source, fixed data source must be a positive integer"); throw new FizzRuntimeException("invalid data source, fixed data source must be a positive integer");
} }
@@ -125,7 +125,7 @@ public class Circle implements IComponent {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private List<Object> getRefValue(ONode ctxNode) { private Object getRefValue(ONode ctxNode) {
if (refReadFlag) { if (refReadFlag) {
return refValue; return refValue;
} }
@@ -136,8 +136,24 @@ public class Circle implements IComponent {
if (value instanceof Collection) { if (value instanceof Collection) {
refValue = (List<Object>) value; refValue = (List<Object>) value;
return refValue; return refValue;
} else if (value instanceof Integer || value instanceof Long || value instanceof String) {
try {
Integer times = Integer.valueOf(value.toString());
if (times.intValue() < 1) {
throw new FizzRuntimeException(
"invalid data source, data source must be a positive integer or an array");
}
refValue = times;
} catch (FizzRuntimeException e) {
throw e;
} catch (Exception e) {
throw new FizzRuntimeException(
"invalid data source, data source must be a positive integer or an array");
}
return refValue;
} else { } else {
throw new FizzRuntimeException("invalid data source, referenced data source must be a array"); throw new FizzRuntimeException(
"invalid data source, referenced data source must be a positive integer or an array");
} }
} }
@@ -146,22 +162,25 @@ public class Circle implements IComponent {
* *
* @return * @return
*/ */
@SuppressWarnings("unchecked")
public CircleItem next(ONode ctxNode) { public CircleItem next(ONode ctxNode) {
if (ValueTypeEnum.FIXED.equals(dataSourceType)) { if (ValueTypeEnum.FIXED.equals(dataSourceType)) {
Integer total = this.getFixedValue(ctxNode); Integer total = this.getFixedValue(ctxNode);
if (index == null) { if (index == null) {
index = 0; index = 0;
currentItem = index; currentItem = index + 1;
return new CircleItem(currentItem, index); return new CircleItem(currentItem, index);
} else if (index.intValue() < total.intValue() - 1) { } else if (index.intValue() < total.intValue() - 1) {
index = index + 1; index = index + 1;
currentItem = index; currentItem = index + 1;
return new CircleItem(currentItem, index); return new CircleItem(currentItem, index);
} else { } else {
return null; return null;
} }
} else if (ValueTypeEnum.REF.equals(dataSourceType)) { } else if (ValueTypeEnum.REF.equals(dataSourceType)) {
List<Object> list = this.getRefValue(ctxNode); Object refValue = this.getRefValue(ctxNode);
if (refValue instanceof Collection) {
List<Object> list = (List<Object>) refValue;
if (index == null) { if (index == null) {
index = 0; index = 0;
currentItem = list.get(index); currentItem = list.get(index);
@@ -173,6 +192,20 @@ public class Circle implements IComponent {
} else { } else {
return null; return null;
} }
} else if (refValue instanceof Integer) {
Integer total = (Integer) refValue;
if (index == null) {
index = 0;
currentItem = index + 1;
return new CircleItem(currentItem, index);
} else if (index.intValue() < total.intValue() - 1) {
index = index + 1;
currentItem = index + 1;
return new CircleItem(currentItem, index);
} else {
return null;
}
}
} }
return null; return null;
} }
@@ -183,11 +216,15 @@ public class Circle implements IComponent {
* @param ctxNode * @param ctxNode
* @return * @return
*/ */
public boolean canExec(ONode ctxNode) { public boolean canExec(int index, ONode ctxNode, StepContext<String, Object> stepContext,
StepContextPosition stepCtxPos) {
if (this.execConditions != null && this.execConditions.size() > 0) { if (this.execConditions != null && this.execConditions.size() > 0) {
try { try {
for (Condition condition : execConditions) { for (Condition c : execConditions) {
if (!condition.exec(ctxNode)) { boolean rs = c.exec(ctxNode);
stepContext.addConditionResult(stepCtxPos.getStepName(), stepCtxPos.getRequestName(),
"circle[" + index + "]-execCondition:" + c.getDesc(), rs);
if (!rs) {
return false; return false;
} }
} }
@@ -204,11 +241,15 @@ public class Circle implements IComponent {
* @param ctxNode * @param ctxNode
* @return * @return
*/ */
public boolean breakCircle(ONode ctxNode) { public boolean breakCircle(int index, ONode ctxNode, StepContext<String, Object> stepContext,
StepContextPosition stepCtxPos) {
if (this.breakConditions != null && this.breakConditions.size() > 0) { if (this.breakConditions != null && this.breakConditions.size() > 0) {
try { try {
for (Condition condition : breakConditions) { for (Condition c : breakConditions) {
if (condition.exec(ctxNode)) { boolean rs = c.exec(ctxNode);
stepContext.addConditionResult(stepCtxPos.getStepName(), stepCtxPos.getRequestName(),
"circle[" + index + "]-breakCondition:" + c.getDesc(), rs);
if (rs) {
return true; return true;
} }
} }
@@ -219,11 +260,11 @@ public class Circle implements IComponent {
return false; return false;
} }
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "rawtypes" })
public Mono<Object> exec(StepContext<String, Object> stepContext, StepContextPosition stepCtxPos, public Mono<Object> exec(StepContext<String, Object> stepContext, StepContextPosition stepCtxPos,
BiFunction<StepContext, StepContextPosition, Mono> f) { BiFunction<StepContext, StepContextPosition, Mono> f) {
ONode ctxNode = ComponentHelper.toONode(stepContext); ONode ctxNode1 = ComponentHelper.toONode(stepContext);
CircleItem nextItem = this.next(ctxNode); CircleItem nextItem = this.next(ctxNode1);
if (nextItem != null) { if (nextItem != null) {
Mono<List<CircleItemResult>> colloctList = Mono.just(new CircleItemResult(nextItem, null)).expand(circleItemResult -> { Mono<List<CircleItemResult>> colloctList = Mono.just(new CircleItemResult(nextItem, null)).expand(circleItemResult -> {
// put nextItem to step context and ctxNode for further JSON path mapping // put nextItem to step context and ctxNode for further JSON path mapping
@@ -234,21 +275,23 @@ public class Circle implements IComponent {
} else { } else {
stepContext.setStepCircleItem(stepCtxPos.getStepName(), cItem.getItem(), cItem.getIndex()); stepContext.setStepCircleItem(stepCtxPos.getStepName(), cItem.getItem(), cItem.getIndex());
} }
ONode ctxNode = circleItemResult.ctxNode;
PathMapping.setByPath(ctxNode, stepCtxPos.getPath() + ".item", cItem.getItem(), true); PathMapping.setByPath(ctxNode, stepCtxPos.getPath() + ".item", cItem.getItem(), true);
PathMapping.setByPath(ctxNode, stepCtxPos.getPath() + ".index", cItem.getIndex(), true); PathMapping.setByPath(ctxNode, stepCtxPos.getPath() + ".index", cItem.getIndex(), true);
if (!this.canExec(ctxNode)) { if (!this.canExec(cItem.getIndex(), ctxNode, stepContext, stepCtxPos)) {
return Mono.just(new CircleItemResult(this.next(ctxNode), null)); return Mono.just(new CircleItemResult(ctxNode, this.next(ctxNode), null));
}
if (this.breakCircle(ctxNode)) {
return Mono.empty();
} }
return f.apply(stepContext, stepCtxPos).flatMap(r -> { return f.apply(stepContext, stepCtxPos).flatMap(r -> {
CircleItem nextItem2 = this.next(ctxNode); ONode ctxNode2 = ComponentHelper.toONode(stepContext);
if (this.breakCircle(cItem.getIndex(), ctxNode, stepContext, stepCtxPos)) {
return Mono.empty();
}
CircleItem nextItem2 = this.next(ctxNode2);
if (nextItem2 == null) { if (nextItem2 == null) {
return Mono.empty(); return Mono.empty();
} }
return Mono.just(new CircleItemResult(nextItem2, r)); return Mono.just(new CircleItemResult(ctxNode2, nextItem2, r));
}); });
}).flatMap(circleItemResult -> Flux.just(circleItemResult)).collectList(); }).flatMap(circleItemResult -> Flux.just(circleItemResult)).collectList();
return colloctList.flatMap(list -> { return colloctList.flatMap(list -> {
@@ -269,10 +312,12 @@ public class Circle implements IComponent {
@Data @Data
class CircleItemResult { class CircleItemResult {
private ONode ctxNode;
private CircleItem nextItem; private CircleItem nextItem;
private Object result; private Object result;
public CircleItemResult(CircleItem nextItem, Object result) { public CircleItemResult(ONode ctxNode, CircleItem nextItem, Object result) {
this.ctxNode = ctxNode;
this.nextItem = nextItem; this.nextItem = nextItem;
this.result = result; this.result = result;
} }

View File

@@ -28,6 +28,7 @@ import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import we.fizz.component.ComponentTypeEnum; import we.fizz.component.ComponentTypeEnum;
import we.fizz.component.IComponent; import we.fizz.component.IComponent;
import we.fizz.component.OperatorEnum; import we.fizz.component.OperatorEnum;
@@ -43,7 +44,6 @@ import we.fizz.input.PathMapping;
* *
*/ */
@Data @Data
@AllArgsConstructor
public class Condition implements IComponent { public class Condition implements IComponent {
private static final String type = ComponentTypeEnum.CONDITION.getCode(); private static final String type = ComponentTypeEnum.CONDITION.getCode();
@@ -56,6 +56,13 @@ public class Condition implements IComponent {
private ConditionValue value2; private ConditionValue value2;
public Condition(String desc, ConditionValue value1, OperatorEnum operator, ConditionValue value2) {
this.desc = desc;
this.value1 = value1;
this.operator = operator;
this.value2 = value2;
}
@Override @Override
public ComponentTypeEnum getType() { public ComponentTypeEnum getType() {
return ComponentTypeEnum.getEnumByCode(type); return ComponentTypeEnum.getEnumByCode(type);
@@ -124,6 +131,7 @@ public class Condition implements IComponent {
case CONTAINS: case CONTAINS:
if (v1 == null) { if (v1 == null) {
rs = false; rs = false;
break;
} }
if (v1 instanceof Collection && !(v2 instanceof Collection)) { if (v1 instanceof Collection && !(v2 instanceof Collection)) {
Collection coll1 = (Collection) v1; Collection coll1 = (Collection) v1;
@@ -140,9 +148,10 @@ public class Condition implements IComponent {
throw new FizzRuntimeException("value2 can not be a collection"); throw new FizzRuntimeException("value2 can not be a collection");
} }
break; break;
case NOT_CONTAIN: case NOTCONTAIN:
if (v1 == null) { if (v1 == null) {
rs = true; rs = true;
break;
} }
if (v1 instanceof Collection && !(v2 instanceof Collection)) { if (v1 instanceof Collection && !(v2 instanceof Collection)) {
Collection coll1 = (Collection) v1; Collection coll1 = (Collection) v1;
@@ -159,9 +168,10 @@ public class Condition implements IComponent {
throw new FizzRuntimeException("value2 can not be a collection"); throw new FizzRuntimeException("value2 can not be a collection");
} }
break; break;
case CONTAINS_ANY: case CONTAINSANY:
if (v1 == null || v2 == null) { if (v1 == null || v2 == null) {
rs = false; rs = false;
break;
} }
if (v1 instanceof Collection && v2 instanceof Collection) { if (v1 instanceof Collection && v2 instanceof Collection) {
Collection coll1 = (Collection) v1; Collection coll1 = (Collection) v1;
@@ -173,23 +183,23 @@ public class Condition implements IComponent {
throw new FizzRuntimeException("value2 must be a collection"); throw new FizzRuntimeException("value2 must be a collection");
} }
break; break;
case IS_NULL: case ISNULL:
rs = v1 == null; rs = v1 == null;
break; break;
case IS_NOT_NULL: case ISNOTNULL:
rs = v1 != null; rs = v1 != null;
break; break;
case IS_BLANK: case ISBLANK:
rs = v1 == null || StringUtils.isBlank(v1.toString()); rs = v1 == null || StringUtils.isBlank(v1.toString());
break; break;
case IS_NOT_BLANK: case ISNOTBLANK:
rs = v1 != null && StringUtils.isNotBlank(v1.toString()); rs = v1 != null && StringUtils.isNotBlank(v1.toString());
break; break;
case IS_EMPTY: case ISEMPTY:
rs = v1 == null || (v1 instanceof Collection && ((Collection) v1).isEmpty()) rs = v1 == null || (v1 instanceof Collection && ((Collection) v1).isEmpty())
|| (v1 instanceof Map && ((Map) v1).isEmpty()); || (v1 instanceof Map && ((Map) v1).isEmpty());
break; break;
case IS_NOT_EMPTY: case ISNOTEMPTY:
if (v1 != null) { if (v1 != null) {
if (v1 instanceof Collection) { if (v1 instanceof Collection) {
rs = !((Collection) v1).isEmpty(); rs = !((Collection) v1).isEmpty();
@@ -235,7 +245,7 @@ public class Condition implements IComponent {
} }
private Object cast(RefDataTypeEnum type, Object val) { private Object cast(RefDataTypeEnum type, Object val) {
if (type != null) { if (type != null && val != null) {
switch (type) { switch (type) {
case INT: case INT:
val = Integer.valueOf(val.toString()); val = Integer.valueOf(val.toString());

View File

@@ -1,11 +1,37 @@
package we.fizz.exception; package we.fizz.exception;
import we.fizz.StepContext;
public class FizzRuntimeException extends RuntimeException { public class FizzRuntimeException extends RuntimeException {
private StepContext<String, Object> stepContext;
public FizzRuntimeException(String message) { public FizzRuntimeException(String message) {
super(message); super(message);
} }
public FizzRuntimeException(String message, Throwable cause) { public FizzRuntimeException(String message, Throwable cause) {
super(message, cause); super(message, cause);
this.setStackTrace(cause.getStackTrace());
} }
public FizzRuntimeException(String message, StepContext<String, Object> stepContext) {
super(message);
this.stepContext = stepContext;
}
public FizzRuntimeException(String message, Throwable cause, StepContext<String, Object> stepContext) {
super(message, cause);
this.setStackTrace(cause.getStackTrace());
this.stepContext = stepContext;
}
public StepContext<String, Object> getStepContext() {
return stepContext;
}
public void setStepContext(StepContext<String, Object> stepContext) {
this.stepContext = stepContext;
}
} }

View File

@@ -19,13 +19,14 @@ package we.fizz.input;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.noear.snack.ONode; import org.noear.snack.ONode;
import we.constants.CommonConstants; import we.constants.CommonConstants;
import we.fizz.StepContext; import we.fizz.StepContext;
import we.fizz.exception.FizzRuntimeException;
import we.util.MapUtil; import we.util.MapUtil;
/** /**
@@ -105,14 +106,15 @@ public class PathMapping {
return target.toObject(Map.class); return target.toObject(Map.class);
} }
@SuppressWarnings("unchecked")
public static ONode transform(ONode ctxNode, Map<String, Object> rules, boolean supportMultiLevels) { public static ONode transform(ONode ctxNode, Map<String, Object> rules, boolean supportMultiLevels) {
ONode target = ONode.load(new HashMap()); ONode target = ONode.load(new HashMap());
if (rules.isEmpty()) { if (rules.isEmpty()) {
return target; return target;
} }
Map<String, String> rs = new HashMap<>(); Map<String, Object> rs = new HashMap<>();
Map<String, String> types = new HashMap<>(); Map<String, Object> types = new HashMap<>();
for (Entry<String, Object> entry : rules.entrySet()) { for (Entry<String, Object> entry : rules.entrySet()) {
if (entry.getValue() instanceof String) { if (entry.getValue() instanceof String) {
String val = (String) entry.getValue(); String val = (String) entry.getValue();
@@ -123,6 +125,25 @@ public class PathMapping {
} else { } else {
rs.put(entry.getKey(), val); rs.put(entry.getKey(), val);
} }
} else if (entry.getValue() instanceof List) {
List<Object> values = (List<Object>) entry.getValue();
List<String> vList = new ArrayList<>();
List<String> tList = new ArrayList<>();
for (Object v : values) {
if (v instanceof String) {
String val = (String) v;
Optional<String> optType = typeList.stream().filter(s -> val.startsWith(s + " ")).findFirst();
if (optType.isPresent()) {
vList.add(val.substring(optType.get().length() + 1));
tList.add(optType.get());
} else {
vList.add(val);
tList.add(null);
}
}
}
rs.put(entry.getKey(), vList);
types.put(entry.getKey(), tList);
} }
} }
@@ -134,8 +155,46 @@ public class PathMapping {
Object starValObj = null; Object starValObj = null;
String starEntryKey = null; String starEntryKey = null;
for (Entry<String, String> entry : rs.entrySet()) { for (Entry<String, Object> entry : rs.entrySet()) {
String path = entry.getValue(); if (entry.getValue() instanceof String) {
String path = (String) entry.getValue();
String type = (String) types.get(entry.getKey());
Object obj = getRefValue(ctxNode, type, path);
if (CommonConstants.WILDCARD_STAR.equals(entry.getKey())) {
starValObj = obj;
starEntryKey = entry.getKey();
} else {
setByPath(target, entry.getKey(), obj, supportMultiLevels);
}
} else if (entry.getValue() instanceof List) {
List<String> refs = (List<String>) entry.getValue();
List<String> tList = (List<String>) types.get(entry.getKey());
List<Object> refValList = new ArrayList<>();
for (int i = 0; i < refs.size(); i++) {
String path = refs.get(i);
String type = tList.get(i);
Object obj = getRefValue(ctxNode, type, path);
// Only header form-data and query Parameter support multiple values, merge result into
// one a list
if (obj instanceof List) {
refValList.addAll((List<Object>) obj);
} else {
refValList.add(obj);
}
}
setByPath(target, entry.getKey(), refValList, supportMultiLevels);
}
}
if(starEntryKey != null) {
setByPath(target, starEntryKey, starValObj, supportMultiLevels);
}
return target;
}
private static Object getRefValue(ONode ctxNode, String type, String path) {
Object obj = null;
try {
String p = path; String p = path;
String defaultValue = null; String defaultValue = null;
if (path.indexOf("|") != -1) { if (path.indexOf("|") != -1) {
@@ -143,15 +202,23 @@ public class PathMapping {
defaultValue = path.substring(path.indexOf("|") + 1); defaultValue = path.substring(path.indexOf("|") + 1);
} }
ONode val = select(ctxNode, handlePath(p)); ONode val = select(ctxNode, handlePath(p));
Object obj = null;
if (val != null && !val.isNull()) { if (val != null && !val.isNull()) {
obj = val; obj = val;
} else { } else {
obj = defaultValue; obj = defaultValue;
} }
if (obj != null && types.containsKey(entry.getKey())) { if (obj != null && type != null) {
switch (types.get(entry.getKey())) { obj = cast(obj, type);
}
} catch (Exception e) {
e.printStackTrace();
throw new FizzRuntimeException(String.format("path mapping errer: %s , path mapping data: %s %s", e.getMessage(), type, path), e);
}
return obj;
}
private static Object cast(Object obj, String type) {
switch (type) {
case "Integer": case "Integer":
case "int": { case "int": {
if (obj instanceof ONode) { if (obj instanceof ONode) {
@@ -205,20 +272,7 @@ public class PathMapping {
break; break;
} }
} }
} return obj;
if (CommonConstants.WILDCARD_STAR.equals(entry.getKey())) {
starValObj = obj;
starEntryKey = entry.getKey();
} else {
setByPath(target, entry.getKey(), obj, supportMultiLevels);
}
}
if(starEntryKey != null) {
setByPath(target, starEntryKey, starValObj, supportMultiLevels);
}
return target;
} }
public static ONode select(ONode ctxNode, String path) { public static ONode select(ONode ctxNode, String path) {
@@ -251,6 +305,9 @@ public class PathMapping {
* @return * @return
*/ */
public static Object getValueByPath(ONode ctxNode, String path) { public static Object getValueByPath(ONode ctxNode, String path) {
if (StringUtils.isBlank(path)) {
return null;
}
String p = path; String p = path;
String defaultValue = null; String defaultValue = null;
if (path.indexOf("|") != -1) { if (path.indexOf("|") != -1) {
@@ -270,7 +327,14 @@ public class PathMapping {
} }
Map<String, Object> rs = new HashMap<>(); Map<String, Object> rs = new HashMap<>();
for (Entry<String, Object> entry : rules.entrySet()) { for (Entry<String, Object> entry : rules.entrySet()) {
if (!(entry.getValue() instanceof String)) { if (entry.getValue() instanceof List) {
List<Object> values = (List<Object>) entry.getValue();
for (Object v : values) {
if (!(v instanceof String)) {
rs.put(entry.getKey(), v);
}
}
} else if (!(entry.getValue() instanceof String) && entry.getValue() instanceof Map) {
rs.put(entry.getKey(), entry.getValue()); rs.put(entry.getKey(), entry.getValue());
} }
} }
@@ -418,6 +482,7 @@ public class PathMapping {
*/ */
public static Map<String, Object> transform(ONode ctxNode, StepContext<String, Object> stepContext, public static Map<String, Object> transform(ONode ctxNode, StepContext<String, Object> stepContext,
Map<String, Object> fixed, Map<String, Object> mappingRules, boolean supportMultiLevels) { Map<String, Object> fixed, Map<String, Object> mappingRules, boolean supportMultiLevels) {
try {
if (fixed != null && fixed.containsKey(CommonConstants.WILDCARD_TILDE)) { if (fixed != null && fixed.containsKey(CommonConstants.WILDCARD_TILDE)) {
Object val = fixed.get(CommonConstants.WILDCARD_TILDE); Object val = fixed.get(CommonConstants.WILDCARD_TILDE);
fixed = new HashMap<>(); fixed = new HashMap<>();
@@ -434,15 +499,18 @@ public class PathMapping {
} }
if (mappingRules != null) { if (mappingRules != null) {
// 路径映射 // 路径映射
ONode target = PathMapping.transform(ctxNode, mappingRules, supportMultiLevels); ONode target = transform(ctxNode, mappingRules, supportMultiLevels);
// 脚本转换 // 脚本转换
Map<String, Object> scriptRules = PathMapping.getScriptRules(mappingRules); Map<String, Object> scriptRules = getScriptRules(mappingRules);
Map<String, Object> scriptResult = ScriptHelper.executeScripts(target, scriptRules, ctxNode, stepContext, supportMultiLevels); Map<String, Object> scriptResult = ScriptHelper.executeScripts(target, scriptRules, ctxNode, stepContext, supportMultiLevels);
if (scriptResult != null && !scriptResult.isEmpty()) { if (scriptResult != null && !scriptResult.isEmpty()) {
result = MapUtil.merge(result, scriptResult); result = MapUtil.merge(result, scriptResult);
} }
} }
return result; return result;
}catch(FizzRuntimeException e) {
throw new FizzRuntimeException(e.getMessage(), e, stepContext);
}
} }
public static Map<String, Object> convertPath(Map<String, Object> fixed, boolean supportMultiLevels) { public static Map<String, Object> convertPath(Map<String, Object> fixed, boolean supportMultiLevels) {

View File

@@ -143,8 +143,8 @@ public class RequestInput extends RPCInput implements IInput{
// headers // headers
Map<String, Object> headers = PathMapping.transform(ctxNode, stepContext, Map<String, Object> headers = PathMapping.transform(ctxNode, stepContext,
MapUtil.upperCaseKey((Map<String, Object>) requestMapping.get("fixedHeaders")), MapUtil.upperCaseKey(MapUtil.list2Map(requestMapping.get("fixedHeaders"))),
MapUtil.upperCaseKey((Map<String, Object>) requestMapping.get("headers")), false); MapUtil.upperCaseKey(MapUtil.list2Map(requestMapping.get("headers"))), false);
if (headers.containsKey(CommonConstants.WILDCARD_TILDE) if (headers.containsKey(CommonConstants.WILDCARD_TILDE)
&& headers.get(CommonConstants.WILDCARD_TILDE) instanceof Map) { && headers.get(CommonConstants.WILDCARD_TILDE) instanceof Map) {
request.put("headers", headers.get(CommonConstants.WILDCARD_TILDE)); request.put("headers", headers.get(CommonConstants.WILDCARD_TILDE));
@@ -154,8 +154,8 @@ public class RequestInput extends RPCInput implements IInput{
// params // params
params.putAll(PathMapping.transform(ctxNode, stepContext, params.putAll(PathMapping.transform(ctxNode, stepContext,
(Map<String, Object>) requestMapping.get("fixedParams"), MapUtil.list2Map(requestMapping.get("fixedParams")),
(Map<String, Object>) requestMapping.get("params"), false)); MapUtil.list2Map(requestMapping.get("params")), false));
if (params.containsKey(CommonConstants.WILDCARD_TILDE) if (params.containsKey(CommonConstants.WILDCARD_TILDE)
&& params.get(CommonConstants.WILDCARD_TILDE) instanceof Map) { && params.get(CommonConstants.WILDCARD_TILDE) instanceof Map) {
request.put("params", params.get(CommonConstants.WILDCARD_TILDE)); request.put("params", params.get(CommonConstants.WILDCARD_TILDE));
@@ -170,8 +170,8 @@ public class RequestInput extends RPCInput implements IInput{
supportMultiLevels = false; supportMultiLevels = false;
} }
Map<String,Object> body = PathMapping.transform(ctxNode, stepContext, Map<String,Object> body = PathMapping.transform(ctxNode, stepContext,
(Map<String, Object>) requestMapping.get("fixedBody"), MapUtil.list2Map(requestMapping.get("fixedBody")),
(Map<String, Object>) requestMapping.get("body"), supportMultiLevels); MapUtil.list2Map(requestMapping.get("body")), supportMultiLevels);
if (body.containsKey(CommonConstants.WILDCARD_TILDE)) { if (body.containsKey(CommonConstants.WILDCARD_TILDE)) {
request.put("body", body.get(CommonConstants.WILDCARD_TILDE)); request.put("body", body.get(CommonConstants.WILDCARD_TILDE));
} else { } else {

View File

@@ -25,6 +25,7 @@ import java.util.List;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.noear.snack.ONode; import org.noear.snack.ONode;
import we.fizz.StepContext;
import we.fizz.component.circle.Circle; import we.fizz.component.circle.Circle;
import we.fizz.component.circle.CircleItem; import we.fizz.component.circle.CircleItem;
import we.fizz.component.condition.Condition; import we.fizz.component.condition.Condition;
@@ -41,7 +42,6 @@ class CircleTests {
void contextLoads() { void contextLoads() {
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Test @Test
void testNextFixedDataSource() { void testNextFixedDataSource() {
@@ -50,14 +50,14 @@ class CircleTests {
// FIXED data source // FIXED data source
Circle c = new Circle(null, ValueTypeEnum.FIXED, 3, null, null); Circle c = new Circle(null, ValueTypeEnum.FIXED, 3, null, null);
CircleItem circleItem = c.next(ctxNode); CircleItem circleItem = c.next(ctxNode);
assertEquals(0, (Integer) circleItem.getItem());
circleItem = c.next(ctxNode);
assertEquals(1, (Integer) circleItem.getItem()); assertEquals(1, (Integer) circleItem.getItem());
circleItem = c.next(ctxNode); circleItem = c.next(ctxNode);
assertEquals(2, (Integer) circleItem.getItem()); assertEquals(2, (Integer) circleItem.getItem());
circleItem = c.next(ctxNode);
assertEquals(3, (Integer) circleItem.getItem());
circleItem = c.next(ctxNode); circleItem = c.next(ctxNode);
assertEquals(null, circleItem); assertEquals(null, circleItem);
@@ -115,7 +115,8 @@ class CircleTests {
CircleItem circleItem = circle.next(ctxNode); CircleItem circleItem = circle.next(ctxNode);
PathMapping.setByPath(ctxNode, "item", circleItem.getItem(), true); PathMapping.setByPath(ctxNode, "item", circleItem.getItem(), true);
PathMapping.setByPath(ctxNode, "index", circleItem.getIndex(), true); PathMapping.setByPath(ctxNode, "index", circleItem.getIndex(), true);
boolean rs = circle.canExec(ctxNode); boolean rs = circle.canExec(circleItem.getIndex(), ctxNode, new StepContext<String, Object>(),
new StepContextPosition("step1", null));
assertEquals(i, circleItem.getIndex()); assertEquals(i, circleItem.getIndex());
if (i < 3) { if (i < 3) {
assertEquals(true, rs); assertEquals(true, rs);
@@ -154,7 +155,9 @@ class CircleTests {
CircleItem circleItem = circle.next(ctxNode); CircleItem circleItem = circle.next(ctxNode);
PathMapping.setByPath(ctxNode, "item", circleItem.getItem(), true); PathMapping.setByPath(ctxNode, "item", circleItem.getItem(), true);
PathMapping.setByPath(ctxNode, "index", circleItem.getIndex(), true); PathMapping.setByPath(ctxNode, "index", circleItem.getIndex(), true);
boolean rs = circle.breakCircle(ctxNode);
boolean rs = circle.breakCircle(circleItem.getIndex(), ctxNode, new StepContext<String, Object>(),
new StepContextPosition("step1", null));
assertEquals(i, circleItem.getIndex()); assertEquals(i, circleItem.getIndex());
if (i < 3) { if (i < 3) {
assertEquals(false, rs); assertEquals(false, rs);

View File

@@ -158,17 +158,17 @@ class ConditionTests {
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.CONTAINS, FALSE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.CONTAINS, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.FIXED, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.FIXED,
FixedDataTypeEnum.STRING, "2", OperatorEnum.NOT_CONTAIN, FALSE }); FixedDataTypeEnum.STRING, "2", OperatorEnum.NOTCONTAIN, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_1", OperatorEnum.NOT_CONTAIN, FALSE }); RefDataTypeEnum.STRING, "data.m.string_1", OperatorEnum.NOTCONTAIN, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.NOT_CONTAIN, TRUE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.NOTCONTAIN, TRUE });
// collection contains any // collection contains any
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.ARRAY, "data.list2", OperatorEnum.CONTAINS_ANY, TRUE }); RefDataTypeEnum.ARRAY, "data.list2", OperatorEnum.CONTAINSANY, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.ARRAY, "data.intList", OperatorEnum.CONTAINS_ANY, FALSE }); RefDataTypeEnum.ARRAY, "data.intList", OperatorEnum.CONTAINSANY, FALSE });
// Collection<int> // Collection<int>
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED,
@@ -181,13 +181,13 @@ class ConditionTests {
RefDataTypeEnum.INT, 9, OperatorEnum.CONTAINS, FALSE }); RefDataTypeEnum.INT, 9, OperatorEnum.CONTAINS, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED,
FixedDataTypeEnum.STRING, "2", OperatorEnum.NOT_CONTAIN, TRUE }); FixedDataTypeEnum.STRING, "2", OperatorEnum.NOTCONTAIN, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.REF,
RefDataTypeEnum.INT, "data.m.int", OperatorEnum.NOT_CONTAIN, FALSE }); RefDataTypeEnum.INT, "data.m.int", OperatorEnum.NOTCONTAIN, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED,
RefDataTypeEnum.INT, 2, OperatorEnum.NOT_CONTAIN, FALSE }); RefDataTypeEnum.INT, 2, OperatorEnum.NOTCONTAIN, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.intList", ValueTypeEnum.FIXED,
RefDataTypeEnum.INT, 9, OperatorEnum.NOT_CONTAIN, TRUE }); RefDataTypeEnum.INT, 9, OperatorEnum.NOTCONTAIN, TRUE });
// Collection<Float> // Collection<Float>
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.floatList", this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.floatList",
@@ -235,71 +235,71 @@ class ConditionTests {
// Is null // Is null
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NULL, TRUE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNULL, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8",
ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NULL, FALSE }); ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNULL, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_NULL, TRUE }); OperatorEnum.ISNULL, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null,
OperatorEnum.IS_NULL, FALSE }); OperatorEnum.ISNULL, FALSE });
// Is not null // Is not null
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_NULL, FALSE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTNULL, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8",
ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_NULL, TRUE }); ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTNULL, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_NOT_NULL, FALSE }); OperatorEnum.ISNOTNULL, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null,
OperatorEnum.IS_NOT_NULL, TRUE }); OperatorEnum.ISNOTNULL, TRUE });
// Is Blank // Is Blank
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_BLANK, TRUE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISBLANK, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8",
ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_BLANK, FALSE }); ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISBLANK, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_BLANK, TRUE }); OperatorEnum.ISBLANK, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null,
OperatorEnum.IS_BLANK, FALSE }); OperatorEnum.ISBLANK, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_blank", null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_blank", null, null,
null, OperatorEnum.IS_BLANK, TRUE }); null, OperatorEnum.ISBLANK, TRUE });
// Is not Blank // Is not Blank
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_BLANK, FALSE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTBLANK, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8",
ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_BLANK, TRUE }); ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTBLANK, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_NOT_BLANK, FALSE }); OperatorEnum.ISNOTBLANK, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_8", null, null, null,
OperatorEnum.IS_NOT_BLANK, TRUE }); OperatorEnum.ISNOTBLANK, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_blank", null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.STRING, "data.m.string_blank", null, null,
null, OperatorEnum.IS_NOT_BLANK, FALSE }); null, OperatorEnum.ISNOTBLANK, FALSE });
// Is empty // Is empty
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_EMPTY, TRUE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISEMPTY, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_EMPTY, FALSE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISEMPTY, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_EMPTY, TRUE }); OperatorEnum.ISEMPTY, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", null, null, null,
OperatorEnum.IS_EMPTY, FALSE }); OperatorEnum.ISEMPTY, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.emptyList", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.emptyList", null, null, null,
OperatorEnum.IS_EMPTY, TRUE }); OperatorEnum.ISEMPTY, TRUE });
// Is not empty // Is not empty
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_EMPTY, FALSE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTEMPTY, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", ValueTypeEnum.REF,
RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.IS_NOT_EMPTY, TRUE }); RefDataTypeEnum.STRING, "data.m.string_8", OperatorEnum.ISNOTEMPTY, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list11111", null, null, null,
OperatorEnum.IS_NOT_EMPTY, FALSE }); OperatorEnum.ISNOTEMPTY, FALSE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.list1", null, null, null,
OperatorEnum.IS_NOT_EMPTY, TRUE }); OperatorEnum.ISNOTEMPTY, TRUE });
this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.emptyList", null, null, null, this.run(ctxNode, new Object[] { ValueTypeEnum.REF, RefDataTypeEnum.ARRAY, "data.emptyList", null, null, null,
OperatorEnum.IS_NOT_EMPTY, FALSE }); OperatorEnum.ISNOTEMPTY, FALSE });
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<groupId>com.fizzgate</groupId> <groupId>com.fizzgate</groupId>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@@ -33,7 +33,7 @@
<artifactId>fizz-gateway-community</artifactId> <artifactId>fizz-gateway-community</artifactId>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<description>fizz gateway community</description> <description>fizz gateway community</description>
<version>2.2.0-beta9</version> <version>2.2.0-beta11</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>fizz-common</module> <module>fizz-common</module>