From 5014c0fb79d980e6c2f150e604dedad94a35b950 Mon Sep 17 00:00:00 2001 From: baubakg Date: Mon, 31 Aug 2026 19:16:57 +0200 Subject: [PATCH 1/3] Rename waitTillFinished to waitTillStarted on NonInterruptiveEvent (#227) waitTillFinished() was misleadingly named: it waits for the startUp stage to be finalized, not for the event to finish. Introduce waitTillStarted() as the new name, keeping waitTillFinished() as a deprecated, mutually-forwarding method to preserve source compatibility for existing subclasses of the public NonInterruptiveEvent class. Co-Authored-By: Claude Sonnet 5 --- README.md | 2 +- .../data/events/NIEMutationalSynchronousEvent.java | 2 +- ...NIEMutationalSynchronousEventWithException.java | 2 +- .../tests/integro/phased/NonInterruptiveEvent.java | 14 +++++++++++++- .../tests/integro/phased/PhasedEventManager.java | 10 +++++----- .../phased/data/events/MyNonInterruptiveEvent.java | 2 +- phased-testing-testng/README.md | 4 ++-- .../integro/phased/TestPhasedNonInterruptive.java | 4 ++-- .../data/events/MyNonInterruptiveClosureEvent.java | 2 +- .../data/events/MyNonInterruptiveEvent2.java | 2 +- .../phased/data/events/NIESynchronousEvent.java | 2 +- .../events/NIESynchronousEventWithException.java | 2 +- .../integro/phased/data/events/NI_Event2.java | 2 +- .../integro/phased/data/events/NI_Event3.java | 2 +- .../samples/NonInterruptiveEventExample.java | 2 +- 15 files changed, 33 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 23e47176..b1ae3012 100644 --- a/README.md +++ b/README.md @@ -252,7 +252,7 @@ We have a standard demo that can be accessed through the [Phased Test Demo](http Events are an important topic, and have to be correctly covered. An event in Mutational Testing contains three parts: - StartUp - the event is initiated. -- waitTillFinished - the event has finished executing +- waitTillStarted - the startUp stage has been finalized - tearDown - the system is set to a stable state These parts of an event allow us to pilot the event injection around the scenario. diff --git a/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEvent.java b/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEvent.java index 5dbafe4d..1e02ca59 100644 --- a/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEvent.java +++ b/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEvent.java @@ -44,7 +44,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { log.info("In WTF Setting synchronous value to {}", WTF_STEP_VALUE); TestMutationalNIE_Synchroneous.testElement = WTF_STEP_VALUE; return isFinished(); diff --git a/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEventWithException.java b/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEventWithException.java index d68b0905..83b30a61 100644 --- a/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEventWithException.java +++ b/mutational-testing/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIEMutationalSynchronousEventWithException.java @@ -49,7 +49,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { log.info("In WTF Setting synchronous value to {}", WTF_STEP_VALUE); if (exceptionPlace == 2) { diff --git a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java index 60f13fdb..20840492 100644 --- a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java +++ b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java @@ -28,11 +28,23 @@ public abstract class NonInterruptiveEvent implements Runnable { */ public abstract boolean isFinished(); + /** + * Waits until the event has started (i.e. the startUp stage has been finalized). + * @return true if the event successfully started + */ + public boolean waitTillStarted() { + return waitTillFinished(); + } + /** * Waits until the event has concluded * @return true if it successfully finished + * @deprecated Use {@link #waitTillStarted()} instead. This method will be removed in a future major version. */ - public abstract boolean waitTillFinished(); + @Deprecated + public boolean waitTillFinished() { + return waitTillStarted(); + } public enum states {DEFINED , STARTED, FAILURE, FINISHED}; diff --git a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/PhasedEventManager.java b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/PhasedEventManager.java index 6b5c190e..4b4d8818 100644 --- a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/PhasedEventManager.java +++ b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/PhasedEventManager.java @@ -143,7 +143,7 @@ protected static NonInterruptiveEvent startEvent(String in_event, String in_onAc //NON_INTERRUPTIVE 23 if (ExecutionMode.NON_INTERRUPTIVE.fetchBehavior().startsWith("2")) { log.info("Forcing Event End {} BEFORE step {} has started.", in_event, in_onAccountOfStep); - performWaitTilFinish(in_event, in_onAccountOfStep, nie); + performWaitTillStarted(in_event, in_onAccountOfStep, nie); } return nie; } @@ -191,7 +191,7 @@ protected static NonInterruptiveEvent finishEvent(String in_event, String in_onA //if (Phases.NON_INTERRUPTIVE.fetchType().startsWith("3")) { // log.info("Forcing Event End {} AFTER step {} has finished.", in_event, in_onAccountOfStep); - performWaitTilFinish(in_event, in_onAccountOfStep, l_activeEvent); + performWaitTillStarted(in_event, in_onAccountOfStep, l_activeEvent); //} if (!l_activeEvent.isFinished()) { @@ -211,11 +211,11 @@ protected static NonInterruptiveEvent finishEvent(String in_event, String in_onA return l_activeEvent; } - private static void performWaitTilFinish(String in_event, String in_onAccountOfStep, NonInterruptiveEvent nie) { + private static void performWaitTillStarted(String in_event, String in_onAccountOfStep, NonInterruptiveEvent nie) { try { - nie.waitTillFinished(); + nie.waitTillStarted(); } catch (Exception e) { - log.error("The waitTillFinished method for event {} caused an exception in the context of step {}.", + log.error("The waitTillStarted method for event {} caused an exception in the context of step {}.", in_event, in_onAccountOfStep, e); nie.threadFuture.cancel(true); } diff --git a/phased-testing-test-fixtures/src/main/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent.java b/phased-testing-test-fixtures/src/main/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent.java index 643a9360..0930b6aa 100644 --- a/phased-testing-test-fixtures/src/main/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent.java +++ b/phased-testing-test-fixtures/src/main/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent.java @@ -47,7 +47,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { log.info("finishing"); try { diff --git a/phased-testing-testng/README.md b/phased-testing-testng/README.md index 80a6f57f..d1f8956a 100644 --- a/phased-testing-testng/README.md +++ b/phased-testing-testng/README.md @@ -213,7 +213,7 @@ public class NonInterruptiveEventExample extends NonInterruptiveEvent { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { return false; } } @@ -222,7 +222,7 @@ public class NonInterruptiveEventExample extends NonInterruptiveEvent { As you can see we have to implement three methods: * `startEvent` starts the event. * `isFinished` allow the system to see if the event we declared has finished. -* `waitTillFinished` waits until the event has finished. +* `waitTillStarted` waits until the event has started, i.e. the startUp stage has been finalized. In order to define these event you will need to implement these methods, as you who are defining the event have the best knowledge on how these event will work. diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/TestPhasedNonInterruptive.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/TestPhasedNonInterruptive.java index 89918301..5c1221fb 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/TestPhasedNonInterruptive.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/TestPhasedNonInterruptive.java @@ -85,7 +85,7 @@ public void testNonInterruptiveEventHelloWorld() { assertThat("The event should be currently on-going", !nie.isFinished()); //Stop event - assertThat("The event should no longer be on-going", nie.waitTillFinished()); + assertThat("The event should no longer be on-going", nie.waitTillStarted()); Date finish = new Date(); //Make sure event is stopped @@ -114,7 +114,7 @@ public void testNonInterruptiveEventHelloWorld_asString() // assertThat("Make sure that this call is logged", nie.callList, Matchers.contains("testNonInterruptiveEventHelloWorld")); //Stop event - assertThat("The event should no longer be on-going", nie.waitTillFinished()); + assertThat("The event should no longer be on-going", nie.waitTillStarted()); Date finish = new Date(); long executionWait = (long) MyNonInterruptiveEvent.WAIT_TIME_MS; diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveClosureEvent.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveClosureEvent.java index 584f3d9f..f52aa146 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveClosureEvent.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveClosureEvent.java @@ -36,7 +36,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { while (taskContainer != -1) { try { diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent2.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent2.java index e36b39a4..ea362060 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent2.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/MyNonInterruptiveEvent2.java @@ -44,7 +44,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { try { if (eventThread.isAlive()) { diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEvent.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEvent.java index 8d36dd4b..e734cb2b 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEvent.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEvent.java @@ -43,7 +43,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { log.info("In WTF Setting synchronous value to {}", WTF_STEP_VALUE); TestNIE_Synchroneous.testElement = WTF_STEP_VALUE; return isFinished(); diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEventWithException.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEventWithException.java index 5a966c08..39ec8d0c 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEventWithException.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NIESynchronousEventWithException.java @@ -48,7 +48,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { log.info("In WTF Setting synchronous value to {}", WTF_STEP_VALUE); if (exceptionPlace == 2) { diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event2.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event2.java index 8e70f197..dd61527a 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event2.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event2.java @@ -26,7 +26,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { return false; } } diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event3.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event3.java index 2dddff36..dc9460cc 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event3.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/events/NI_Event3.java @@ -31,7 +31,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { return false; } } diff --git a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/samples/NonInterruptiveEventExample.java b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/samples/NonInterruptiveEventExample.java index 6bdb65c6..9ace442f 100644 --- a/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/samples/NonInterruptiveEventExample.java +++ b/phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/samples/NonInterruptiveEventExample.java @@ -22,7 +22,7 @@ public boolean isFinished() { } @Override - public boolean waitTillFinished() { + public boolean waitTillStarted() { return false; } } From 37ce85f1a0e16a529e9d194ba908232e9bdecc11 Mon Sep 17 00:00:00 2001 From: baubakg Date: Mon, 31 Aug 2026 19:20:01 +0200 Subject: [PATCH 2/3] Add CHANGELOG entry for #227 waitTillFinished rename Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db152148..73fb5e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * [#226 Renamed PHASED.EVENTS.NONINTERRUPTIVE and PHASED.EVENTS.TARGET](https://github.com/adobe/phased-testing/issues/226) to `MUTATIONAL.EVENTS.NONINTERRUPTIVE` and `MUTATIONAL.EVENTS.TARGET` respectively, to be consistent with the MUTATIONAL naming used elsewhere. The old property names are still honored for backward compatibility (a deprecation warning is logged when they are used) and will be removed in a future major version. * **(breaking change)** [#246 Changes to ConfigValueHandlerPhased](https://github.com/adobe/phased-testing/issues/246). The public field `ConfigValueHandlerPhased.deprecatedSystemName` has been renamed to `legacySystemName`, to reflect that these are old property names still fully supported, not deprecated ones. In addition, `MutationListener` now proactively checks all config values at suite start and logs a warning for any legacy property name that is in use, rather than only warning the first time the value is fetched. * [#251 Add a boolean to ConfigValueHandler that is deprecation](https://github.com/adobe/phased-testing/issues/251). `ConfigValueHandlerPhased` now has a `description` field (populated for every config value) and a `deprecated` boolean, to distinguish a property whose usage itself is going away from one that has simply been renamed (see #246). `PHASED.TESTS.PHASE` and `PHASED.TESTS.NONPHASED.LEGACY` are marked deprecated. `MutationListener` now also warns at suite start if a deprecated property is set, using its description to explain why. +* [#227 NIE: rename waitTillFinished to a better wording](https://github.com/adobe/phased-testing/issues/227). `NonInterruptiveEvent.waitTillFinished()` has been renamed to `waitTillStarted()`, since it waits for the startUp stage to be finalized rather than for the event to finish. `waitTillFinished()` is now `@Deprecated` and still fully functional (it forwards to/from `waitTillStarted()`), so existing subclasses of `NonInterruptiveEvent` do not need to change. It will be removed in a future major version. * **New Environment Variables** * MUTATIONAL.EXECUTION.MODE : This property is used to set the execution mode of the Mutational Tests. The value can be one of the following: STANDARD, INTERRUPTIVE(PRODUCER), INTERRUPTIVE(CONSUMER), NON-INTERRUPTIVE, PERMUATIONAL. This will replace the PHASED.TESTS.PHASE property which will be removed in 9.X.3. From 3b07e93956ca1bee88855175eacf7fe537fb8866 Mon Sep 17 00:00:00 2001 From: baubakg Date: Mon, 31 Aug 2026 19:24:36 +0200 Subject: [PATCH 3/3] Fix SonarCloud reliability BLOCKER: break waitTillFinished/waitTillStarted mutual recursion The two forwarding default methods called each other, which Sonar flags as recursion with no guaranteed termination. Only waitTillStarted() now forwards to waitTillFinished() (needed so the engine, which calls waitTillStarted(), keeps invoking old subclasses overrides of waitTillFinished()). The deprecated waitTillFinished() no longer forwards back, since nothing internal calls it once a subclass overrides waitTillStarted(). Also adds since/forRemoval to the @Deprecated annotation per Sonar's code-smell suggestion. Co-Authored-By: Claude Sonnet 5 --- .../campaign/tests/integro/phased/NonInterruptiveEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java index 20840492..2ba22646 100644 --- a/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java +++ b/phased-testing-core/src/main/java/com/adobe/campaign/tests/integro/phased/NonInterruptiveEvent.java @@ -41,9 +41,9 @@ public boolean waitTillStarted() { * @return true if it successfully finished * @deprecated Use {@link #waitTillStarted()} instead. This method will be removed in a future major version. */ - @Deprecated + @Deprecated(since = "9.0.0", forRemoval = true) public boolean waitTillFinished() { - return waitTillStarted(); + return true; } public enum states {DEFINED , STARTED, FAILURE, FINISHED};