diff --git a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageEventListener.java b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageEventListener.java index 2bd2df59..7149ae20 100644 --- a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageEventListener.java +++ b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageEventListener.java @@ -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); } diff --git a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageMockerHandler.java b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageMockerHandler.java index 70df0158..30eb9f35 100644 --- a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageMockerHandler.java +++ b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/CoverageMockerHandler.java @@ -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: {}", @@ -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); diff --git a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/DefaultCoverageEventListener.java b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/DefaultCoverageEventListener.java index 7da5c989..19726ec7 100644 --- a/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/DefaultCoverageEventListener.java +++ b/arex-storage-web-api/src/main/java/com/arextest/storage/service/handler/mocker/coverage/DefaultCoverageEventListener.java @@ -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) { }