支持预发布、灰度发布

1.x
tanghc 5 years ago
parent 43bb2efb6a
commit 1e54852a3e
  1. 5
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/result/BaseExecutorAdapter.java
  2. 8
      sop-common/sop-service-common/src/main/java/com/gitee/sop/servercommon/mapping/ApiMappingRequestCondition.java
  3. 2
      sop-example/sop-auth/src/test/java/com/gitee/sop/sopauth/RefreshTokenTest.java

@ -37,6 +37,7 @@ public abstract class BaseExecutorAdapter<T, R> implements ResultExecutor<T, R>
private static final ErrorMeta SUCCESS_META = ErrorEnum.SUCCESS.getErrorMeta(); private static final ErrorMeta SUCCESS_META = ErrorEnum.SUCCESS.getErrorMeta();
private static final ErrorMeta ISP_UNKNOW_ERROR_META = ErrorEnum.ISP_UNKNOW_ERROR.getErrorMeta(); private static final ErrorMeta ISP_UNKNOW_ERROR_META = ErrorEnum.ISP_UNKNOW_ERROR.getErrorMeta();
private static final ErrorMeta ISP_BIZ_ERROR = ErrorEnum.BIZ_ERROR.getErrorMeta(); private static final ErrorMeta ISP_BIZ_ERROR = ErrorEnum.BIZ_ERROR.getErrorMeta();
private static final ErrorMeta ISV_MISSING_METHOD_META = ErrorEnum.ISV_MISSING_METHOD.getErrorMeta();
public static final String GATEWAY_CODE_NAME = "code"; public static final String GATEWAY_CODE_NAME = "code";
public static final String GATEWAY_MSG_NAME = "msg"; public static final String GATEWAY_MSG_NAME = "msg";
@ -90,6 +91,10 @@ public abstract class BaseExecutorAdapter<T, R> implements ResultExecutor<T, R>
responseData = JSON.parseObject(serviceResult); responseData = JSON.parseObject(serviceResult);
responseData.put(GATEWAY_CODE_NAME, ISP_BIZ_ERROR.getCode()); responseData.put(GATEWAY_CODE_NAME, ISP_BIZ_ERROR.getCode());
responseData.put(GATEWAY_MSG_NAME, ISP_BIZ_ERROR.getError().getMsg()); responseData.put(GATEWAY_MSG_NAME, ISP_BIZ_ERROR.getError().getMsg());
} else if(responseStatus == HttpStatus.NOT_FOUND.value()) {
responseData = JSON.parseObject(serviceResult);
responseData.put(GATEWAY_CODE_NAME, ISV_MISSING_METHOD_META.getCode());
responseData.put(GATEWAY_MSG_NAME, ISV_MISSING_METHOD_META.getError().getCode());
} else { } else {
this.storeError(request, ErrorType.UNKNOWN); this.storeError(request, ErrorType.UNKNOWN);
// 微服务端有可能返回500错误 // 微服务端有可能返回500错误

@ -63,13 +63,7 @@ public class ApiMappingRequestCondition implements RequestCondition<ApiMappingRe
*/ */
@Override @Override
public int compareTo(ApiMappingRequestCondition other, HttpServletRequest request) { public int compareTo(ApiMappingRequestCondition other, HttpServletRequest request) {
if (null != apiMappingInfo && null == other.apiMappingInfo) { return this.apiMappingInfo.getVersion().compareTo(other.apiMappingInfo.getVersion());
return 1;
} else if (null == apiMappingInfo && null != other.apiMappingInfo) {
return -1;
} else {
return 0;
}
} }
} }

@ -26,7 +26,7 @@ public class RefreshTokenTest extends TestCase {
OpenAuthTokenAppRequest request = new OpenAuthTokenAppRequest(); OpenAuthTokenAppRequest request = new OpenAuthTokenAppRequest();
OpenAuthTokenAppModel model = new OpenAuthTokenAppModel(); OpenAuthTokenAppModel model = new OpenAuthTokenAppModel();
model.setGrant_type("refresh_token"); model.setGrant_type("refresh_token");
model.setRefresh_token("856faf8d77d3b985c1073557ce6ea724"); model.setRefresh_token("c9e4003c06fe59066eed73d64ea074ca");
request.setBizModel(model); request.setBizModel(model);
OpenAuthTokenAppResponse response = openClient.execute(request); OpenAuthTokenAppResponse response = openClient.execute(request);

Loading…
Cancel
Save