diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/beans/ServiceAutoConfiguration.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/beans/ServiceAutoConfiguration.java
index 1a25b623..d95be3e7 100644
--- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/beans/ServiceAutoConfiguration.java
+++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/beans/ServiceAutoConfiguration.java
@@ -1,5 +1,8 @@
package com.arextest.schedule.beans;
+import com.arextest.common.config.ConfigProvider;
+import com.arextest.common.config.DefaultApplicationConfig;
+import com.arextest.common.config.DefaultConfigProvider;
import com.arextest.common.jwt.JWTService;
import com.arextest.common.jwt.JWTServiceImpl;
import com.arextest.schedule.aspect.AppAuthAspectExecutor;
@@ -17,6 +20,7 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
import org.springframework.data.mongodb.core.MongoTemplate;
@Configuration
@@ -58,4 +62,16 @@ public JWTService jwtService() {
return new JWTServiceImpl(ACCESS_EXPIRE_TIME, REFRESH_EXPIRE_TIME, tokenSecret);
}
+ @Bean
+ @ConditionalOnMissingBean(ConfigProvider.class)
+ public ConfigProvider defaultConfigProvider(Environment environment) {
+ return new DefaultConfigProvider(environment);
+ }
+
+ @Bean
+ public DefaultApplicationConfig defaultApplicationConfig(ConfigProvider configProvider) {
+ return new DefaultApplicationConfig(configProvider);
+ }
+
+
}
diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/CompareConfigService.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/CompareConfigService.java
index d304171b..355f6eb3 100644
--- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/CompareConfigService.java
+++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/comparer/CompareConfigService.java
@@ -4,6 +4,7 @@
import com.arextest.common.model.response.GenericResponseType;
import com.arextest.schedule.client.HttpWepServiceApiClient;
import com.arextest.schedule.common.JsonUtils;
+import com.arextest.schedule.mdc.MDCTracer;
import com.arextest.schedule.model.ReplayActionItem;
import com.arextest.schedule.model.ReplayPlan;
import com.arextest.schedule.model.config.ComparisonInterfaceConfig;
@@ -110,6 +111,8 @@ public void preload(ReplayPlan plan) {
if (actionItem.getReplayCaseCount() == 0) {
continue;
}
+
+ MDCTracer.addPlanItemId(actionItem.getId());
String operationId = actionItem.getOperationId();
ReplayComparisonConfig config = operationCompareConfig.getOrDefault(operationId,
@@ -125,6 +128,7 @@ public void preload(ReplayPlan plan) {
LOGGER.info("prepare load compare config, action id:{}, config:{}", actionItem.getId(),
configValue);
+ MDCTracer.removePlanItemId();
}
progressEvent.onCompareConfigLoaded(plan);
}
diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/mdc/MDCTracer.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/mdc/MDCTracer.java
index 9145bc22..0a9338cf 100644
--- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/mdc/MDCTracer.java
+++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/mdc/MDCTracer.java
@@ -56,19 +56,13 @@ public static void addPlanItemId(String planItemId) {
MDC.put(PLAN_ITEM_ID, planItemId);
}
- public static void addPlanId(long planId) {
- addAppType();
- add(PLAN_ID, planId);
- }
-
- public static void addActionId(String actionId) {
- addAppType();
- MDC.put(PLAN_ID, actionId);
+ public static void removePlanItemId() {
+ MDC.remove(PLAN_ITEM_ID);
}
- public static void addActionId(long actionId) {
+ public static void addPlanId(long planId) {
addAppType();
- add(ACTION_ID, actionId);
+ add(PLAN_ID, planId);
}
public static void addDetailId(String detailId) {
diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/DefaultHttpRequestBuilder.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/DefaultHttpRequestBuilder.java
index d56c09db..adc2cd96 100644
--- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/DefaultHttpRequestBuilder.java
+++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/sender/httprequest/DefaultHttpRequestBuilder.java
@@ -43,7 +43,7 @@ public HttpSenderContent buildRequestContent(SenderParameters senderParameters)
final HttpEntity> httpEntity;
if (shouldApplyHttpBody(httpMethod)) {
Object decodeMessage = DecodeUtils.decode(requestMessage);
- if (byte[].class == decodeMessage.getClass()) {
+ if (decodeMessage instanceof byte[]) {
responseType = byte[].class;
}
httpEntity = new HttpEntity<>(decodeMessage, httpHeaders);
diff --git a/arex-schedule-web-api/src/main/java/com/arextest/schedule/utils/DecodeUtils.java b/arex-schedule-web-api/src/main/java/com/arextest/schedule/utils/DecodeUtils.java
index e6e776ed..f1c6a601 100644
--- a/arex-schedule-web-api/src/main/java/com/arextest/schedule/utils/DecodeUtils.java
+++ b/arex-schedule-web-api/src/main/java/com/arextest/schedule/utils/DecodeUtils.java
@@ -2,16 +2,21 @@
import java.util.Base64;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
/**
* @author wildeslam.
* @create 2023/11/30 20:43
*/
public class DecodeUtils {
+
private static final String PATTERN_STRING = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$";
private static final Pattern BASE_64_PATTERN = Pattern.compile(PATTERN_STRING);
public static Object decode(String requestMessage) {
+ if (StringUtils.isEmpty(requestMessage)) {
+ return requestMessage;
+ }
if (BASE_64_PATTERN.matcher(requestMessage).matches()) {
return Base64.getDecoder().decode(requestMessage);
}
diff --git a/pom.xml b/pom.xml
index eed17b3f..11c0de64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -309,7 +309,7 @@
1.1.36
0.6.4.13
- 0.2.2
+ 0.2.3
3.20.1