Skip to content

Commit ffe0224

Browse files
authored
feat: remove storage.use.eigen.match properties (#141)
1 parent 1084b8c commit ffe0224

File tree

13 files changed

+15
-53
lines changed

13 files changed

+15
-53
lines changed

arex-storage-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<parent>
4646
<artifactId>arex-storage-service</artifactId>
4747
<groupId>com.arextest</groupId>
48-
<version>1.0.56</version>
48+
<version>1.0.57</version>
4949
</parent>
5050

5151
<properties>

arex-storage-model/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>arex-storage-service</artifactId>
99
<groupId>com.arextest</groupId>
10-
<version>1.0.56</version>
10+
<version>1.0.57</version>
1111
</parent>
1212

1313
<profiles>

arex-storage-web-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<parent>
124124
<artifactId>arex-storage-service</artifactId>
125125
<groupId>com.arextest</groupId>
126-
<version>1.0.56</version>
126+
<version>1.0.57</version>
127127
</parent>
128128

129129
<profiles>

arex-storage-web-api/src/main/java/com/arextest/storage/mock/impl/DefaultMockResultProviderImpl.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ final class DefaultMockResultProviderImpl implements MockResultProvider {
5959
*/
6060
@Value("${arex.storage.cache.expired.seconds:7200}")
6161
private long cacheExpiredSeconds;
62-
@Value("${arex.storage.use.eigen.match}")
63-
private boolean useEigenMatch;
6462
@Value("${arex.storage.query.config:true}")
6563
private boolean queryConfigSwitch;
6664
@Resource
@@ -134,7 +132,7 @@ private void putRedisValue(byte[] recordOperationKey, int count) {
134132
private <T extends Mocker> int sequencePutRecordData(MockCategoryType category,
135133
byte[] recordIdBytes, int size, byte[] recordKey, T value, int sequence,
136134
Map<byte[], Integer> mockSequenceKeyMaps) {
137-
if (useEigenMatch && MapUtils.isEmpty(value.getEigenMap())) {
135+
if (MapUtils.isEmpty(value.getEigenMap())) {
138136
calculateEigen(value, true);
139137
}
140138
List<byte[]> mockKeyList = matchKeyFactory.build(value);
@@ -361,9 +359,7 @@ public byte[] getRecordResult(@NotNull Mocker mockItem, MockResultContext contex
361359
String replayId = mockItem.getReplayId();
362360
try {
363361
long start = System.currentTimeMillis();
364-
if (useEigenMatch) {
365-
calculateEigen(mockItem, false);
366-
}
362+
calculateEigen(mockItem, false);
367363
List<byte[]> mockKeyList = matchKeyFactory.build(mockItem);
368364
long end = System.currentTimeMillis();
369365
LOGGER.info("build mock keys cost:{} ms", end - start);
@@ -385,12 +381,8 @@ public byte[] getRecordResult(@NotNull Mocker mockItem, MockResultContext contex
385381
recordIdBytes, replayIdBytes);
386382
}
387383

388-
if (useEigenMatch) {
389-
return getMockResultWithEigenMatch(category, recordIdBytes, replayIdBytes,
390-
mockKeyList, mockItem, operationName, context);
391-
}
392-
return getMockResultWithSimilarityMatch(category, recordIdBytes, replayIdBytes, mockKeyList,
393-
mockItem, operationName, context);
384+
return getMockResultWithEigenMatch(category, recordIdBytes, replayIdBytes,
385+
mockKeyList, mockItem, operationName, context);
394386
} catch (Throwable throwable) {
395387
LOGGER.error(
396388
"from agent's sequence consumeResult error: {} for category: {}, recordId: {}, replayId: {}",

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/DatabaseMatchKeyBuilderImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import lombok.extern.slf4j.Slf4j;
1919
import org.apache.commons.collections4.MapUtils;
2020
import org.apache.commons.lang3.StringUtils;
21-
import org.springframework.beans.factory.annotation.Value;
2221
import org.springframework.core.annotation.Order;
2322
import org.springframework.stereotype.Component;
2423

@@ -56,8 +55,6 @@ public class DatabaseMatchKeyBuilderImpl implements MatchKeyBuilder {
5655
private static final List<String> SQL_TABLE_KEYS = Arrays.asList("from", "join", "update",
5756
"into");
5857
private final ObjectMapper objectMapper;
59-
@Value("${arex.storage.use.eigen.match}")
60-
private boolean useEigenMatch;
6158

6259
DatabaseMatchKeyBuilderImpl(ObjectMapper objectMapper) {
6360
this.objectMapper = objectMapper;
@@ -171,7 +168,7 @@ private List<byte[]> dbMockKeyBuild(Mocker databaseMocker) {
171168
md5Digest.update(dbNameBytes);
172169
md5Digest.update(operationBytes);
173170
byte[] dbNameMatchKey = md5Digest.digest();
174-
if (useEigenMatch && MapUtils.isNotEmpty(databaseMocker.getEigenMap())) {
171+
if (MapUtils.isNotEmpty(databaseMocker.getEigenMap())) {
175172
try {
176173
md5Digest.update(CacheKeyUtils.toUtf8Bytes(
177174
objectMapper.writeValueAsString(databaseMocker.getEigenMap())));

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/DefaultDependencyMatchKeyBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.apache.commons.collections4.MapUtils;
1919
import org.apache.commons.io.IOUtils;
2020
import org.apache.commons.lang3.StringUtils;
21-
import org.springframework.beans.factory.annotation.Value;
2221
import org.springframework.core.annotation.Order;
2322
import org.springframework.stereotype.Component;
2423

@@ -27,9 +26,6 @@
2726
@Order()
2827
final class DefaultDependencyMatchKeyBuilderImpl implements MatchKeyBuilder {
2928

30-
@Value("${arex.storage.use.eigen.match}")
31-
private boolean useEigenMatch;
32-
3329
@Override
3430
public boolean isSupported(MockCategoryType categoryType) {
3531
return !categoryType.isEntryPoint() && !categoryType.isSkipComparison();
@@ -45,7 +41,7 @@ public List<byte[]> build(Mocker instance) {
4541
MessageDigest messageDigest = MessageDigestWriter.getMD5Digest();
4642
messageDigest.update(operationBytes);
4743
String body = request.getBody();
48-
if (useEigenMatch && MapUtils.isNotEmpty(instance.getEigenMap())) {
44+
if (MapUtils.isNotEmpty(instance.getEigenMap())) {
4945
try {
5046
body = objectMapper.writeValueAsString(instance.getEigenMap());
5147
} catch (JsonProcessingException e) {

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/DubboConsumerMatchKeyBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.apache.commons.collections4.MapUtils;
2020
import org.apache.commons.io.IOUtils;
2121
import org.apache.commons.lang3.StringUtils;
22-
import org.springframework.beans.factory.annotation.Value;
2322
import org.springframework.core.annotation.Order;
2423
import org.springframework.stereotype.Component;
2524

@@ -28,9 +27,6 @@
2827
@Order(5)
2928
final class DubboConsumerMatchKeyBuilderImpl implements MatchKeyBuilder {
3029

31-
@Value("${arex.storage.use.eigen.match}")
32-
private boolean useEigenMatch;
33-
3430
@Override
3531
public boolean isSupported(MockCategoryType categoryType) {
3632
return Objects.equals(categoryType, MockCategoryType.DUBBO_CONSUMER);
@@ -46,7 +42,7 @@ public List<byte[]> build(Mocker instance) {
4642
MessageDigest messageDigest = MessageDigestWriter.getMD5Digest();
4743
messageDigest.update(operationBytes);
4844
String body = request.getBody();
49-
if (useEigenMatch && MapUtils.isNotEmpty(instance.getEigenMap())) {
45+
if (MapUtils.isNotEmpty(instance.getEigenMap())) {
5046
try {
5147
body = objectMapper.writeValueAsString(instance.getEigenMap());
5248
} catch (JsonProcessingException e) {

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/DynamicClassMatchKeyBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import lombok.extern.slf4j.Slf4j;
1616
import org.apache.commons.collections4.MapUtils;
1717
import org.apache.commons.lang3.StringUtils;
18-
import org.springframework.beans.factory.annotation.Value;
1918
import org.springframework.core.annotation.Order;
2019
import org.springframework.stereotype.Component;
2120

@@ -24,9 +23,6 @@
2423
@Slf4j
2524
final class DynamicClassMatchKeyBuilderImpl implements MatchKeyBuilder {
2625

27-
@Value("${arex.storage.use.eigen.match}")
28-
private boolean useEigenMatch;
29-
3026
@Override
3127
public boolean isSupported(MockCategoryType categoryType) {
3228
return Objects.equals(categoryType, MockCategoryType.DYNAMIC_CLASS);
@@ -44,7 +40,7 @@ public List<byte[]> build(Mocker instance) {
4440
messageDigest.update(operationNameBytes);
4541

4642
String body = targetRequest.getBody();
47-
if (useEigenMatch && MapUtils.isNotEmpty(instance.getEigenMap())) {
43+
if (MapUtils.isNotEmpty(instance.getEigenMap())) {
4844
try {
4945
body = objectMapper.writeValueAsString(instance.getEigenMap());
5046
} catch (JsonProcessingException e) {

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/HttpClientMatchKeyBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.commons.collections4.MapUtils;
2222
import org.apache.commons.io.IOUtils;
2323
import org.apache.commons.lang3.StringUtils;
24-
import org.springframework.beans.factory.annotation.Value;
2524
import org.springframework.core.annotation.Order;
2625
import org.springframework.stereotype.Component;
2726

@@ -30,9 +29,6 @@
3029
@Order(15)
3130
final class HttpClientMatchKeyBuilderImpl implements MatchKeyBuilder {
3231

33-
@Value("${arex.storage.use.eigen.match}")
34-
private boolean useEigenMatch;
35-
3632
private final ObjectMapper objectMapper;
3733
private static final String BODY = "body";
3834
HttpClientMatchKeyBuilderImpl(ObjectMapper objectMapper) {
@@ -64,7 +60,7 @@ public List<byte[]> build(Mocker instance) {
6460
return Arrays.asList(httpMethodWithUrlBytes, operationBytes);
6561
}
6662
String body = request.getBody();
67-
if (useEigenMatch && MapUtils.isNotEmpty(instance.getEigenMap())) {
63+
if (MapUtils.isNotEmpty(instance.getEigenMap())) {
6864
try {
6965
body = objectMapper.writeValueAsString(instance.getEigenMap());
7066
} catch (JsonProcessingException e) {

arex-storage-web-api/src/main/java/com/arextest/storage/mock/internal/matchkey/impl/QMessageProduceMatchKeyBuilderImpl.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.apache.commons.collections4.MapUtils;
2020
import org.apache.commons.io.IOUtils;
2121
import org.apache.commons.lang3.StringUtils;
22-
import org.springframework.beans.factory.annotation.Value;
2322
import org.springframework.core.annotation.Order;
2423
import org.springframework.stereotype.Component;
2524

@@ -28,9 +27,6 @@
2827
@Order(20)
2928
final class QMessageProduceMatchKeyBuilderImpl implements MatchKeyBuilder {
3029

31-
@Value("${arex.storage.use.eigen.match}")
32-
private boolean useEigenMatch;
33-
3430
@Override
3531
public boolean isSupported(MockCategoryType categoryType) {
3632
return Objects.equals(categoryType, MockCategoryType.Q_MESSAGE_PRODUCER);
@@ -46,7 +42,7 @@ public List<byte[]> build(Mocker instance) {
4642
MessageDigest messageDigest = MessageDigestWriter.getMD5Digest();
4743
messageDigest.update(operationBytes);
4844
String body = request.getBody();
49-
if (useEigenMatch && MapUtils.isNotEmpty(instance.getEigenMap())) {
45+
if (MapUtils.isNotEmpty(instance.getEigenMap())) {
5046
try {
5147
body = objectMapper.writeValueAsString(instance.getEigenMap());
5248
} catch (JsonProcessingException e) {

0 commit comments

Comments
 (0)