Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Modify the return type of the batchQueryMockers method #271

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class MockCategoryType {

public static final Set<MockCategoryType> DEFAULTS;
public static final MockCategoryType Q_MESSAGE_CONSUMER = MockCategoryType.createEntryPoint(
public static final MockCategoryType Q_MESSAGE_CONSUMER = MockCategoryType.createSkipComparisonEntrance(
"QMessageConsumer");
public static final MockCategoryType Q_MESSAGE_PRODUCER = MockCategoryType.createDependency(
"QMessageProducer");
Expand Down Expand Up @@ -69,6 +69,10 @@ public static MockCategoryType createSkipComparison(String name) {
return new MockCategoryType(name, false, true);
}

public static MockCategoryType createSkipComparisonEntrance(String name) {
return new MockCategoryType(name, true, true);
}

public static MockCategoryType createDependency(String name) {
return new MockCategoryType(name, false, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,17 @@ public Response batchSaveMockers(@RequestBody List<AREXMocker> mockers) {

@PostMapping(value = "/batchQueryMockers")
@ResponseBody
public List<AREXQueryMocker> batchQueryMockers(@RequestBody QueryMockRequestType requestType) {
public byte[] batchQueryMockers(@RequestBody QueryMockRequestType requestType) {
if (requestType == null || StringUtils.isEmpty(requestType.getRecordId())) {
LOGGER.warn("agent batch query recordId empty");
return Collections.emptyList();
return ZstdJacksonSerializer.EMPTY_INSTANCE;
}
return handleMockerService.batchQuery(requestType.getRecordId(), requestType.getFieldNames(),
requestType.getCategoryTypes());
List<AREXQueryMocker> arexQueryMockers = handleMockerService.batchQuery(requestType.getRecordId(),
requestType.getFieldNames(), requestType.getCategoryTypes());
if (CollectionUtils.isEmpty(arexQueryMockers)) {
return ZstdJacksonSerializer.EMPTY_INSTANCE;
}
return zstdJacksonSerializer.serialize(arexQueryMockers);
}

@PostMapping(value = "/batchSaveReplayResult")
Expand Down Expand Up @@ -312,6 +316,20 @@ List<? extends Mocker> queryMockersTest(@RequestBody QueryMockRequestType reques
return null;
}

@PostMapping(value = "/batchQueryMockersTest", produces = {MediaType.APPLICATION_JSON_VALUE})
public @ResponseBody
List<AREXQueryMocker> batchQueryMockersTest(@RequestBody QueryMockRequestType requestType) {
try {
byte[] bytes = this.batchQueryMockers(requestType);
return zstdJacksonSerializer.deserialize(bytes,
new TypeReference<List<AREXQueryMocker>>() {
});
} catch (RuntimeException runtimeException) {
LOGGER.error("queryMockersTest error:{} ", runtimeException.getMessage(), runtimeException);
}
return Collections.emptyList();
}

/**
* put agent version in redis,
* when obtaining the matching relationship,
Expand Down
Loading