Skip to content

Commit

Permalink
feat: Configure the number of replay cases (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangdayuan1 authored Jul 9, 2024
1 parent e1d1653 commit 5bee83f
Show file tree
Hide file tree
Showing 19 changed files with 198 additions and 228 deletions.
4 changes: 2 additions & 2 deletions arex-schedule-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<parent>
<artifactId>arex-schedule-parent</artifactId>
<groupId>com.arextest</groupId>
<version>1.2.9</version>
<version>1.2.10</version>
</parent>

<profiles>
Expand Down Expand Up @@ -338,5 +338,5 @@
</properties>
</profile>
</profiles>
<version>1.2.9</version>
<version>1.2.10</version>
</project>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.arextest.schedule.model;

import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum CaseProviderEnum {
ROLLING(0, "Rolling"),
PINNED(1, "Pinned"),
AUTO_PINNED(2, "AutoPinned");

private final int code;
private final String name;
private static final Map<Integer, CaseProviderEnum> codeToProviderMap = new HashMap<>();

static {
for (CaseProviderEnum provider : values()) {
codeToProviderMap.put(provider.code, provider);
}
}

public static CaseProviderEnum fromCode(int code) {
return codeToProviderMap.get(code);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ReplayActionCaseItem {
/**
* old data fallback to default value
*
* @see CaseProvider
* @see CaseProviderEnum
*/
private int caseProviderCode;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.arextest.schedule.plan.builder.impl;

import com.arextest.schedule.model.AppServiceDescriptor;
import com.arextest.schedule.model.CaseProvider;
import com.arextest.schedule.model.CaseProviderEnum;
import com.arextest.schedule.model.CaseSourceEnvType;
import com.arextest.schedule.model.ReplayActionItem;
import com.arextest.schedule.model.deploy.DeploymentVersion;
Expand Down Expand Up @@ -122,7 +122,7 @@ public List<ReplayActionItem> buildReplayActionList(BuildReplayPlanRequest reque
abstract List<ReplayActionItem> getReplayActionList(BuildReplayPlanRequest request,
PlanContext planContext);

protected int queryCaseCountByAction(ReplayActionItem actionItem, CaseProvider provider) {
protected int queryCaseCountByAction(ReplayActionItem actionItem, CaseProviderEnum provider) {
return replayCaseRemoteLoadService.queryCaseCount(actionItem, provider.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.arextest.model.replay.QueryMockCacheResponseType;
import com.arextest.model.response.ResponseStatusType;
import com.arextest.schedule.client.HttpWepServiceApiClient;
import com.arextest.schedule.model.CaseProvider;
import com.arextest.schedule.model.CaseProviderEnum;
import com.arextest.schedule.model.ReplayActionCaseItem;
import java.util.Optional;
import javax.annotation.Resource;
Expand Down Expand Up @@ -33,8 +33,8 @@ public boolean prepareCache(ReplayActionCaseItem caseItem) {
request.setRecordId(recordId);
QueryMockCacheResponseType response;

String provider = Optional.ofNullable(CaseProvider.fromCode(caseItem.getCaseProviderCode()))
.orElse(CaseProvider.ROLLING)
String provider = Optional.ofNullable(CaseProviderEnum.fromCode(caseItem.getCaseProviderCode()))
.orElse(CaseProviderEnum.ROLLING)
.getName();
request.setSourceProvider(provider);

Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5bee83f

Please sign in to comment.