-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25ab926
commit 48d582b
Showing
33 changed files
with
466 additions
and
345 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
...devmode-spi/src/main/java/io/quarkus/dev/testing/ContinuousTestingSharedStateManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
package io.quarkus.dev.testing; | ||
|
||
import java.util.concurrent.CopyOnWriteArraySet; | ||
import java.util.function.Consumer; | ||
|
||
public class ContinuousTestingSharedStateManager { | ||
|
||
private static final CopyOnWriteArraySet<Consumer<State>> stateListeners = new CopyOnWriteArraySet<>(); | ||
private static volatile State lastState = new State(-1, false, false, 0, 0, 0, 0, 0, 0, 0, false, false, false, true); | ||
|
||
public static void addStateListener(Consumer<State> stateListener) { | ||
stateListeners.add(stateListener); | ||
if (lastState != null) { | ||
stateListener.accept(lastState); | ||
} | ||
} | ||
|
||
public static void removeStateListener(Consumer<State> stateListener) { | ||
stateListeners.remove(stateListener); | ||
} | ||
|
||
public static void setLastState(State state) { | ||
lastState = state; | ||
for (var sl : stateListeners) { | ||
sl.accept(state); | ||
} | ||
} | ||
|
||
public static State getLastState() { | ||
return lastState; | ||
} | ||
|
||
public static void setInProgress(boolean inProgress) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState( | ||
new State(state.lastRun, state.running, inProgress, state.run, state.passed, state.failed, state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, | ||
state.isTestOutput, state.isInstrumentationBasedReload, state.isLiveReload)); | ||
} | ||
} | ||
|
||
public static void setRunning(boolean running) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState(new State(state.lastRun, running, running && state.inProgress, state.run, state.passed, state.failed, | ||
state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput, | ||
state.isInstrumentationBasedReload, state.isLiveReload)); | ||
} | ||
} | ||
|
||
public static void setBrokenOnly(boolean brokenOnly) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed, | ||
state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, brokenOnly, state.isTestOutput, | ||
state.isInstrumentationBasedReload, state.isLiveReload)); | ||
} | ||
} | ||
|
||
public static void setTestOutput(boolean testOutput) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed, | ||
state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, testOutput, | ||
state.isInstrumentationBasedReload, state.isLiveReload)); | ||
} | ||
} | ||
|
||
public static void setInstrumentationBasedReload(boolean instrumentationBasedReload) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed, | ||
state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput, | ||
instrumentationBasedReload, state.isLiveReload)); | ||
} | ||
} | ||
|
||
public static void setLiveReloadEnabled(boolean liveReload) { | ||
State state = lastState; | ||
if (state != null) { | ||
setLastState(new State(state.lastRun, state.running, state.inProgress, state.run, state.passed, state.failed, | ||
state.skipped, | ||
state.currentPassed, state.currentFailed, state.currentSkipped, state.isBrokenOnly, state.isTestOutput, | ||
state.isInstrumentationBasedReload, liveReload)); | ||
} | ||
} | ||
|
||
public static class State { | ||
public final long lastRun; | ||
public final boolean running; | ||
public final boolean inProgress; | ||
public final long run; | ||
public final long passed; | ||
public final long failed; | ||
public final long skipped; | ||
public final long currentPassed; | ||
public final long currentFailed; | ||
public final long currentSkipped; | ||
public final boolean isBrokenOnly; | ||
public final boolean isTestOutput; | ||
public final boolean isInstrumentationBasedReload; | ||
public final boolean isLiveReload; | ||
|
||
public State(long lastRun, boolean running, boolean inProgress, long run, long passed, long failed, long skipped, | ||
long currentPassed, long currentFailed, long currentSkipped, boolean isBrokenOnly, boolean isTestOutput, | ||
boolean isInstrumentationBasedReload, boolean isLiveReload) { | ||
this.lastRun = lastRun; | ||
this.running = running; | ||
this.inProgress = inProgress; | ||
this.run = run; | ||
this.passed = passed; | ||
this.failed = failed; | ||
this.skipped = skipped; | ||
this.currentPassed = currentPassed; | ||
this.currentFailed = currentFailed; | ||
this.currentSkipped = currentSkipped; | ||
this.isBrokenOnly = isBrokenOnly; | ||
this.isTestOutput = isTestOutput; | ||
this.isInstrumentationBasedReload = isInstrumentationBasedReload; | ||
this.isLiveReload = isLiveReload; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "State{" + | ||
"lastRun=" + lastRun + | ||
", running=" + running + | ||
", inProgress=" + inProgress + | ||
", run=" + run + | ||
", passed=" + passed + | ||
", failed=" + failed + | ||
", skipped=" + skipped + | ||
", isBrokenOnly=" + isBrokenOnly + | ||
", isTestOutput=" + isTestOutput + | ||
", isInstrumentationBasedReload=" + isInstrumentationBasedReload + | ||
", isLiveReload=" + isLiveReload + | ||
'}'; | ||
} | ||
} | ||
} |
108 changes: 0 additions & 108 deletions
108
.../devmode-spi/src/main/java/io/quarkus/dev/testing/ContinuousTestingWebsocketListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.