pull/3/head
tanghc 4 years ago
parent 01bb3eae06
commit c6e5a20a81
  1. 6
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/validate/ApiValidator.java
  2. 9
      sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java

@ -74,13 +74,13 @@ public class ApiValidator implements Validator {
if (apiConfig.isIgnoreValidate()
|| BooleanUtils.toBoolean(targetRoute.getRouteDefinition().getIgnoreValidate())) {
if (log.isDebugEnabled()) {
log.debug("忽略所有验证(ignoreValidate=true), name:{}, version:{}", param.fetchName(), param.fetchVersion());
}
return;
log.debug("忽略签名校验, name:{}, version:{}", param.fetchName(), param.fetchVersion());
}
} else {
// 需要验证签名,先校验appKey,后校验签名,顺序不能变
checkAppKey(param);
checkSign(param);
}
checkTimeout(param);
checkFormat(param);
checkUploadFile(param);

@ -1,6 +1,7 @@
package com.gitee.sop.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
@ -285,9 +286,11 @@ public class AllInOneTest extends TestBase {
.bizContent(new BizContent().add("id", "1").add("name", "葫芦娃"))
.httpMethod(HttpTool.HTTPMethod.GET)
.callback((requestInfo, responseData) -> {
int size = JSON.parseObject(responseData)
.getJSONObject("bigdata_get_response")
.getJSONArray("data").size();
int size = Optional.ofNullable(JSON.parseObject(responseData))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONObject("bigdata_get_response")))
.flatMap(jsonObject -> Optional.ofNullable(jsonObject.getJSONArray("data")))
.map(JSONArray::size)
.orElse(0);
Assert.assertEquals(size, 2000);
});

Loading…
Cancel
Save