Skip to content

Commit

Permalink
feat: coverage event ext
Browse files Browse the repository at this point in the history
  • Loading branch information
QizhengMo committed Sep 18, 2024
1 parent b567e59 commit dd14121
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* @date: 2024/9/18 18:58
*/
public interface CoverageEventListener {
void onBeforeNewCaseRecord(Mocker coverageMocker);
void onNewCaseRecorded(Mocker coverageMocker);

void onBeforeExistingCaseRecord(Mocker coverageMocker);
void onExistingCaseRecorded(Mocker coverageMocker);
}
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ public void run() {

// scene exist remove Rolling mocker
if (scenePoolProvider.checkSceneExist(appId, sceneKey)) {
coverageEventListener.onBeforeExistingCaseRecord(coverageMocker);

invalidRecordService.putInvalidCaseInRedis(recordId);
mockSourceEditionService.removeByRecordId(ProviderNames.DEFAULT, coverageMocker.getRecordId());
LOGGER.info("{}CoverageMockerHandler received existing case, recordId: {}, pathKey: {}",
Expand All @@ -296,6 +298,8 @@ public void run() {
coverageEventListener.onExistingCaseRecorded(coverageMocker);
} else {
op = NEW_SCENE_OP;
coverageEventListener.onBeforeNewCaseRecord(coverageMocker);

// new scene: extend mocker expiration and insert scene
Scene scene = convert(coverageMocker);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
@Service
@ConditionalOnMissingBean(CoverageEventListener.class)
public class DefaultCoverageEventListener implements CoverageEventListener {

@Override
public void onBeforeNewCaseRecord(Mocker coverageMocker) {
}

@Override
public void onNewCaseRecorded(Mocker coverageMocker) {
}

@Override
public void onBeforeExistingCaseRecord(Mocker coverageMocker) {
}

@Override
public void onExistingCaseRecorded(Mocker coverageMocker) {
}
Expand Down

0 comments on commit dd14121

Please sign in to comment.