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 committed Jul 29, 2024
1 parent 47257a8 commit 64b44bd
Show file tree
Hide file tree
Showing 17 changed files with 194 additions and 224 deletions.

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 64b44bd

Please sign in to comment.