diff --git a/.github/workflows/gradle-ci.yml b/.github/workflows/gradle-ci.yml
index a60cdd35..07495a08 100644
--- a/.github/workflows/gradle-ci.yml
+++ b/.github/workflows/gradle-ci.yml
@@ -85,7 +85,6 @@ jobs:
mission-control/build/reports/tests/test
boosters/**/build/reports/tests/test
mission-report/**/build/reports/tests/test
- strongback/**/build/reports/tests/test
retention-days: 5
- name: Upload coverage to Codecov - Core
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
@@ -136,24 +135,3 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./mission-report/flight-evaluation-report/build/reports/jacoco/report.xml,./mission-report/flight-evaluation-report/node/build/coverage/cobertura-coverage.xml
flags: flighteval
- - name: Upload coverage to Codecov - Strongback - Base
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- if: ${{ matrix.os == 'ubuntu-latest' }}
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-base/build/reports/jacoco/report.xml
- flags: strongback
- - name: Upload coverage to Codecov - Strongback - H2 Supplier
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- if: ${{ matrix.os == 'ubuntu-latest' }}
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-h2-supplier/build/reports/jacoco/report.xml
- flags: h2
- - name: Upload coverage to Codecov - Strongback - RMI Supplier
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- if: ${{ matrix.os == 'ubuntu-latest' }}
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-rmi-supplier/build/reports/jacoco/report.xml
- flags: rmi
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 16a10903..69c74323 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -118,21 +118,3 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./mission-report/flight-evaluation-report/build/reports/jacoco/report.xml,./mission-report/flight-evaluation-report/node/build/coverage/cobertura-coverage.xml
flags: flighteval
- - name: Upload coverage to Codecov - Strongback - Base
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-base/build/reports/jacoco/report.xml
- flags: strongback
- - name: Upload coverage to Codecov - Strongback - H2 Supplier
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-h2-supplier/build/reports/jacoco/report.xml
- flags: h2
- - name: Upload coverage to Codecov - Strongback - RMI Supplier
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
- with:
- token: ${{ secrets.CODECOV_TOKEN }}
- file: ./strongback/strongback-rmi-supplier/build/reports/jacoco/report.xml
- flags: rmi
diff --git a/README.md b/README.md
index cd59a0e7..02969814 100644
--- a/README.md
+++ b/README.md
@@ -54,10 +54,8 @@ will at least take a look.
- [Booster Test Kit](boosters/testkit)
- Mission Report
- [Flight Evaluation Report](mission-report/flight-evaluation-report)
-- Strongback
- - [Strongback Base](strongback/strongback-base)
- - [Strongback H2 Supplier](strongback/strongback-h2-supplier)
- - [Strongback RMI Supplier](strongback/strongback-rmi-supplier)
+- Strongback (All modules removed in 4.1.x)
+ - Strongback functionality is completely removed in 4.1.x release as Strongbacks were very slow and hard to maintain.
## Terminology and Lifecycle
diff --git a/build.gradle b/build.gradle
index ccca30f6..f4c45b61 100644
--- a/build.gradle
+++ b/build.gradle
@@ -53,7 +53,7 @@ versioner {
}
configure(subprojects.findAll({
- !'boosters'.equalsIgnoreCase(it.name) && !'strongback'.equalsIgnoreCase(it.name) && !'mission-report'.equalsIgnoreCase(it.name)
+ !'boosters'.equalsIgnoreCase(it.name) && !'mission-report'.equalsIgnoreCase(it.name)
})) {
apply plugin: 'java'
apply plugin: 'checkstyle'
diff --git a/codecov.yml b/codecov.yml
index b0f1a175..f3111eb5 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -19,12 +19,6 @@ coverage:
flags: testkit
flighteval:
flags: flighteval
- strongback:
- flags: strongback
- h2:
- flags: h2
- rmi:
- flags: rmi
patch: false
flags:
core:
@@ -48,12 +42,3 @@ flags:
flighteval:
paths:
- ./mission-report/flight-evaluation-report
- strongback:
- paths:
- - ./strongback/strongback-base
- h2:
- paths:
- - ./strongback/strongback-h2-supplier
- rmi:
- paths:
- - ./strongback/strongback-rmi-supplier
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index b64c4088..52550254 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -10,8 +10,6 @@ logbackReport = "1.4.8"
jackson = "2.15.2"
gson = "2.10.1"
slf4j = "1.7.36"
-h2 = "2.1.214"
-jdbi3 = "3.39.1"
lombok = "1.18.28"
findbugs = "3.0.2"
@@ -55,9 +53,6 @@ jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", ver
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
-h2 = { module = "com.h2database:h2", version.ref = "h2" }
-jdbi3-sqlobject = { module = "org.jdbi:jdbi3-sqlobject", version.ref = "jdbi3" }
-
lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
findbugs-jsr305 = { module = "com.google.code.findbugs:jsr305", version.ref = "findbugs" }
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 6e4c37d4..200214eb 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -136,11 +136,6 @@
-
-
-
-
-
@@ -171,11 +166,6 @@
-
-
-
-
-
@@ -871,14 +861,6 @@
-
-
-
-
-
-
-
-
@@ -1509,21 +1491,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1718,42 +1685,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2382,11 +2313,6 @@
-
-
-
-
-
diff --git a/settings.gradle b/settings.gradle
index ea2749b3..24a905aa 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -6,6 +6,3 @@ include 'boosters:booster-testng'
include 'boosters:booster-junit4'
include 'boosters:booster-cucumber-jvm'
include 'mission-report:flight-evaluation-report'
-include 'strongback:strongback-base'
-include 'strongback:strongback-h2-supplier'
-include 'strongback:strongback-rmi-supplier'
diff --git a/strongback/strongback-base/README.md b/strongback/strongback-base/README.md
deleted file mode 100644
index bf8dad68..00000000
--- a/strongback/strongback-base/README.md
+++ /dev/null
@@ -1,102 +0,0 @@
-![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)
-
-[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
-[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
-[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
-[![JavaCI](https://img.shields.io/github/actions/workflow/status/nagyesta/abort-mission/gradle.yml?logo=github&branch=main)](https://github.com/nagyesta/abort-mission/actions/workflows/gradle.yml)
-
-# Strongback Base
-
-[![codecov strongback](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20Base&flag=strongback&token=I832ZCIONI)](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20Base&flag=strongback&token=I832ZCIONI)
-![[Stable](https://img.shields.io/badge/Maturity-stable-green)](https://img.shields.io/badge/Maturity-stable-green)
-
-Please find the essentials below or check out [the wiki](https://github.com/nagyesta/abort-mission/wiki) for more
-details.
-
-# Quick-start
-
-## Dependency
-
-Abort-Mission can be downloaded from a few Maven repositories. Please head to
-[this page](https://github.com/nagyesta/abort-mission/wiki/Configuring-our-repository-for-your-build-system)
-to find out more.
-
-### Maven
-
-```xml
-
- com.github.nagyesta.abort-mission.strongback
- abort.strongback-base
- RELEASE
- test
-
-```
-
-### Gradle
-
-```groovy
-testImplementation "com.github.nagyesta.abort-mission.strongback:abort.strongback-base:+"
-```
-
-## Integration
-
-The base Strongback component is not intended to be integrated on its own. It is more of a foundation piece that can reduce boilerplate in
-specific Strongback implementations that offer to augment launch characteristics of the boosters.
-
-With that said, if you have a need to use a currently unsupported Strongback type, please feel free to reuse the code of this base component
-by adding it to your classpath. Your own Strongback component can be even compatible with the gradle plugin, or the other Abort-Mission
-components as long as you fulfill a few simple rules. Please see these below:
-
-1. Implement the [StrongbackController](./src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackController.java)
- interface which should:
- 1. Prepare the Strongback (such as starting an external component etc.) when `erect()` is called.
- 2. Take care of publishing the launch report from the telemetry collected when `retract()` is called.
- 3. Clean-up the Strongback (such as stopping the external service) when `retract()` is called.
-2. `strongback-blueprint.xml` must be created as a root Spring XML configuration, and it should define an instance of the controller you
- implemented
-3. If your Strongback needs to deploy any parts together with the core Abort-Mission components, for example provide a statistics collector
- or something else, you should make sure you are not introducing unnecessary dependencies on your test classpath.
-
-## Configuration
-
-The base Strongback offers the following configuration properties for the specific implementations to use. These are all relative to
-the `abort-mission.telemetry.server.` property prefix.
-
-| Property suffix | Type | Description |
-| --------------- | ------- | -------------------------------------------------------------------------------------------------- |
-| `port` | int | Specifies the port used by the implementing Strongback. |
-| `useExternal` | boolean | Indicates whether we need to use an externally provided server instead of the embedded. (optional) |
-| `password` | String | The password needed for server startup and shutdown. (optional) |
-
-If you are using the Gradle plugin, these properties can be supplied by the plugin for the standard configuration.
-
-## Build tool independent steps needed for Strongback lifecycle management
-
-### Erect
-
-You need to put your Strongback implementation, the base Strongback and all of their dependencies on a classpath
-(referenced as `strongback_classpath`).
-
-```
-java -Dabort-mission.telemetry.server.port=29542 \
- -Dabort-mission.telemetry.server.useExternal=false \
- -Dabort-mission.telemetry.server.password=S3cr3t \
- -cp \
- com.github.nagyesta.abortmission.strongback.StrongbackErectorMain &
-```
-
-**Warning:** You must run the above step in the background (keeping it running during the test is executed).
-
-### Retract
-
-You need to put your Strongback implementation, the base Strongback and all of their dependencies on a classpath
-(referenced as `strongback_classpath`).
-
-```
-java -Dabort-mission.telemetry.server.port=29542 \
- -Dabort-mission.telemetry.server.useExternal=false \
- -Dabort-mission.telemetry.server.password=S3cr3t \
- -Dabort-mission.report.directory=build/reports/abort-mission/ \
- -cp \
- com.github.nagyesta.abortmission.strongback.StrongbackRetractorMain
-```
diff --git a/strongback/strongback-base/build.gradle b/strongback/strongback-base/build.gradle
deleted file mode 100644
index 42b1e597..00000000
--- a/strongback/strongback-base/build.gradle
+++ /dev/null
@@ -1,61 +0,0 @@
-group = "${rootProject.group}.strongback"
-
-project.ext {
- artifactDisplayName = "Abort Mission - Strongback Base"
- artifactDescription = "Generic parts of supporting components (e.g. solving JVM forking problem)."
-}
-
-dependencies {
- implementation project(":mission-control")
- implementation libs.spring.context
- implementation libs.spring.core
- implementation libs.slf4j.api
- implementation libs.logback.classic.report
- testImplementation libs.jupiter.core
- testImplementation libs.mockito.core
-}
-
-test {
- useJUnitPlatform()
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifactId = "abort.${project.name}"
- pom {
- name = "${project.artifactDisplayName}"
- description = "${project.artifactDescription}"
- url = rootProject.ext.repoUrl
- licenses {
- license {
- name = rootProject.ext.licenseName
- url = rootProject.ext.licenseUrl
- }
- }
- developers {
- developer {
- id = rootProject.ext.maintainerId
- name = rootProject.ext.maintainerName
- url = rootProject.ext.maintainerUrl
- }
- }
- scm {
- connection = rootProject.ext.scmConnection
- developerConnection = rootProject.ext.scmConnection
- url = rootProject.ext.scmProjectUrl
- }
- withXml {
- asNode().dependencies.'*'.findAll() {
- it.scope.text() == 'runtime'
- }.each { it.scope*.value = 'compile' }
- }
- }
- }
- }
-}
-
-signing {
- sign publishing.publications.mavenJava
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackErectorMain.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackErectorMain.java
deleted file mode 100644
index ea334157..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackErectorMain.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.github.nagyesta.abortmission.strongback;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackController;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.ImportResource;
-
-/**
- * Entry point for pre-test preparation.
- */
-@ComponentScan
-@ImportResource(locations = "classpath:/strongback-blueprint.xml")
-@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
-public class StrongbackErectorMain {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(StrongbackErectorMain.class);
-
- public static void main(final String[] args) {
- LOGGER.info("Setting up Strongback...");
- new AnnotationConfigApplicationContext(StrongbackErectorMain.class)
- .getBean(StrongbackController.class).erect();
- LOGGER.info("Completed.");
- }
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackRetractorMain.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackRetractorMain.java
deleted file mode 100644
index 4bd8d7d9..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/StrongbackRetractorMain.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.github.nagyesta.abortmission.strongback;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackController;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.ImportResource;
-
-/**
- * Entry point for post-test tear-down.
- */
-@ComponentScan
-@ImportResource(locations = "classpath:/strongback-blueprint.xml")
-@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
-public class StrongbackRetractorMain {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(StrongbackRetractorMain.class);
-
- public static void main(final String[] args) {
- LOGGER.info("Retracting Strongback...");
- new AnnotationConfigApplicationContext(StrongbackRetractorMain.class)
- .getBean(StrongbackController.class).retract();
- LOGGER.info("Completed.");
- }
-
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollector.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollector.java
deleted file mode 100644
index 75d46483..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollector.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatistics;
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.healthcheck.impl.AbstractStageStatisticsCollector;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Stream;
-
-/**
- * The base component counting mission success/failure events in order to aid abort decision-making.
- */
-public abstract class ExternalStageStatisticsCollector extends AbstractStageStatisticsCollector implements StageStatistics {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ExternalStageStatisticsCollector.class);
- private final String contextName;
- private final boolean countdown;
-
- /**
- * Default constructor only setting the matcher.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param countdown True if the collector will be used for countdown.
- */
- public ExternalStageStatisticsCollector(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- super(matcher);
- this.contextName = contextName;
- this.countdown = countdown;
- }
-
- @Override
- public StageStatisticsSnapshot getSnapshot() {
- LOGGER.trace("Fetching snapshot for matcher {}", getMatcher());
- return doGetSnapshot(contextName, getMatcher(), countdown);
- }
-
- @Override
- public Stream timeSeriesStream() {
- LOGGER.trace("Fetching time series stream for matcher {}", getMatcher());
- return doFetchAll(contextName, getMatcher(), countdown).stream();
- }
-
- @Override
- public void logTimeMeasurement(final StageTimeMeasurement timeMeasurement) {
- doLogTimeMeasurement(contextName, getMatcher(), countdown, Objects.requireNonNull(timeMeasurement, "Measurement cannot be null."));
- if (countdown) {
- LOGGER.trace("Logging countdown {} event for class: {} with id: {}",
- timeMeasurement.getResult(), timeMeasurement.getTestClassId(), timeMeasurement.getLaunchId());
- } else {
- LOGGER.trace("Logging mission {} event for class: {} and method: {} with id: {}",
- timeMeasurement.getResult(), timeMeasurement.getTestClassId(),
- timeMeasurement.getTestCaseId(), timeMeasurement.getLaunchId());
- }
- }
-
- /**
- * Obtains a snapshot from the implementing strongback for read-only use.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param countdown True if the collector will be used for countdown.
- * @return snapshot
- */
- @SuppressWarnings("checkstyle:HiddenField")
- protected abstract StageStatisticsSnapshot doGetSnapshot(String contextName,
- MissionHealthCheckMatcher matcher,
- boolean countdown);
-
- /**
- * Obtains the list of stage time measurements we have collected so far for a matcher.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param countdown True if the collector will be used for countdown.
- * @return list
- */
- @SuppressWarnings("checkstyle:HiddenField")
- protected abstract List doFetchAll(String contextName,
- MissionHealthCheckMatcher matcher,
- boolean countdown);
-
- /**
- * Captures the measurement instance provided for reporting purposes.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param countdown True if the collector will be used for countdown.
- * @param measurement The measurement we observed.
- */
- @SuppressWarnings("checkstyle:HiddenField")
- protected abstract void doLogTimeMeasurement(String contextName,
- MissionHealthCheckMatcher matcher,
- boolean countdown,
- StageTimeMeasurement measurement);
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelper.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelper.java
deleted file mode 100644
index 95ce1c46..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelper.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-import java.util.Optional;
-import java.util.regex.Pattern;
-
-/**
- * Util class for strongback configuration.
- */
-public final class StrongbackConfigurationHelper {
-
- /**
- * The property name we can use to specify the port used by the implementing strongback.
- */
- public static final String SERVER_PORT_PROPERTY_NAME = "abort-mission.telemetry.server.port";
- /**
- * The property name we need to use to indicate that we need to use an externally provided server instead of the embedded.
- */
- public static final String SERVER_USE_EXTERNAL_PROPERTY_NAME = "abort-mission.telemetry.server.useExternal";
- /**
- * The property name we need to use for obtaining the server management password for startup and shutdown.
- */
- public static final String SERVER_PASSWORD_PROPERTY_NAME = "abort-mission.telemetry.server.password";
-
- private static final String INT_ONLY = "^[0-9]+$";
- private static final String BOOLEAN_ONLY = "^(true|false)$";
-
-
- private StrongbackConfigurationHelper() {
- //util class
- }
-
- /**
- * Parses an integer property value if possible.
- *
- * @param propertyValue The string value of the property.
- * @return An optional with the parsed integer (or null if parse fails).
- */
- public static Optional safeParseIntType(final String propertyValue) {
- return Optional.ofNullable(propertyValue)
- .filter(s -> Pattern.compile(INT_ONLY).matcher(s).matches())
- .map(Integer::parseInt);
- }
-
- /**
- * Parses a boolean property value if possible.
- *
- * @param propertyValue The string value of the property.
- * @return true if the value was parsed and was true, false otherwise.
- */
- public static boolean safeParseBooleanType(final String propertyValue) {
- return Optional.ofNullable(propertyValue)
- .map(String::toLowerCase)
- .filter(s -> Pattern.compile(BOOLEAN_ONLY).matcher(s).matches())
- .map(Boolean::parseBoolean)
- .orElse(false);
- }
-
- /**
- * Evaluates the default port configuration property and returns the parsed value as an optional.
- *
- * @return An optional with the parsed integer (or null if parse fails).
- */
- public static Optional optionalPortValue() {
- return safeParseIntType(System.getProperty(SERVER_PORT_PROPERTY_NAME));
- }
-
-
- /**
- * Evaluates the external usage configuration property and returns the control flag value.
- *
- * @return true if the value was parsed and was true, false otherwise.
- */
- public static boolean useExternalServer() {
- return safeParseBooleanType(System.getProperty(SERVER_USE_EXTERNAL_PROPERTY_NAME));
- }
-
- /**
- * Evaluates the password property and returns the value wrapped into an optional.
- *
- * @return The provided password.
- */
- public static Optional optionalServerPassword() {
- return Optional.ofNullable(System.getProperty(SERVER_PASSWORD_PROPERTY_NAME));
- }
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackController.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackController.java
deleted file mode 100644
index 61e633c0..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackController.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-/**
- * Controls lifecycle steps related to the strongback.
- */
-public interface StrongbackController {
-
- /**
- * Prepares for the launch by setting up the supporting system we will use for the tests.
- */
- void erect();
-
- /**
- * Exports telemetry data and tears down the supporting system after the tests.
- */
- void retract();
-}
diff --git a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackException.java b/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackException.java
deleted file mode 100644
index 0c3297ce..00000000
--- a/strongback/strongback-base/src/main/java/com/github/nagyesta/abortmission/strongback/base/StrongbackException.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-/**
- * Root of the exception hierarchy used by strongback modules.
- */
-public class StrongbackException extends RuntimeException {
-
- public StrongbackException(final String message) {
- super(message);
- }
-
- public StrongbackException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public StrongbackException(final Throwable cause) {
- super(cause);
- }
-}
diff --git a/strongback/strongback-base/src/main/resources/logback.xml b/strongback/strongback-base/src/main/resources/logback.xml
deleted file mode 100644
index 4d32d44e..00000000
--- a/strongback/strongback-base/src/main/resources/logback.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-
-
-
-
-
-
-
diff --git a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/NoOpController.java b/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/NoOpController.java
deleted file mode 100644
index 686fb26b..00000000
--- a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/NoOpController.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.github.nagyesta.abortmission.strongback;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackController;
-
-public class NoOpController implements StrongbackController {
-
- @Override
- public void erect() {
-
- }
-
- @Override
- public void retract() {
-
- }
-}
diff --git a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/StrongbackMainTest.java b/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/StrongbackMainTest.java
deleted file mode 100644
index 1a3d1ebb..00000000
--- a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/StrongbackMainTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.github.nagyesta.abortmission.strongback;
-
-import org.junit.jupiter.api.Test;
-
-class StrongbackMainTest {
-
- @Test
- void testErectorMainShouldResolvesBeansWhenCalled() {
- //given
-
- //when
- StrongbackErectorMain.main(new String[0]);
-
- //then no exception
- }
-
-
- @Test
- void testRetractorMainShouldResolvesBeansWhenCalled() {
- //given
-
- //when
- StrongbackRetractorMain.main(new String[0]);
-
- //then no exception
- }
-}
diff --git a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollectorTest.java b/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollectorTest.java
deleted file mode 100644
index 3f674226..00000000
--- a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/ExternalStageStatisticsCollectorTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.ValueSource;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import static org.mockito.Mockito.*;
-
-class ExternalStageStatisticsCollectorTest {
-
- private static final String CONTEXT = "context";
- private static final String MATCHER = "matcher";
-
- @Test
- void testGetSnapshotShouldCallDoGetSnapshotWhenCalled() {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final ExternalStageStatisticsCollector underTest =
- spy(new NoOpExternalStageStatisticsCollector(CONTEXT, matcher, true));
-
- //when
- underTest.getSnapshot();
-
- //then
- verify(underTest).getSnapshot();
- }
-
- @Test
- void testTimeSeriesStreamShouldCallDoFetchAllWhenCalled() {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final ExternalStageStatisticsCollector underTest =
- spy(new NoOpExternalStageStatisticsCollector(CONTEXT, matcher, true));
-
- //when
- underTest.timeSeriesStream();
-
- //then
- verify(underTest).doFetchAll(eq(CONTEXT), eq(matcher), eq(true));
- }
-
- @ParameterizedTest
- @ValueSource(booleans = {true, false})
- void testLogTimeMeasurementShouldCallDoLogTimeMeasurementWhenCalled(final boolean countdown) {
- //given
- final StageTimeMeasurement measurement = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.randomUUID())
- .setTestClassId(ExternalStageStatisticsCollectorTest.class.getName())
- .setTestCaseId(StageTimeMeasurement.CLASS_ONLY)
- .setDisplayName(StageTimeMeasurement.CLASS_ONLY)
- .setStart(0)
- .setEnd(0)
- .setThreadName(Thread.currentThread().getName())
- .setResult(StageResult.SUCCESS)
- .build();
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final ExternalStageStatisticsCollector underTest =
- spy(new NoOpExternalStageStatisticsCollector(CONTEXT, matcher, countdown));
-
- //when
- underTest.logTimeMeasurement(measurement);
-
- //then
- verify(underTest).doLogTimeMeasurement(eq(CONTEXT), eq(matcher), eq(countdown), same(measurement));
- }
-
- private static class NoOpExternalStageStatisticsCollector extends ExternalStageStatisticsCollector {
- NoOpExternalStageStatisticsCollector(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- super(contextName, matcher, countdown);
- }
-
- @Override
- protected StageStatisticsSnapshot doGetSnapshot(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- return null;
- }
-
- @Override
- protected List doFetchAll(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- return Collections.emptyList();
- }
-
- @Override
- protected void doLogTimeMeasurement(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown,
- final StageTimeMeasurement measurement) {
-
- }
- }
-
-}
diff --git a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelperTest.java b/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelperTest.java
deleted file mode 100644
index 1d0edd54..00000000
--- a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackConfigurationHelperTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-class StrongbackConfigurationHelperTest {
-
- @Test
- void testOptionalPortValueShouldReturnEmptyWhenTheSystemPropertyIsNotProvided() {
- //given
-
- //when
- final Optional actual = StrongbackConfigurationHelper.optionalPortValue();
-
- //then
- Assertions.assertFalse(actual.isPresent());
- }
-
- @Test
- void testUseExternalServerShouldReturnDefaultValueWhenTheSystemPropertyIsNotProvided() {
- //given
-
- //when
- final boolean actual = StrongbackConfigurationHelper.useExternalServer();
-
- //then
- Assertions.assertFalse(actual);
- }
-
- @Test
- void testOptionalServerPasswordShouldReturnEmptyValueWhenTheSystemPropertyIsNotProvided() {
- //given
-
- //when
- final Optional actual = StrongbackConfigurationHelper.optionalServerPassword();
-
- //then
- Assertions.assertFalse(actual.isPresent());
- }
-
- @Test
- void testSafeParseIntTypeShouldReturnParsedValueWhenValidInputProvided() {
- //given
-
- //when
- final Optional actual = StrongbackConfigurationHelper.safeParseIntType("1");
-
- //then
- Assertions.assertTrue(actual.isPresent());
- Assertions.assertEquals(1, actual.get());
- }
-
- @Test
- void testSafeParseBooleanTypeShouldReturnParsedValueWhenValidInputProvided() {
- //given
-
- //when
- final boolean actual = StrongbackConfigurationHelper.safeParseBooleanType("true");
-
- //then
- Assertions.assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackExceptionTest.java b/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackExceptionTest.java
deleted file mode 100644
index 3495553c..00000000
--- a/strongback/strongback-base/src/test/java/com/github/nagyesta/abortmission/strongback/base/StrongbackExceptionTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.base;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-class StrongbackExceptionTest {
-
- @Test
- void testThrowWithOnlyMessageShouldWorkWhenCalled() {
- //given
-
- //when
- Assertions.assertThrows(StrongbackException.class, () -> {
- throw new StrongbackException("");
- });
-
- //then + exception
- }
-
- @Test
- void testThrowWithMessageAndCauseShouldWorkWhenCalled() {
- //given
-
- //when
- Assertions.assertThrows(StrongbackException.class, () -> {
- throw new StrongbackException("", new IllegalArgumentException());
- });
-
- //then + exception
- }
-
- @Test
- void testThrowWithOnlyCauseShouldWorkWhenCalled() {
- //given
-
- //when
- Assertions.assertThrows(StrongbackException.class, () -> {
- throw new StrongbackException(new IllegalArgumentException());
- });
-
- //then + exception
- }
-}
diff --git a/strongback/strongback-base/src/test/resources/strongback-blueprint.xml b/strongback/strongback-base/src/test/resources/strongback-blueprint.xml
deleted file mode 100644
index ebec10da..00000000
--- a/strongback/strongback-base/src/test/resources/strongback-blueprint.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
diff --git a/strongback/strongback-h2-supplier/README.md b/strongback/strongback-h2-supplier/README.md
deleted file mode 100644
index 1e1cd29a..00000000
--- a/strongback/strongback-h2-supplier/README.md
+++ /dev/null
@@ -1,81 +0,0 @@
-![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)
-
-[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
-[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
-[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
-[![JavaCI](https://img.shields.io/github/actions/workflow/status/nagyesta/abort-mission/gradle.yml?logo=github&branch=main)](https://github.com/nagyesta/abort-mission/actions/workflows/gradle.yml)
-
-# Strongback H2 Supplier
-
-[![codecov strongback](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20H2&flag=h2&token=I832ZCIONI)](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20H2&flag=h2&token=I832ZCIONI)
-![[Stable](https://img.shields.io/badge/Maturity-stable-green)](https://img.shields.io/badge/Maturity-stable-green)
-
-Please find the essentials below or check out [the wiki](https://github.com/nagyesta/abort-mission/wiki) for more details.
-
-This component aims to allow Abort-Mission use even in case you are using JVM forks. Please note, that it might be suboptimal to rely on
-this Strongback in case you are not using JVM forks. This is due to the performance hit taken
-(~4-10 ms per DB call on a laptop).
-
-# Quick-start
-
-## Dependency
-
-Abort-Mission can be downloaded from a few Maven repositories. Please head to
-[this page](https://github.com/nagyesta/abort-mission/wiki/Configuring-our-repository-for-your-build-system)
-to find out more.
-
-### Maven
-
-```xml
-
- com.github.nagyesta.abort-mission.strongback
- abort.strongback-h2-supplier
- RELEASE
- test
-
-```
-
-### Gradle
-
-```groovy
-testImplementation "com.github.nagyesta.abort-mission.strongback:abort.strongback-h2-supplier:+"
-```
-
-## Integration
-
-Integrating the H2 supplier Strongback is a simple addition once Abort-Mission integration is already done.
-
-### Strongback lifecycle
-
-#### Gradle
-
-The Abort-Mission Gradle plugin is capable of providing the standard configuration for the lifecycle of the Strongback before and after the
-tests. In order to start actually utilizing it, please complete the **Test integration** configuration steps below.
-
-#### Maven
-
-There is no Strongback support in case of the Maven plugin at the moment. The recommended option is to use one of the plugins available for
-Java execution and take care of erecting and retracting the Strongback as defined [here](../strongback-base/README.md).
-
-## Test integration
-
-You need to use an instance of the H2 specific statistics collector,
-[H2BackedStageStatisticsCollectorFactory](./src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorFactory.java)
-, in order to send over and store the measurement data in the H2 database started by the H2 Strongback. This will require a Db connection as
-well. You can
-use [H2DataSourceProvider#createDefaultDataSource()](./src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2DataSourceProvider.java)
-to obtain one.
-
-```java
-final StageStatisticsCollectorFactory factory =
- new H2BackedStageStatisticsCollectorFactory(
- "contextName", H2DataSourceProvider.createDefaultDataSource());
-
-PercentageBasedMissionHealthCheckEvaluator evaluator = percentageBasedEvaluator(matcher, factory)
- .abortThreshold(ABORT_THRESHOLD).build();
-ReportOnlyMissionHealthCheckEvaluator noop = reportOnlyEvaluator(matcher, factory)
- .build();
-```
-
-Provided that the Strongback lifecycle (and configuration) is managed properly, and there is no network issue preventing you from
-connecting, this should be enough for you to store your measurements externally.
diff --git a/strongback/strongback-h2-supplier/build.gradle b/strongback/strongback-h2-supplier/build.gradle
deleted file mode 100644
index 28fdbfa7..00000000
--- a/strongback/strongback-h2-supplier/build.gradle
+++ /dev/null
@@ -1,73 +0,0 @@
-group = "${rootProject.group}.strongback"
-
-project.ext {
- artifactDisplayName = "Abort Mission - Strongback H2 Supplier"
- artifactDescription = "H2 implementation of Strongback logic."
-}
-
-dependencies {
- implementation (project(":strongback:strongback-base")) {
- transitive = false
- }
- implementation project(":mission-control")
- implementation libs.h2
- implementation libs.jdbi3.sqlobject
- testImplementation project(":boosters:testkit")
- testImplementation project(":boosters:booster-junit-jupiter")
- testImplementation libs.jupiter.core
- testImplementation libs.mockito.core
- testImplementation libs.spring.boot.starter
- testImplementation libs.spring.boot.starter.test
- testImplementation libs.jupiter.platform.testkit
- constraints {
- testImplementation libs.bundles.spring.test
- }
-}
-
-test {
- useJUnitPlatform {
- systemProperty("abort-mission.report.directory", file("${buildDir}/reports/abort-mission/"))
- includeTags 'unit', 'integration'
- }
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifactId = "abort.${project.name}"
- pom {
- name = "${project.artifactDisplayName}"
- description = "${project.artifactDescription}"
- url = rootProject.ext.repoUrl
- licenses {
- license {
- name = rootProject.ext.licenseName
- url = rootProject.ext.licenseUrl
- }
- }
- developers {
- developer {
- id = rootProject.ext.maintainerId
- name = rootProject.ext.maintainerName
- url = rootProject.ext.maintainerUrl
- }
- }
- scm {
- connection = rootProject.ext.scmConnection
- developerConnection = rootProject.ext.scmConnection
- url = rootProject.ext.scmProjectUrl
- }
- withXml {
- asNode().dependencies.'*'.findAll() {
- it.scope.text() == 'runtime'
- }.each { it.scope*.value = 'compile' }
- }
- }
- }
- }
-}
-
-signing {
- sign publishing.publications.mavenJava
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/H2StrongbackController.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/H2StrongbackController.java
deleted file mode 100644
index bd2023bd..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/H2StrongbackController.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2;
-
-import com.github.nagyesta.abortmission.core.telemetry.ReportingHelper;
-import com.github.nagyesta.abortmission.core.telemetry.stats.LaunchTelemetryDataSource;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackController;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2SchemaInitializer;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2ServerManager;
-import com.github.nagyesta.abortmission.strongback.h2.telemetry.H2BackedLaunchTelemetryDataSource;
-
-import javax.sql.DataSource;
-
-/**
- * H2 specific implementation of {@link StrongbackController}.
- */
-public class H2StrongbackController implements StrongbackController {
-
- private final H2ServerManager serverManager;
- private final DataSource dataSource;
-
- public H2StrongbackController(final H2ServerManager serverManager, final DataSource dataSource) {
- this.serverManager = serverManager;
- this.dataSource = dataSource;
- }
-
- @Override
- public void erect() {
- serverManager.startServer();
- new H2SchemaInitializer(dataSource).initialize();
- }
-
- @Override
- public void retract() {
- final LaunchTelemetryDataSource telemetryDataSource =
- new H2BackedLaunchTelemetryDataSource(dataSource);
- new ReportingHelper().report(telemetryDataSource);
- serverManager.stopServer();
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepository.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepository.java
deleted file mode 100644
index a8e64205..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepository.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.repository;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.healthcheck.impl.DefaultStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.h2.repository.mapper.StageTimeMeasurementMapper;
-import org.jdbi.v3.core.mapper.RowMapper;
-import org.jdbi.v3.core.statement.StatementContext;
-import org.jdbi.v3.core.transaction.TransactionIsolationLevel;
-import org.jdbi.v3.sqlobject.config.RegisterRowMapper;
-import org.jdbi.v3.sqlobject.customizer.Bind;
-import org.jdbi.v3.sqlobject.customizer.BindBean;
-import org.jdbi.v3.sqlobject.statement.SqlQuery;
-import org.jdbi.v3.sqlobject.statement.SqlUpdate;
-import org.jdbi.v3.sqlobject.transaction.Transaction;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-/**
- * The repository we will use for data access.
- */
-public interface LaunchStatisticsRepository {
-
- /**
- * Inserts a single time measurement to the database.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @param measurement The measurement we observed.
- */
- @SqlUpdate("INSERT INTO LAUNCH_STATISTICS("
- + " CONTEXT_NAME,"
- + " MATCHER_NAME,"
- + " LAUNCH_ID,"
- + " COUNTDOWN,"
- + " TEST_CLASS,"
- + " TEST_METHOD,"
- + " TEST_RESULT,"
- + " START_MILLIS,"
- + " END_MILLIS,"
- + " DISPLAY_NAME,"
- + " THREAD_NAME,"
- + " THROWABLE_TYPE,"
- + " THROWABLE_MESSAGE,"
- + " THROWABLE_STACK_TRACE"
- + ") "
- + "VALUES ("
- + " :contextName,"
- + " :matcherName,"
- + " :launchId,"
- + " :countdown,"
- + " :testClassId,"
- + " :testCaseId,"
- + " :result,"
- + " :start,"
- + " :end,"
- + " :displayName,"
- + " :threadName,"
- + " :throwableClass,"
- + " :throwableMessage,"
- + " :stackTraceAsString"
- + ")")
- @Transaction(value = TransactionIsolationLevel.READ_COMMITTED)
- void insertStageTimeMeasurement(@Bind("contextName") String contextName,
- @Bind("matcherName") String matcherName,
- @Bind("countdown") boolean countdown,
- @BindBean StageTimeMeasurement measurement);
-
- /**
- * Fetches all previously recorded measurements for the given matcher name.
- * The order of entries will be by start, end, class, method, launchId, result.
- *
- * @param matcherName The name of the matcher we need to filter for.
- * @return The matching measurements.
- */
- @SqlQuery("SELECT"
- + " LAUNCH_ID as launchId,"
- + " TEST_CLASS as testClassId,"
- + " TEST_METHOD as testCaseId,"
- + " TEST_RESULT as result,"
- + " START_MILLIS as start,"
- + " END_MILLIS as `end`,"
- + " DISPLAY_NAME as displayName,"
- + " THREAD_NAME as threadName,"
- + " THROWABLE_TYPE as throwableClass,"
- + " THROWABLE_MESSAGE as throwableMessage,"
- + " THROWABLE_STACK_TRACE as stackTraceAsString "
- + "FROM LAUNCH_STATISTICS "
- + "WHERE MATCHER_NAME = :matcherName "
- + "ORDER BY START_MILLIS, END_MILLIS, TEST_CLASS, TEST_METHOD, LAUNCH_ID, TEST_RESULT")
- @RegisterRowMapper(StageTimeMeasurementMapper.class)
- @Transaction(value = TransactionIsolationLevel.READ_COMMITTED, readOnly = true)
- List fetchAllMeasurementsForMatcher(@Bind("matcherName") String matcherName);
-
- /**
- * Fetches all previously recorded measurements for the given matcher name.
- * The order of entries will be by start, end, class, method, launchId, result.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @return The matching measurements.
- */
- @SqlQuery("SELECT"
- + " LAUNCH_ID as launchId,"
- + " TEST_CLASS as testClassId,"
- + " TEST_METHOD as testCaseId,"
- + " TEST_RESULT as result,"
- + " START_MILLIS as start,"
- + " END_MILLIS as `end`,"
- + " DISPLAY_NAME as displayName,"
- + " THREAD_NAME as threadName,"
- + " THROWABLE_TYPE as throwableClass,"
- + " THROWABLE_MESSAGE as throwableMessage,"
- + " THROWABLE_STACK_TRACE as stackTraceAsString "
- + "FROM LAUNCH_STATISTICS "
- + "WHERE CONTEXT_NAME = :contextName"
- + " AND MATCHER_NAME = :matcherName"
- + " AND COUNTDOWN = :countdown "
- + "ORDER BY START_MILLIS, END_MILLIS, TEST_CLASS, TEST_METHOD, LAUNCH_ID, TEST_RESULT")
- @RegisterRowMapper(StageTimeMeasurementMapper.class)
- @Transaction(value = TransactionIsolationLevel.READ_COMMITTED, readOnly = true)
- List fetchMeasurementsFor(@Bind("contextName") String contextName,
- @Bind("matcherName") String matcherName,
- @Bind("countdown") boolean countdown);
-
- /**
- * Fetches all matcher names we used so far.
- *
- * @return The matcher names.
- */
- @SqlQuery("SELECT DISTINCT MATCHER_NAME "
- + "FROM LAUNCH_STATISTICS "
- + "ORDER BY MATCHER_NAME")
- @Transaction(value = TransactionIsolationLevel.READ_COMMITTED, readOnly = true)
- List fetchAllMatcherNames();
-
- /**
- * Gets a snapshot of the previously recorded measurements for abort evaluation.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @return The snapshot.
- */
- @SqlQuery("SELECT"
- + " SUM(CASE WHEN TEST_RESULT = 0 THEN 1 ELSE 0 END) as failed,"
- + " SUM(CASE WHEN TEST_RESULT = 1 THEN 1 ELSE 0 END) as aborted,"
- + " SUM(CASE WHEN TEST_RESULT = 2 THEN 1 ELSE 0 END) as suppressed,"
- + " SUM(CASE WHEN TEST_RESULT = 3 THEN 1 ELSE 0 END) as succeeded "
- + "FROM LAUNCH_STATISTICS "
- + "WHERE CONTEXT_NAME = :contextName"
- + " AND MATCHER_NAME = :matcherName"
- + " AND COUNTDOWN = :countdown")
- @RegisterRowMapper(H2BackedStageStatisticsSnapshotMapper.class)
- @Transaction(value = TransactionIsolationLevel.READ_COMMITTED, readOnly = true)
- StageStatisticsSnapshot getSnapshot(@Bind("contextName") String contextName,
- @Bind("matcherName") String matcherName,
- @Bind("countdown") boolean countdown);
-
- /**
- * Mapper class for calling the {@link StageStatisticsSnapshot} constructor properly.
- */
- class H2BackedStageStatisticsSnapshotMapper implements RowMapper {
-
- @Override
- public StageStatisticsSnapshot map(final ResultSet rs, final StatementContext ctx) throws SQLException {
- return new DefaultStageStatisticsSnapshot(
- rs.getInt("failed"),
- rs.getInt("succeeded"),
- rs.getInt("aborted"),
- rs.getInt("suppressed"));
- }
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/mapper/StageTimeMeasurementMapper.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/mapper/StageTimeMeasurementMapper.java
deleted file mode 100644
index 828e9ca5..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/repository/mapper/StageTimeMeasurementMapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.repository.mapper;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import org.jdbi.v3.core.mapper.RowMapper;
-import org.jdbi.v3.core.statement.StatementContext;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.regex.Pattern;
-
-/**
- * Maps the {@link StageTimeMeasurement} from the database column.
- */
-public class StageTimeMeasurementMapper implements RowMapper {
-
- @Override
- public StageTimeMeasurement map(final ResultSet rs, final StatementContext ctx) throws SQLException {
- return StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString(rs.getString("launchId")))
- .setTestClassId(rs.getString("testClassId"))
- .setTestCaseId(rs.getString("testCaseId"))
- .setResult(StageResult.values()[rs.getInt("result")])
- .setStart(rs.getLong("start"))
- .setEnd(rs.getLong("end"))
- .setDisplayName(rs.getString("displayName"))
- .setThreadName(rs.getString("threadName"))
- .setThrowableClass(rs.getString("throwableClass"))
- .setThrowableMessage(rs.getString("throwableMessage"))
- .setStackTrace(Optional.ofNullable(rs.getString("stackTraceAsString"))
- .map(s -> List.of(s.split(Pattern.quote(StageTimeMeasurement.STACKTRACE_LINE_SEPARATOR))))
- .orElse(null))
- .build();
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2DataSourceProvider.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2DataSourceProvider.java
deleted file mode 100644
index d7152eaf..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2DataSourceProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackConfigurationHelper;
-import org.h2.jdbcx.JdbcConnectionPool;
-import org.h2.jdbcx.JdbcDataSource;
-import org.jdbi.v3.core.Jdbi;
-import org.jdbi.v3.core.enums.EnumStrategy;
-import org.jdbi.v3.core.enums.Enums;
-import org.jdbi.v3.sqlobject.SqlObjectPlugin;
-
-import javax.sql.DataSource;
-
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2ServerConstants.*;
-
-/**
- * Utility class for data source creation.
- */
-public final class H2DataSourceProvider {
-
- private H2DataSourceProvider() {
- //util class
- }
-
- /**
- * Creates the default data source using the default port.
- *
- * @return dataSource
- */
- public static DataSource createDefaultDataSource() {
- final int port = StrongbackConfigurationHelper.optionalPortValue()
- .orElse(DEFAULT_H2_PORT);
- return createDefaultDataSource(port);
- }
-
- /**
- * Creates the default data source using the provided port.
- *
- * @param portNumber The port we need to use.
- * @return dataSource
- */
- public static DataSource createDefaultDataSource(final int portNumber) {
- final JdbcDataSource ds = new JdbcDataSource();
- ds.setURL(String.format(DEFAULT_H2_JDBC_CONNECTION_URL_FORMAT, portNumber, portNumber));
- ds.setUser(DEFAULT_H2_JDBC_USER_NAME);
- ds.setPassword(DEFAULT_H2_JDBC_PASSWORD);
- return JdbcConnectionPool.create(ds);
- }
-
- /**
- * Creates the JDBI instance using the provided data source and configures it properly.
- *
- * @param dataSource The data source we need to use for getting a connection.
- * @return The configured JDBI instance
- */
- public static Jdbi jdbi(final DataSource dataSource) {
- final Jdbi jdbi = Jdbi.create(dataSource);
- jdbi.installPlugin(new SqlObjectPlugin());
- jdbi.getConfig(Enums.class).setEnumStrategy(EnumStrategy.BY_ORDINAL);
- return jdbi;
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializer.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializer.java
deleted file mode 100644
index 6cb92c53..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.jdbi.v3.core.Jdbi;
-import org.jdbi.v3.core.JdbiException;
-
-import javax.sql.DataSource;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * Component taking care of DB schema creation.
- */
-public class H2SchemaInitializer {
-
- private static final String CREATE_TABLE_SQL = "/create_table.sql";
-
- private final Jdbi jdbi;
-
- /**
- * Creates an instance and sets the data source.
- *
- * @param dataSource The data source we need to use for the test.
- */
- public H2SchemaInitializer(final DataSource dataSource) {
- this.jdbi = H2DataSourceProvider.jdbi(dataSource);
- }
-
- /**
- * Executes the schema initialization script.
- */
- public void initialize() {
- try {
- this.jdbi.open().createScript(readCreateScript()).execute();
- } catch (final JdbiException ex) {
- throw new StrongbackException("Couldn't create schema.", ex);
- }
- }
-
- /**
- * Returns the content of the create schema script.
- *
- * @return create script
- */
- @SuppressWarnings("LocalCanBeFinal")
- protected String readCreateScript() {
- try (InputStream stream = createSchemaResourceAsStream();
- InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);
- BufferedReader bufferedReader = new BufferedReader(reader)) {
- return bufferedReader.lines()
- .collect(Collectors.joining(System.lineSeparator()));
- } catch (final Exception e) {
- throw new StrongbackException("Create script cannot be loaded.", e);
- }
- }
-
- /**
- * Returns the stream of the create schema script.
- *
- * @return create script
- * @throws StrongbackException when the script cannot be found.
- */
- protected InputStream createSchemaResourceAsStream() throws StrongbackException {
- return Optional.ofNullable(nullableCreateSchemaResourceAsStream())
- .orElseThrow(() -> new StrongbackException("Resource was not found."));
- }
-
- /**
- * Returns the stream of the create schema script.
- *
- * @return create script (or null if it cannot be read).
- */
- protected InputStream nullableCreateSchemaResourceAsStream() {
- return H2SchemaInitializer.class.getResourceAsStream(CREATE_TABLE_SQL);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerConstants.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerConstants.java
deleted file mode 100644
index 43bc898d..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerConstants.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-/**
- * Defines the H2 database specific default values and constants.
- */
-public final class H2ServerConstants {
- /**
- * Default H2 username for JDBC.
- */
- public static final String DEFAULT_H2_JDBC_USER_NAME = "sa";
- /**
- * Default H2 password for JDBC.
- */
- public static final String DEFAULT_H2_JDBC_PASSWORD = "";
- /**
- * Default H2 TCP password.
- */
- public static final String DEFAULT_H2_TCP_PASSWORD = "4b0RtM1$$ioN";
- /**
- * Default H2 TCP port.
- */
- public static final int DEFAULT_H2_PORT = 29542;
- /**
- * Default H2 host name used in the URL.
- */
- public static final String DEFAULT_H2_HOST = "localhost";
- /**
- * The String format used for the TCP server creation.
- */
- public static final String DEFAULT_TCP_URL_FORMAT = "tcp://" + DEFAULT_H2_HOST + ":%d";
- /**
- * The String format used for the creation of the in-memory DB.
- */
- public static final String IN_MEMORY_DB_FORMAT = "/mem:abortMission-%d;DB_CLOSE_DELAY=-1";
- /**
- * The String format used for JDBC connections.
- */
- public static final String DEFAULT_H2_JDBC_CONNECTION_URL_FORMAT = "jdbc:h2:" + DEFAULT_TCP_URL_FORMAT + IN_MEMORY_DB_FORMAT;
-
- private H2ServerConstants() {
- //util class
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerManager.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerManager.java
deleted file mode 100644
index e57257b5..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/server/H2ServerManager.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackConfigurationHelper;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.h2.tools.Server;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2ServerConstants.*;
-
-/**
- * Manages the lifecycle of the H2 server we will use.
- */
-public class H2ServerManager {
-
- private final String password;
- private final int port;
- private final boolean startStopNeeded;
-
- /**
- * Creates the instance using the values provided as system properties.
- */
- public H2ServerManager() {
- this(StrongbackConfigurationHelper.optionalServerPassword().orElse(DEFAULT_H2_TCP_PASSWORD),
- StrongbackConfigurationHelper.optionalPortValue().orElse(DEFAULT_H2_PORT),
- !StrongbackConfigurationHelper.useExternalServer());
- }
-
- /**
- * Creates the instance using the explicitly provided values.
- *
- * @param password The TCP password used for the server connection.
- * @param port The TCP port we need to use.
- * @param startStopNeeded The feature flag telling us whether we need to start/stop the DB at all.
- */
- public H2ServerManager(final String password, final int port, final boolean startStopNeeded) {
- this.password = password;
- this.port = port;
- this.startStopNeeded = startStopNeeded;
- }
-
- /**
- * Starts the server if needed.
- */
- public void startServer() {
- if (startStopNeeded) {
- doStart();
- }
- }
-
- /**
- * Stops the server if needed.
- */
- public void stopServer() {
- if (startStopNeeded) {
- doStop();
- }
- }
-
- /**
- * Stops the server and ignores all exceptions.
- */
- public void stopServerQuietly() {
- try {
- stopServer();
- } catch (final Exception ignored) {
- //ignore
- }
- }
-
- private void doStart() {
- try {
- Server.createTcpServer("-ifNotExists", "-tcpPassword", password, "-tcpPort", String.valueOf(port))
- .start();
- } catch (final Exception ex) {
- throw new StrongbackException("Server startup failed.", ex);
- }
- }
-
- private void doStop() {
- try {
- sendShutdownCommand();
- Server.shutdownTcpServer(String.format(DEFAULT_TCP_URL_FORMAT, port), password, true, false);
- } catch (final Exception ex) {
- throw new StrongbackException("Server failed to stop.", ex);
- }
- }
-
- @SuppressWarnings("LocalCanBeFinal")
- private void sendShutdownCommand() throws SQLException {
- try (Connection connection = H2DataSourceProvider.createDefaultDataSource(port).getConnection()) {
- connection.createStatement().executeUpdate("SHUTDOWN");
- }
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollector.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollector.java
deleted file mode 100644
index 8a8e811b..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollector.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.healthcheck.impl.DefaultStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.base.ExternalStageStatisticsCollector;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider;
-import org.jdbi.v3.core.Jdbi;
-
-import javax.sql.DataSource;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * H2 DB backed implementation of {@link com.github.nagyesta.abortmission.core.healthcheck.impl.StageStatisticsCollector}.
- */
-public class H2BackedStageStatisticsCollector extends ExternalStageStatisticsCollector {
-
- private static final StageStatisticsSnapshot DEFAULT_SNAPSHOT =
- new DefaultStageStatisticsSnapshot(0, 0, 0, 0);
-
- private final Jdbi jdbi;
-
- /**
- * Simple constructor only setting the matcher.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param dataSource The dataSource used for obtaining the DB connection.
- * @param countdown True if the collector will be used for countdown.
- */
- public H2BackedStageStatisticsCollector(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final DataSource dataSource,
- final boolean countdown) {
- super(contextName, matcher, countdown);
- this.jdbi = H2DataSourceProvider.jdbi(dataSource);
- }
-
- @Override
- protected StageStatisticsSnapshot doGetSnapshot(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- return Optional.ofNullable(jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.getSnapshot(contextName, matcher.getName(), countdown)))
- .orElse(DEFAULT_SNAPSHOT);
- }
-
- @Override
- protected List doFetchAll(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- return jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.fetchMeasurementsFor(contextName, matcher.getName(), countdown));
- }
-
- @Override
- protected void doLogTimeMeasurement(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown,
- final StageTimeMeasurement measurement) {
- jdbi.withExtension(LaunchStatisticsRepository.class, dao -> {
- dao.insertStageTimeMeasurement(contextName, matcher.getName(), countdown, measurement);
- return 0;
- });
- }
-
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorFactory.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorFactory.java
deleted file mode 100644
index 390273f0..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatistics;
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-
-import javax.sql.DataSource;
-
-/**
- * Factory for creating {@link H2BackedStageStatisticsCollector} instances.
- */
-public final class H2BackedStageStatisticsCollectorFactory implements StageStatisticsCollectorFactory {
-
- private final String contextName;
- private final DataSource dataSource;
-
- /**
- * Creates an instance and sets the contextName and dataSource.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param dataSource The data source for accessing the DB.
- */
- public H2BackedStageStatisticsCollectorFactory(final String contextName, final DataSource dataSource) {
- this.contextName = contextName;
- this.dataSource = dataSource;
- }
-
- @Override
- public StageStatistics newCountdownStatistics(final MissionHealthCheckMatcher matcher) {
- return new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, true);
- }
-
- @Override
- public StageStatistics newMissionStatistics(final MissionHealthCheckMatcher matcher) {
- return new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, false);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSource.java b/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSource.java
deleted file mode 100644
index 1d18526e..00000000
--- a/strongback/strongback-h2-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSource.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.telemetry;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.converter.BaseLaunchTelemetryConverter;
-import com.github.nagyesta.abortmission.core.telemetry.converter.ClassTelemetryConverter;
-import com.github.nagyesta.abortmission.core.telemetry.stats.ClassTelemetry;
-import com.github.nagyesta.abortmission.core.telemetry.stats.LaunchTelemetryDataSource;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider;
-import org.jdbi.v3.core.Jdbi;
-
-import javax.sql.DataSource;
-import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-/**
- * H2 DB backed implementation of {@link LaunchTelemetryDataSource}.
- */
-public class H2BackedLaunchTelemetryDataSource extends BaseLaunchTelemetryConverter implements LaunchTelemetryDataSource {
-
- private final Jdbi jdbi;
-
- /**
- * Creates the {@link LaunchTelemetryDataSource} using the provided JDBC data source.
- *
- * @param dataSource The JDBC data source.
- */
- public H2BackedLaunchTelemetryDataSource(final DataSource dataSource) {
- super(new ClassTelemetryConverter());
- this.jdbi = H2DataSourceProvider.jdbi(dataSource);
- }
-
- @Override
- public SortedMap fetchClassStatistics() {
- final Map> measurementsPerMatcher = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> {
- final List matcherName = dao.fetchAllMatcherNames();
- return matcherName.stream()
- .collect(Collectors.toMap(Function.identity(), dao::fetchAllMeasurementsForMatcher));
- });
- return processFetchedRecords(measurementsPerMatcher);
- }
-
- private SortedMap processFetchedRecords(
- final Map> measurementsPerMatcher) {
- final Map>> matchersByClassAndMethod = new TreeMap<>();
- final Map> byTestClassAccumulator = new TreeMap<>();
- measurementsPerMatcher.forEach((matcher, measurements) -> {
- mergeInto(matchersByClassAndMethod,
- measurements.stream().filter(s -> CLASS_ONLY.equals(s.getTestCaseId())),
- measurements.stream().filter(s -> !CLASS_ONLY.equals(s.getTestCaseId())),
- matcher);
- mergeInto(byTestClassAccumulator,
- measurements.stream().filter(s -> CLASS_ONLY.equals(s.getTestCaseId())),
- measurements.stream().filter(s -> !CLASS_ONLY.equals(s.getTestCaseId())));
- });
- return repartitionByClasses(matchersByClassAndMethod, byTestClassAccumulator);
- }
-
-}
diff --git a/strongback/strongback-h2-supplier/src/main/resources/create_table.sql b/strongback/strongback-h2-supplier/src/main/resources/create_table.sql
deleted file mode 100644
index e0dc7a35..00000000
--- a/strongback/strongback-h2-supplier/src/main/resources/create_table.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-create table LAUNCH_STATISTICS
-(
- CONTEXT_NAME VARCHAR2(256) not null,
- MATCHER_NAME VARCHAR2(2048) not null,
- LAUNCH_ID UUID not null,
- TEST_CLASS VARCHAR2(1024) not null,
- TEST_METHOD VARCHAR2(1024) not null,
- COUNTDOWN boolean not null,
- TEST_RESULT smallint not null,
- START_MILLIS bigint not null,
- END_MILLIS bigint not null,
- DISPLAY_NAME VARCHAR2(1024) not null,
- THREAD_NAME VARCHAR2(256) not null,
- THROWABLE_TYPE VARCHAR2(1024),
- THROWABLE_MESSAGE VARCHAR2(1024),
- THROWABLE_STACK_TRACE TEXT
-);
-
-alter table LAUNCH_STATISTICS
- add constraint LAUNCH_STATISTICS_PK
- primary key (CONTEXT_NAME, MATCHER_NAME, LAUNCH_ID, TEST_CLASS, TEST_METHOD);
-
-create index LAUNCH_STATISTICS_MATCHER_NAME_INDEX
- on LAUNCH_STATISTICS (CONTEXT_NAME, MATCHER_NAME, COUNTDOWN);
-
-create index LAUNCH_STATISTICS_MATCHER_NAME_AND_TEST_RESULT_INDEX
- on LAUNCH_STATISTICS (CONTEXT_NAME, MATCHER_NAME, COUNTDOWN, TEST_RESULT);
diff --git a/strongback/strongback-h2-supplier/src/main/resources/strongback-blueprint.xml b/strongback/strongback-h2-supplier/src/main/resources/strongback-blueprint.xml
deleted file mode 100644
index 73c350dc..00000000
--- a/strongback/strongback-h2-supplier/src/main/resources/strongback-blueprint.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/H2BackedStaticFireBoosterTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/H2BackedStaticFireBoosterTest.java
deleted file mode 100644
index 679ab0a0..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/H2BackedStaticFireBoosterTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.core.MissionControl;
-import com.github.nagyesta.abortmission.strongback.h2.H2StrongbackController;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2ServerManager;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.platform.testkit.engine.EngineTestKit;
-
-import javax.sql.DataSource;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;
-
-public class H2BackedStaticFireBoosterTest {
-
- static final int PORT_NUMBER = 29944;
- private static final String PASSWORD = "abort-mission";
- private static H2StrongbackController strongbackController;
-
- @BeforeAll
- static void beforeAll() {
- final H2ServerManager serverManager = new H2ServerManager(PASSWORD, PORT_NUMBER, true);
- final DataSource dataSource = H2DataSourceProvider.createDefaultDataSource(PORT_NUMBER);
- strongbackController = new H2StrongbackController(serverManager, dataSource);
- strongbackController.erect();
- }
-
- @AfterAll
- static void afterAll() {
- strongbackController.retract();
- }
-
- @Test
- @Tag("integration")
- @SuppressWarnings("checkstyle:MagicNumber")
- public void testAssumption() throws NoSuchMethodException {
- EngineTestKit
- .engine("junit-jupiter")
- .selectors(selectClass(StaticFireTestCenterCoreOnly.class),
- selectClass(StaticFireTestWithSideBoosters.class),
- selectClass(StaticFireTestWithSideBoostersPerClass.class))
- .execute()
- .testEvents()
- .assertStatistics(stats -> stats
- .skipped(DISABLED_CASES)
- .started(TOTAL_CASES)
- .succeeded(SUCCESSFUL_CASES)
- .aborted(ABORTED_CASES)
- .failed(FAILED_CASES));
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestWithSideBoosters.class)
- .forEach(evaluator -> {
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestWithSideBoostersPerClass.class)
- .forEach(evaluator -> {
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS_PER_CLASS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS_PER_CLASS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestCenterCoreOnly.class.getDeclaredMethod("testIsOnFire"))
- .forEach(evaluator -> {
- assertEquals(CENTER_CORE_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(CENTER_CORE_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- }
-
- @Test
- @Tag("integration")
- @SuppressWarnings("checkstyle:MagicNumber")
- public void testParallelAssumption() {
- EngineTestKit
- .engine("junit-jupiter")
- .selectors(selectClass(ParallelStaticFireTestWithSideBoostersPerClassTest.class),
- selectClass(ParallelStaticFireTestWithSideBoostersTest.class))
- .configurationParameter("junit.jupiter.execution.parallel.enabled", "true")
- .configurationParameter("junit.jupiter.execution.parallel.mode.default", "concurrent")
- .configurationParameter("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
- .configurationParameter("junit.jupiter.execution.parallel.config.strategy", "fixed")
- .configurationParameter("junit.jupiter.execution.parallel.config.fixed.parallelism", "4")
- .execute()
- .testEvents()
- .assertStatistics(stats -> stats
- .skipped(0)
- .started(SUCCESSFUL_PARALLEL_CASES)
- .succeeded(SUCCESSFUL_PARALLEL_CASES)
- .aborted(0)
- .failed(0));
- MissionControl.matchingHealthChecks(PARALLEL, StaticFireTestWithSideBoosters.class)
- .forEach(evaluator -> {
- assertEquals(PARALLEL_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(PARALLEL_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- assertTrue(ParallelStaticFireTestWithSideBoostersTest.THREADS_USED.size() > 1);
- }
-
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/MissionOutlineDefinition.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/MissionOutlineDefinition.java
deleted file mode 100644
index aa82b529..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/MissionOutlineDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor;
-import com.github.nagyesta.abortmission.core.AbortMissionCommandOps;
-import com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor;
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.outline.MissionOutline;
-import com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider;
-import com.github.nagyesta.abortmission.strongback.h2.stats.H2BackedStageStatisticsCollectorFactory;
-
-import javax.sql.DataSource;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
-
-import static com.github.nagyesta.abortmission.core.MissionControl.*;
-import static com.github.nagyesta.abortmission.strongback.h2.jupiter.H2BackedStaticFireBoosterTest.PORT_NUMBER;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-
-public class MissionOutlineDefinition extends MissionOutline {
-
- @Override
- @SuppressWarnings("checkstyle:MagicNumber")
- protected Map> defineOutline() {
- final DependencyNameExtractor extractor = new TagDependencyNameExtractor();
- final DataSource dataSource = H2DataSourceProvider.createDefaultDataSource(PORT_NUMBER);
- final Map> plan = new HashMap<>();
- plan.put(STATIC_FIRE, ops -> {
- final StageStatisticsCollectorFactory factory = getCollectorFactory(STATIC_FIRE, dataSource);
- final MissionHealthCheckMatcher sideBoosterMatcher = matcher()
- .dependencyWith(SIDE_BOOSTER)
- .extractor(extractor).build();
- final MissionHealthCheckMatcher centerCoreMatcher = matcher()
- .dependencyWith(CENTER_CORE)
- .extractor(extractor).build();
- ops.registerHealthCheck(
- percentageBasedEvaluator(sideBoosterMatcher, factory)
- .abortThreshold(10)
- .burnInTestCount(2).build());
- ops.registerHealthCheck(
- percentageBasedEvaluator(centerCoreMatcher, factory)
- .build());
- });
- plan.put(PARALLEL, ops -> {
- final StageStatisticsCollectorFactory factory = getCollectorFactory(PARALLEL, dataSource);
- final MissionHealthCheckMatcher anyClassMatcher = matcher().anyClass().build();
- ops.registerHealthCheck(
- reportOnlyEvaluator(anyClassMatcher, factory)
- .build());
- });
- return plan;
- }
-
- private StageStatisticsCollectorFactory getCollectorFactory(final String contextName, final DataSource dataSource) {
- return new H2BackedStageStatisticsCollectorFactory(contextName, dataSource);
- }
-
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java
deleted file mode 100644
index bfed91e9..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.Random;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PARALLEL;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PER_CLASS;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(PARALLEL)
-@SpringBootTest(classes = StaticFire.class)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@Tag(PER_CLASS)
-public class ParallelStaticFireTestWithSideBoostersPerClassTest {
-
- private static final Random RANDOM = new Random();
- private static final Logger LOGGER = LoggerFactory.getLogger(ParallelStaticFireTestWithSideBoostersPerClassTest.class);
-
- @Autowired
- private Booster centerCore;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestParallelInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire0(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire1(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire2(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire3(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- private void executeTest(final int wait) throws InterruptedException {
- //given
- LOGGER.info("Running test with max wait: " + wait);
- Thread.sleep(RANDOM.nextInt(wait));
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersTest.java
deleted file mode 100644
index 23a3e5a0..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/ParallelStaticFireTestWithSideBoostersTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.Random;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PARALLEL;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.SIDE_BOOSTER;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(PARALLEL)
-@SpringBootTest(classes = StaticFire.class)
-@Tag(SIDE_BOOSTER)
-public class ParallelStaticFireTestWithSideBoostersTest {
-
- static final CopyOnWriteArraySet THREADS_USED = new CopyOnWriteArraySet<>();
- private static final Random RANDOM = new Random();
- private static final Logger LOGGER = LoggerFactory.getLogger(ParallelStaticFireTestWithSideBoostersTest.class);
-
- @Autowired
- private Booster centerCore;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestParallelInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire0(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire1(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire2(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire3(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- private void executeTest(final int wait) throws InterruptedException {
- //given
- THREADS_USED.add(Thread.currentThread().getName());
- LOGGER.info("Running test with max wait: " + wait);
- Thread.sleep(RANDOM.nextInt(wait));
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestCenterCoreOnly.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestCenterCoreOnly.java
deleted file mode 100644
index c63ca582..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestCenterCoreOnly.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.core.annotation.LaunchSequence;
-import com.github.nagyesta.abortmission.core.annotation.SuppressAbortDecisions;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Tags;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@SuppressAbortDecisions
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@LaunchSequence(MissionOutlineDefinition.class)
-public class StaticFireTestCenterCoreOnly {
-
- @Autowired
- private Booster centerCore;
-
- @Test
- @Tags({@Tag(BOOSTER), @Tag(CENTER_CORE)})
- public void testIsOnFire() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-
- @Test
- public void testIsOnFireNotMatchingRules() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoosters.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoosters.java
deleted file mode 100644
index 7c7968e3..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoosters.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.core.annotation.SuppressAbortDecisions;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@Tag(SIDE_BOOSTER)
-public class StaticFireTestWithSideBoosters {
-
- @Autowired
- private Booster centerCore;
- @Autowired
- private Booster sideBooster;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire(final int ignore) {
- //given
-
- //when
- final boolean actual = sideBooster.isOnFire();
-
- //then
- assertTrue(actual);
- }
-
- @Test
- @SuppressAbortDecisions
- @Tag(BOOSTER)
- @Tag(CENTER_CORE)
- public void testIsOnFireNoAbort() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoostersPerClass.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoostersPerClass.java
deleted file mode 100644
index b46b42ee..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/jupiter/StaticFireTestWithSideBoostersPerClass.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PER_CLASS;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.STATIC_FIRE;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@Tag(PER_CLASS)
-public class StaticFireTestWithSideBoostersPerClass {
-
- @Autowired
- private Booster sideBooster;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire(final int ignore) {
- //given
-
- //when
- final boolean actual = sideBooster.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepositoryIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepositoryIntegrationTest.java
deleted file mode 100644
index 79265eb3..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/repository/LaunchStatisticsRepositoryIntegrationTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.repository;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.h2.server.AbstractInMemoryDataSourceIntegrationTest;
-import org.jdbi.v3.core.extension.ExtensionCallback;
-import org.jdbi.v3.core.statement.UnableToExecuteStatementException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.junit.jupiter.params.provider.NullAndEmptySource;
-import org.junit.jupiter.params.provider.ValueSource;
-
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-public class LaunchStatisticsRepositoryIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- private static final String CONTEXT_NAME = "repo";
-
- LaunchStatisticsRepositoryIntegrationTest() {
- super(CONTEXT_NAME, "jdbc:h2:mem:~/repoTest");
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream noCollisionInsertDataProvider() {
- return Stream.builder()
- .add(Arguments.of(mapFromStream(IntStream.of(0).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(1, 3, 42).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.rangeClosed(0, 30).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(1, 3).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.rangeClosed(2, 5).boxed())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testInsertStageTimeMeasurementShouldInsertUniqueRecordsWhenCalledWithoutCollision(
- final Map> input) {
- //given
-
- //when
- jdbi.withExtension(LaunchStatisticsRepository.class, insertAllCallback(input));
-
- //then
- final TreeSet actual = jdbi.open()
- .createQuery("SELECT LAUNCH_ID FROM LAUNCH_STATISTICS")
- .mapTo(UUID.class)
- .stream()
- .collect(Collectors.toCollection(TreeSet::new));
- final TreeSet expected = input.values().stream()
- .flatMap(Collection::stream)
- .map(StageTimeMeasurement::getLaunchId)
- .collect(Collectors.toCollection(TreeSet::new));
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @Test
- void testInsertStageTimeMeasurementShouldThrowExceptionWhenCollisionFound() {
- //given
- final StageTimeMeasurement measurement = generateMeasurement(1);
- jdbi.withExtension(LaunchStatisticsRepository.class, insertSingleMeasurementCallback(MATCHER_PREFIX, measurement));
-
- //when
- Assertions.assertThrows(UnableToExecuteStatementException.class,
- () -> jdbi.withExtension(LaunchStatisticsRepository.class,
- insertSingleMeasurementCallback(MATCHER_PREFIX, measurement)));
-
- //then exception
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchMeasurementsForMatcherShouldFilterTheInsertedMeasurementsWhenCalledWithValidInput(
- final Map> input) {
- //given
- final String matcherName = findMatcherName(input);
- jdbi.withExtension(LaunchStatisticsRepository.class, insertAllCallback(input));
-
- //when
- final List actual = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.fetchMeasurementsFor(CONTEXT_NAME, matcherName, false));
-
- //then
- final List expected = input.get(matcherName)
- .stream()
- .filter(s -> !s.getTestCaseId().equals(CLASS_ONLY))
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @ParameterizedTest
- @NullAndEmptySource
- @ValueSource(strings = {METHOD_PREFIX, CLASS_NAME, MATCHER_PREFIX})
- void testFetchMeasurementsForMatcherShouldReturnNoMeasurementsWhenCalledWithUnknownMatcher(
- final String lookup) {
- //given
- final StageTimeMeasurement measurement = generateMeasurement(1);
- jdbi.withExtension(LaunchStatisticsRepository.class, insertSingleMeasurementCallback(MATCHER_PREFIX + 1, measurement));
-
- //when
- final List actual = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.fetchMeasurementsFor(CONTEXT_NAME, lookup, false));
-
- //then
- Assertions.assertNotNull(actual);
- Assertions.assertIterableEquals(Collections.emptyList(), actual);
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchAllMatcherNamesShouldReturnADistinctListOfTheInsertedMatcherNamesWhenCalled(
- final Map> input) {
- //given
- jdbi.withExtension(LaunchStatisticsRepository.class, insertAllCallback(input));
-
- //when
- final List actual = jdbi.withExtension(LaunchStatisticsRepository.class,
- LaunchStatisticsRepository::fetchAllMatcherNames);
-
- //then
- final List expected = input.keySet()
- .stream()
- .distinct()
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testGetSnapshotOfAMatcherShouldReturnTheAggregatedStatusCountsWhenCalled(
- final Map> input) {
- //given
- final String matcherName = findMatcherName(input);
- jdbi.withExtension(LaunchStatisticsRepository.class, insertAllCallback(input));
-
- //when
- final StageStatisticsSnapshot actualCountdown = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.getSnapshot(CONTEXT_NAME, matcherName, true));
- final StageStatisticsSnapshot actualMission = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.getSnapshot(CONTEXT_NAME, matcherName, false));
-
- //then
- assertSnapshotCountersMatch(input.get(matcherName), actualCountdown, actualMission);
- }
-
- private String findMatcherName(final Map> input) {
- return input.keySet().stream()
- .max(Comparator.naturalOrder())
- .orElseThrow(IllegalStateException::new);
- }
-
- private ExtensionCallback insertSingleMeasurementCallback(
- final String matcherName, final StageTimeMeasurement measurement) {
- return dao -> {
- dao.insertStageTimeMeasurement(CONTEXT_NAME, matcherName, false, measurement);
- return null;
- };
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/AbstractInMemoryDataSourceIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/AbstractInMemoryDataSourceIntegrationTest.java
deleted file mode 100644
index 6c65c2e0..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/AbstractInMemoryDataSourceIntegrationTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import org.h2.jdbcx.JdbcDataSource;
-import org.jdbi.v3.core.Handle;
-import org.jdbi.v3.core.Jdbi;
-import org.jdbi.v3.core.extension.ExtensionCallback;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-
-import javax.sql.DataSource;
-import java.sql.SQLException;
-import java.util.*;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@SuppressWarnings({"checkstyle:JavadocVariable", "checkstyle:VisibilityModifier", "checkstyle:DesignForExtension"})
-public class AbstractInMemoryDataSourceIntegrationTest {
-
- protected static final String MATCHER_PREFIX = "matcher-";
- protected static final String METHOD_PREFIX = "methodName";
- protected static final String CLASS_NAME = "com.github.nagyesta.abortmission."
- + "strongback.h2.repository.AbstractInMemoryDataSourceIntegrationTest";
- private static final String DISPLAY_NAME_PREFIX = "DN_";
- private static final String EXCEPTION_MESSAGE = "This is a test exception.";
-
- protected final String contextName;
- private final String url;
- protected Jdbi jdbi;
- protected DataSource dataSource;
-
- protected AbstractInMemoryDataSourceIntegrationTest(final String contextName, final String url) {
- this.contextName = contextName;
- this.url = url + ";DB_CLOSE_DELAY=-1";
- }
-
- protected static Map> mapFromStream(final Stream stream) {
- return stream.collect(Collectors.toMap(
- i -> MATCHER_PREFIX + i,
- i -> Collections.singletonList(generateMeasurement(i))));
- }
-
- protected static Map> mapFromMultiStream(final Stream stream) {
- return stream.collect(Collectors.toMap(
- i -> MATCHER_PREFIX + i,
- i -> IntStream.rangeClosed(0, i).boxed()
- .map(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())));
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- protected static StageTimeMeasurement generateMeasurement(final Integer i) {
- final String testCaseId = Optional.of(i % 3)
- .filter(n -> n != 0)
- .map(n -> METHOD_PREFIX + n)
- .orElse(CLASS_ONLY);
- final StageResult stageResult = StageResult.values()[i % StageResult.values().length];
- final Optional throwable = Optional.of(stageResult)
- .filter(r -> StageResult.FAILURE == r || StageResult.SUPPRESSED == r)
- .map(n -> new RuntimeException(EXCEPTION_MESSAGE).fillInStackTrace());
- return StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.randomUUID())
- .setTestClassId(CLASS_NAME)
- .setTestCaseId(testCaseId)
- .setDisplayName(DISPLAY_NAME_PREFIX + testCaseId)
- .setStart(i)
- .setEnd(i + i)
- .setThreadName(Thread.currentThread().getName())
- .setThrowableClass(throwable.map(Throwable::getClass).map(Class::getName).orElse(null))
- .setThrowableMessage(throwable.map(Throwable::getMessage).orElse(null))
- .setStackTrace(throwable.map(Throwable::getStackTrace)
- .map(s -> Arrays.stream(s).map(StackTraceElement::toString).collect(Collectors.toList()))
- .orElse(null))
- .setResult(stageResult)
- .build();
- }
-
- protected void assertSnapshotCountersMatch(final List expected,
- final StageStatisticsSnapshot actualCountdown,
- final StageStatisticsSnapshot actualMission) {
- final Map expectedCountdown = filterAndCount(expected, s -> s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedCountdown, actualCountdown);
-
- final Map expectedMission = filterAndCount(expected, s -> !s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedMission, actualMission);
- }
-
- private Map filterAndCount(final List expected,
- final Predicate predicate) {
- return expected
- .stream()
- .filter(predicate)
- .collect(Collectors.groupingBy(StageTimeMeasurement::getResult))
- .entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
- }
-
- private void assertResultsMatch(final Map expected, final StageStatisticsSnapshot actual) {
- Assertions.assertEquals(expected.getOrDefault(StageResult.FAILURE, 0), actual.getFailed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.ABORT, 0), actual.getAborted());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUPPRESSED, 0), actual.getSuppressed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUCCESS, 0), actual.getSucceeded());
- }
-
- protected ExtensionCallback insertAllCallback(
- final Map> input) {
- return dao -> {
- input.forEach((matcherName, measurementList) -> {
- measurementList.forEach(measurement -> {
- final boolean isCountdown = CLASS_ONLY.equals(measurement.getTestCaseId());
- dao.insertStageTimeMeasurement(contextName, matcherName, isCountdown, measurement);
- });
- });
- return null;
- };
- }
-
- @BeforeEach
- void setUp() {
- final JdbcDataSource jdbcDataSource = new JdbcDataSource();
- jdbcDataSource.setURL(url);
- this.dataSource = jdbcDataSource;
- jdbi = H2DataSourceProvider.jdbi(dataSource);
- //noinspection LocalCanBeFinal
- try (Handle handle = jdbi.open()) {
- handle.createUpdate("DROP ALL OBJECTS").execute();
- }
- new H2SchemaInitializer(dataSource).initialize();
- }
-
- @AfterEach
- void tearDown() throws SQLException {
- //noinspection LocalCanBeFinal
- try (Handle handle = jdbi.open()) {
- handle.createUpdate("DROP ALL OBJECTS").execute();
- }
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/DataSourceIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/DataSourceIntegrationTest.java
deleted file mode 100644
index c32558a8..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/DataSourceIntegrationTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider.createDefaultDataSource;
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2ServerConstants.DEFAULT_H2_JDBC_USER_NAME;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-class DataSourceIntegrationTest {
-
- private final H2ServerManager h2ServerManager = new H2ServerManager();
-
- @Test
- @SuppressWarnings("LocalCanBeFinal")
- void testCreateDefaultDataSourceShouldConnectToTheTcpServerWhenCalled() {
- try {
- //given
- h2ServerManager.startServer();
-
- //when
- final DataSource dataSource = createDefaultDataSource();
- try (Connection connection = dataSource.getConnection()) {
-
- //then no exception
- final DatabaseMetaData metaData = connection.getMetaData();
- Assertions.assertEquals(DEFAULT_H2_JDBC_USER_NAME.toUpperCase(), metaData.getUserName().toUpperCase());
- } catch (SQLException ex) {
- Assertions.fail("Connection should have succeeded.", ex);
- }
- } finally {
- h2ServerManager.stopServerQuietly();
- }
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializerTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializerTest.java
deleted file mode 100644
index b9920bb1..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/H2SchemaInitializerTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-
-import javax.sql.DataSource;
-
-import static org.mockito.Mockito.*;
-
-@Tag("unit")
-class H2SchemaInitializerTest {
-
- @Test
- void testReadCreateScriptShouldThrowExceptionWhenResourceNotFound() {
- //given
- final DataSource dataSource = mock(DataSource.class);
- final H2SchemaInitializer underTest = spy(new H2SchemaInitializer(dataSource));
- doAnswer(a -> H2SchemaInitializerTest.class.getResourceAsStream("/resource-which-is-not-found"))
- .when(underTest).nullableCreateSchemaResourceAsStream();
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::readCreateScript);
-
- //then + exception
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerInitializerIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerInitializerIntegrationTest.java
deleted file mode 100644
index c9077a95..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerInitializerIntegrationTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import org.jdbi.v3.core.JdbiException;
-import org.junit.jupiter.api.*;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-
-import javax.sql.DataSource;
-import java.util.List;
-
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider.createDefaultDataSource;
-import static com.github.nagyesta.abortmission.strongback.h2.server.H2DataSourceProvider.jdbi;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-class ServerInitializerIntegrationTest {
-
- private static final int PORT = 32342;
- private static final String PASS = "pass";
- private final H2ServerManager h2ServerManager = new H2ServerManager(PASS, PORT, true);
-
- @BeforeEach
- void setUp() {
-
- }
-
- @AfterEach
- void tearDown() {
- h2ServerManager.stopServerQuietly();
- }
-
- @Test
- void testInitializeShouldCreateTheTableWhenCalledOnce() {
- try {
- //given
- h2ServerManager.startServer();
- final DataSource dataSource = createDefaultDataSource(PORT);
- final H2SchemaInitializer underTest = new H2SchemaInitializer(dataSource);
- Assertions.assertFalse(tableExists(dataSource));
-
- //when
- Assertions.assertDoesNotThrow(underTest::initialize);
-
- //then exception
- Assertions.assertTrue(tableExists(dataSource));
- } finally {
- h2ServerManager.stopServerQuietly();
- }
- }
-
- @Test
- void testInitializeShouldThrowExceptionWhenCalledTwice() {
- try {
- //given
- h2ServerManager.startServer();
- final DataSource dataSource = createDefaultDataSource(PORT);
- final H2SchemaInitializer underTest = new H2SchemaInitializer(dataSource);
- Assertions.assertDoesNotThrow(underTest::initialize);
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::initialize);
-
- //then exception
- } finally {
- h2ServerManager.stopServerQuietly();
- }
- }
-
- private boolean tableExists(final DataSource dataSource) {
- try {
- final List list = jdbi(dataSource).withExtension(LaunchStatisticsRepository.class,
- LaunchStatisticsRepository::fetchAllMatcherNames);
- return list.isEmpty();
- } catch (final JdbiException e) {
- return false;
- }
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerLifecycleIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerLifecycleIntegrationTest.java
deleted file mode 100644
index c482e6b7..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/server/ServerLifecycleIntegrationTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-class ServerLifecycleIntegrationTest {
-
- private static final int PORT_1 = 32343;
- private static final int PORT_2 = 32344;
- private static final int PORT_3 = 32345;
- private static final int PORT_4 = 32346;
- private static final String PASS = "password";
-
- @Test
- void testStartingServerShouldThrowExceptionWhenCalledTwice() {
- //given
- final H2ServerManager underTest = new H2ServerManager(PASS, PORT_1, true);
- try {
-
- Assertions.assertDoesNotThrow(underTest::startServer);
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::startServer);
-
- //then exception
- } finally {
- underTest.stopServerQuietly();
- }
- }
-
- @Test
- void testStartingServerShouldDoNothingsWhenCalledForExternalServerMode() {
- //given
- final H2ServerManager running = new H2ServerManager(PASS, PORT_2, true);
- final H2ServerManager underTest = new H2ServerManager(PASS, PORT_2, false);
- try {
- Assertions.assertDoesNotThrow(running::startServer);
-
- //when
- Assertions.assertDoesNotThrow(underTest::startServer);
-
- //then no exception, server still running
- Assertions.assertDoesNotThrow(running::stopServer);
- } finally {
- running.stopServerQuietly();
- }
- }
-
- @Test
- void testStoppingServerShouldThrowExceptionWhenCalledWhileStopped() {
- //given
- final H2ServerManager underTest = new H2ServerManager(PASS, PORT_3, true);
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::stopServer);
-
- //then exception
- }
-
- @Test
- void testStoppingServerShouldDoNothingsWhenCalledForExternalServerMode() {
- //given
- final H2ServerManager running = new H2ServerManager(PASS, PORT_4, true);
- final H2ServerManager underTest = new H2ServerManager(PASS, PORT_4, false);
- try {
- Assertions.assertDoesNotThrow(running::startServer);
-
- //when
- Assertions.assertDoesNotThrow(underTest::stopServer);
-
- //then no exception, server still running
- Assertions.assertDoesNotThrow(running::stopServer);
- } finally {
- running.stopServerQuietly();
- }
- }
-
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorIntegrationTest.java
deleted file mode 100644
index 8e676da8..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/stats/H2BackedStageStatisticsCollectorIntegrationTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import com.github.nagyesta.abortmission.strongback.h2.server.AbstractInMemoryDataSourceIntegrationTest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-import static org.mockito.Mockito.*;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-class H2BackedStageStatisticsCollectorIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- H2BackedStageStatisticsCollectorIntegrationTest() {
- super("collector", "jdbc:h2:mem:~/collectorTest");
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream measurementProvider() {
- return Stream.builder()
- .add(Arguments.of(Collections.emptyList()))
- .add(Arguments.of(IntStream.rangeClosed(0, 4)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .add(Arguments.of(IntStream.of(42)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .add(Arguments.of(IntStream.of(34, 43, 12, 5)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testLogAndIncrementShouldSaveMeasurementWhenCalledWithValidInput(final List measurements) {
- //given
- final boolean countdown = false;
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final H2BackedStageStatisticsCollector underTest =
- new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, countdown);
-
- //when
- measurements.forEach(underTest::logAndIncrement);
-
- //then
- verify(matcher, atLeast(measurements.size())).getName();
- final List actual = jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.fetchMeasurementsFor(contextName, MATCHER_PREFIX, countdown));
- Collections.sort(actual);
- Collections.sort(measurements);
- Assertions.assertIterableEquals(measurements, actual);
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testGetSnapshotShouldCountAndGroupMeasurementWhenCalled(final List measurements) {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final H2BackedStageStatisticsCollector underTestCountdown =
- new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, true);
- final H2BackedStageStatisticsCollector underTestMission =
- new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, false);
- jdbi.withExtension(LaunchStatisticsRepository.class, dao -> {
- measurements.forEach(m -> {
- final boolean countdown = m.getTestCaseId().equals(CLASS_ONLY);
- dao.insertStageTimeMeasurement(contextName, MATCHER_PREFIX, countdown, m);
- });
- return null;
- });
-
- //when
- final StageStatisticsSnapshot actualCountdown = underTestCountdown.getSnapshot();
- final StageStatisticsSnapshot actualMission = underTestMission.getSnapshot();
-
- //then
- verify(matcher, atLeastOnce()).getName();
- assertSnapshotCountersMatch(measurements, actualCountdown, actualMission);
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testFetchAllShouldReturnAllSavedMeasurementsInTheRightOrderWhenCalled(final List measurements) {
- //given
- final boolean countdown = false;
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final H2BackedStageStatisticsCollector underTest =
- new H2BackedStageStatisticsCollector(contextName, matcher, dataSource, countdown);
- jdbi.withExtension(LaunchStatisticsRepository.class, dao -> {
- measurements.forEach(m -> dao.insertStageTimeMeasurement(contextName, MATCHER_PREFIX, countdown, m));
- return null;
- });
-
- //when
- final List actual = underTest.doFetchAll(contextName, matcher, countdown);
-
- //then
- verify(matcher, atLeastOnce()).getName();
- Assertions.assertIterableEquals(measurements.stream()
- .sorted()
- .collect(Collectors.toList()), actual);
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSourceIntegrationTest.java b/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSourceIntegrationTest.java
deleted file mode 100644
index f9d06008..00000000
--- a/strongback/strongback-h2-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/h2/telemetry/H2BackedLaunchTelemetryDataSourceIntegrationTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.h2.telemetry;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.stats.ClassTelemetry;
-import com.github.nagyesta.abortmission.core.telemetry.stats.StageLaunchStats;
-import com.github.nagyesta.abortmission.core.telemetry.stats.TestRunTelemetry;
-import com.github.nagyesta.abortmission.strongback.h2.repository.LaunchStatisticsRepository;
-import com.github.nagyesta.abortmission.strongback.h2.server.AbstractInMemoryDataSourceIntegrationTest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-class H2BackedLaunchTelemetryDataSourceIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- H2BackedLaunchTelemetryDataSourceIntegrationTest() {
- super("telemetry", "jdbc:h2:mem:~/telemetryTest");
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream noCollisionInsertDataProvider() {
- return Stream.builder()
- .add(Arguments.of(mapFromStream(IntStream.of(0).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(1, 3, 42).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.rangeClosed(0, 30).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(1, 3).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.rangeClosed(2, 5).boxed())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchClassStatisticsShouldFetchStatisticsGroupedByClassWhenCalled(
- final Map> input) {
- //given
- jdbi.withExtension(LaunchStatisticsRepository.class, insertAllCallback(input));
- final H2BackedLaunchTelemetryDataSource underTest = new H2BackedLaunchTelemetryDataSource(dataSource);
-
- //when
- final SortedMap actual = underTest.fetchClassStatistics();
-
- //then
- final Map actualLaunchStatsMap = toLaunches(actual);
- final Set actualMethods = new TreeSet<>(actualLaunchStatsMap.keySet());
- final List allMeasurements = fetchAllMeasurements();
- final List expectedMethods = mapToMethodNames(allMeasurements);
- Assertions.assertIterableEquals(expectedMethods, actualMethods);
-
- expectedMethods.forEach(method -> {
- final StageLaunchStats actualLaunch = actualLaunchStatsMap.get(method);
- final List expectedMeasurements = allMeasurements.stream()
- .filter(s -> s.getTestCaseId().equals(method))
- .map(TestRunTelemetry::new)
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expectedMeasurements, actualLaunch.getTimeMeasurements());
- });
-
- final StageLaunchStats actualCountdown = toCountdown(actual);
- final List expectedCountdowns = allMeasurements.stream()
- .filter(s -> s.getTestCaseId().equals(CLASS_ONLY))
- .map(TestRunTelemetry::new)
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expectedCountdowns, actualCountdown.getTimeMeasurements());
- }
-
- private Map toLaunches(final SortedMap actual) {
- return actual.get(AbstractInMemoryDataSourceIntegrationTest.CLASS_NAME)
- .getLaunches();
- }
-
- private StageLaunchStats toCountdown(final SortedMap actual) {
- return actual.get(AbstractInMemoryDataSourceIntegrationTest.CLASS_NAME)
- .getCountdown();
- }
-
- private List mapToMethodNames(final List allMeasurements) {
- return allMeasurements.stream()
- .map(StageTimeMeasurement::getTestCaseId)
- .filter(s -> !CLASS_ONLY.equals(s))
- .distinct()
- .sorted()
- .collect(Collectors.toList());
- }
-
- private List fetchAllMeasurements() {
- return jdbi.withExtension(LaunchStatisticsRepository.class,
- dao -> dao.fetchAllMatcherNames()
- .stream()
- .map(dao::fetchAllMeasurementsForMatcher)
- .flatMap(Collection::stream)
- .collect(Collectors.toList()));
- }
-}
diff --git a/strongback/strongback-h2-supplier/src/test/resources/.gitkeep b/strongback/strongback-h2-supplier/src/test/resources/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/strongback/strongback-rmi-supplier/README.md b/strongback/strongback-rmi-supplier/README.md
deleted file mode 100644
index 81f560f7..00000000
--- a/strongback/strongback-rmi-supplier/README.md
+++ /dev/null
@@ -1,82 +0,0 @@
-![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)
-
-[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
-[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
-[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
-[![JavaCI](https://img.shields.io/github/actions/workflow/status/nagyesta/abort-mission/gradle.yml?logo=github&branch=main)](https://github.com/nagyesta/abort-mission/actions/workflows/gradle.yml)
-
-# Strongback RMI Supplier
-
-[![codecov strongback](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20RMI&flag=rmi&token=I832ZCIONI)](https://img.shields.io/codecov/c/github/nagyesta/abort-mission?label=Coverage:%20Strongback%20RMI&flag=rmi&token=I832ZCIONI)
-![[Stable](https://img.shields.io/badge/Maturity-stable-green)](https://img.shields.io/badge/Maturity-stable-green)
-
-Please find the essentials below or check out [the wiki](https://github.com/nagyesta/abort-mission/wiki) for more details.
-
-This component aims to allow Abort-Mission use even in case you are using JVM forks. Please note, that it might be suboptimal to rely on
-this Strongback in case you are not using JVM forks. This is due to the performance hit taken
-(~1-2 ms per remote call on a laptop).
-
-# Quick-start
-
-## Dependency
-
-Abort-Mission can be downloaded from a few Maven repositories. Please head to
-[this page](https://github.com/nagyesta/abort-mission/wiki/Configuring-our-repository-for-your-build-system)
-to find out more.
-
-### Maven
-
-```xml
-
- com.github.nagyesta.abort-mission.strongback
- abort.strongback-rmi-supplier
- RELEASE
- test
-
-```
-
-### Gradle
-
-```groovy
-testImplementation "com.github.nagyesta.abort-mission.strongback:abort.strongback-rmi-supplier:+"
-```
-
-## Integration
-
-Integrating the RMI supplier Strongback is a simple addition once Abort-Mission integration is already done.
-
-### Strongback lifecycle
-
-#### Gradle
-
-The Abort-Mission Gradle plugin is capable of providing the standard configuration for the lifecycle of the Strongback before and after the
-tests. In order to start actually utilizing it, please complete the **Test integration** configuration steps below.
-
-#### Maven
-
-There is no Strongback support in case of the Maven plugin at the moment. The recommended option is to use one of the plugins available for
-Java execution and take care of erecting and retracting the Strongback as defined [here](../strongback-base/README.md).
-
-## Test integration
-
-You need to use an instance of the RMI specific statistics collector,
-[RmiBackedStageStatisticsCollectorFactory](./src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorFactory.java)
-, in order to send over and store the measurement data in the remote JVM started by the RMI Strongback. This will require an RMI Registry as
-well. You can
-use [RmiServiceProvider#lookupRegistry(int)](./src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProvider.java)
-to obtain one.
-
-```java
-final StageStatisticsCollectorFactory factory =
- new RmiBackedStageStatisticsCollectorFactory(
- "contextName",RmiServiceProvider.lookupRegistry(29542));
-
-PercentageBasedMissionHealthCheckEvaluator evaluator = percentageBasedEvaluator(matcher,factory)
- .abortThreshold(ABORT_THRESHOLD).build();
-ReportOnlyMissionHealthCheckEvaluator noop = reportOnlyEvaluator(matcher,factory)
- .build();
-```
-
-Provided that the Strongback lifecycle (and configuration) is managed properly, and there is no network issue preventing you from
-connecting, this should be enough for you to store your measurements externally.
-
diff --git a/strongback/strongback-rmi-supplier/build.gradle b/strongback/strongback-rmi-supplier/build.gradle
deleted file mode 100644
index 9085a0a8..00000000
--- a/strongback/strongback-rmi-supplier/build.gradle
+++ /dev/null
@@ -1,72 +0,0 @@
-group = "${rootProject.group}.strongback"
-
-project.ext {
- artifactDisplayName = "Abort Mission - Strongback RMI Supplier"
- artifactDescription = "RMI implementation of Strongback logic."
-}
-
-dependencies {
- implementation (project(":strongback:strongback-base")) {
- transitive = false
- }
- implementation project(":mission-control")
- implementation libs.slf4j.api
- testImplementation project(":boosters:testkit")
- testImplementation project(":boosters:booster-junit-jupiter")
- testImplementation libs.jupiter.core
- testImplementation libs.mockito.core
- testImplementation libs.spring.boot.starter
- testImplementation libs.spring.boot.starter.test
- testImplementation libs.jupiter.platform.testkit
- constraints {
- testImplementation libs.bundles.spring.test
- }
-}
-
-test {
- useJUnitPlatform {
- systemProperty("abort-mission.report.directory", file("${buildDir}/reports/abort-mission/"))
- includeTags 'unit', 'integration'
- }
-}
-
-publishing {
- publications {
- mavenJava(MavenPublication) {
- from components.java
- artifactId = "abort.${project.name}"
- pom {
- name = "${project.artifactDisplayName}"
- description = "${project.artifactDescription}"
- url = rootProject.ext.repoUrl
- licenses {
- license {
- name = rootProject.ext.licenseName
- url = rootProject.ext.licenseUrl
- }
- }
- developers {
- developer {
- id = rootProject.ext.maintainerId
- name = rootProject.ext.maintainerName
- url = rootProject.ext.maintainerUrl
- }
- }
- scm {
- connection = rootProject.ext.scmConnection
- developerConnection = rootProject.ext.scmConnection
- url = rootProject.ext.scmProjectUrl
- }
- withXml {
- asNode().dependencies.'*'.findAll() {
- it.scope.text() == 'runtime'
- }.each { it.scope*.value = 'compile' }
- }
- }
- }
- }
-}
-
-signing {
- sign publishing.publications.mavenJava
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/RmiStrongbackController.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/RmiStrongbackController.java
deleted file mode 100644
index 5b2cba82..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/RmiStrongbackController.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi;
-
-import com.github.nagyesta.abortmission.core.telemetry.ReportingHelper;
-import com.github.nagyesta.abortmission.core.telemetry.stats.LaunchTelemetryDataSource;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackController;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerManager;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.telemetry.RmiBackedLaunchTelemetryDataSource;
-
-import java.rmi.registry.Registry;
-
-/**
- * RMI specific implementation of {@link StrongbackController}.
- */
-public class RmiStrongbackController implements StrongbackController {
-
- private final RmiServerManager serverManager;
-
- public RmiStrongbackController(final RmiServerManager serverManager) {
- this.serverManager = serverManager;
- }
-
- @Override
- public void erect() {
- serverManager.startServer();
- }
-
- @Override
- public void retract() {
- final Registry registry = RmiServiceProvider.lookupRegistry(serverManager.getPort());
- final LaunchTelemetryDataSource telemetryDataSource = new RmiBackedLaunchTelemetryDataSource(registry);
- new ReportingHelper().report(telemetryDataSource);
- serverManager.stopServer();
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerConstants.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerConstants.java
deleted file mode 100644
index 34ed8103..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerConstants.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.server;
-
-/**
- * Defines the RMI database specific default values and constants.
- */
-public final class RmiServerConstants {
- /**
- * Default RMI port.
- */
- public static final int DEFAULT_RMI_PORT = 29542;
- /**
- * The RMI service name used for lookup of the abort mission service.
- */
- public static final String SERVICE_NAME = "LaunchStatisticsService";
- /**
- * The RMI service name used for lookup of the service that can shut down the server.
- */
- public static final String EXIT_SERVICE_NAME = "ExitService";
-
- private RmiServerConstants() {
- //util class
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManager.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManager.java
deleted file mode 100644
index 08d23530..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManager.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackConfigurationHelper;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.service.RmiExitService;
-import com.github.nagyesta.abortmission.strongback.rmi.service.impl.LaunchStatisticsServiceImpl;
-import com.github.nagyesta.abortmission.strongback.rmi.service.impl.RmiExitServiceImpl;
-
-import java.rmi.Remote;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-
-/**
- * Manages the lifecycle of the RMI server we will use.
- */
-@SuppressWarnings("FieldCanBeLocal")
-public class RmiServerManager {
-
- private final int port;
- //keep a strong reference to the service to avoid unintended GC
- private LaunchStatisticsService launchStatisticsService;
- //keep a strong reference to the service to avoid unintended GC
- private RmiExitService rmiExitService;
-
- /**
- * Creates the instance using the values provided as system properties.
- */
- public RmiServerManager() {
- this(StrongbackConfigurationHelper.optionalPortValue().orElse(RmiServerConstants.DEFAULT_RMI_PORT));
- }
-
- /**
- * Creates the instance using the explicitly provided values.
- *
- * @param port The TCP port we need to use.
- */
- public RmiServerManager(final int port) {
- this.port = port;
- }
-
- /**
- * Starts the server if needed.
- */
- public void startServer() {
- try {
- doStart();
- Thread.currentThread().join();
- } catch (final InterruptedException ignored) {
- //ignore
- } catch (final Exception ex) {
- throw new StrongbackException("Server startup failed.", ex);
- }
- }
-
- /**
- * Stops the server if needed.
- */
- public void stopServer() {
- try {
- doStop();
- } catch (final Exception ex) {
- throw new StrongbackException("Server failed to stop.", ex);
- }
- }
-
- /**
- * Stops the server and ignores all exceptions.
- */
- public void stopServerQuietly() {
- try {
- stopServer();
- } catch (final Exception ignored) {
- //ignore
- }
- }
-
- /**
- * Returns the port number used by this server.
- *
- * @return The port.
- */
- public int getPort() {
- return port;
- }
-
- /**
- * Performs the startup.
- *
- * @throws Exception If the server couldn't be started or configured.
- */
- protected void doStart() throws Exception {
- final Registry registry = RmiServiceProvider.createRegistry(port);
-
- launchStatisticsService = new LaunchStatisticsServiceImpl();
- rmiExitService = new RmiExitServiceImpl(launchStatisticsService, Thread.currentThread(), registry);
-
- final Remote abortMissionService = UnicastRemoteObject.exportObject(launchStatisticsService, port);
- final Remote exitService = UnicastRemoteObject.exportObject(rmiExitService, port);
-
- registry.bind(RmiServerConstants.SERVICE_NAME, abortMissionService);
- registry.bind(RmiServerConstants.EXIT_SERVICE_NAME, exitService);
- }
-
- /**
- * Performs the shutdown steps.
- *
- * @throws Exception When the remote service call fails.
- */
- protected void doStop() throws Exception {
- final Registry registry = RmiServiceProvider.lookupRegistry(port);
- ((RmiExitService) registry.lookup(RmiServerConstants.EXIT_SERVICE_NAME)).shutdown();
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProvider.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProvider.java
deleted file mode 100644
index b66a139b..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-
-/**
- * Utility class for data source creation.
- */
-public final class RmiServiceProvider {
-
- private RmiServiceProvider() {
- //util class
- }
-
- /**
- * Creates the default Registry using the provided port.
- *
- * @param portNumber The port we need to use.
- * @return registry
- */
- public static Registry createRegistry(final int portNumber) {
- try {
- return LocateRegistry.createRegistry(portNumber);
- } catch (final RemoteException e) {
- throw new StrongbackException("Failed to create registry for port: " + portNumber, e);
- }
- }
-
- /**
- * Looks up the default Registry using the provided port.
- *
- * @param portNumber The port we need to use.
- * @return registry
- */
- public static Registry lookupRegistry(final int portNumber) {
- try {
- return LocateRegistry.getRegistry(portNumber);
- } catch (final RemoteException e) {
- throw new StrongbackException("Failed to locate registry for port: " + portNumber, e);
- }
- }
-
- /**
- * Looks up a service stub from a registry.
- *
- * @param registry The registry we are connecting to.
- * @return service
- */
- public static LaunchStatisticsService service(final Registry registry) {
- try {
- return (LaunchStatisticsService) registry.lookup(RmiServerConstants.SERVICE_NAME);
- } catch (final Exception e) {
- throw new StrongbackException("Failed to get service instance.", e);
- }
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsService.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsService.java
deleted file mode 100644
index e9ac35c2..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsService.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service;
-
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.util.List;
-
-/**
- * The repository we will use for data access.
- */
-public interface LaunchStatisticsService extends Remote {
-
- /**
- * Inserts a single time measurement to the database.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @param measurement The measurement we captured during stage execution.
- * @throws RemoteException When the RMI call fails.
- */
- void insertStageTimeMeasurement(String contextName,
- String matcherName,
- boolean countdown,
- RmiStageTimeMeasurement measurement) throws RemoteException;
-
- /**
- * Fetches all previously recorded measurements for the given matcher name.
- * The order of entries will be by start, end, class, method, launchId, result.
- *
- * @param matcherName The name of the matcher we need to filter for.
- * @return The matching measurements.
- * @throws RemoteException When the RMI call fails.
- */
- List fetchAllMeasurementsForMatcher(String matcherName) throws RemoteException;
-
- /**
- * Fetches all previously recorded measurements for the given matcher name.
- * The order of entries will be by start, end, class, method, launchId, result.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @return The matching measurements.
- * @throws RemoteException When the RMI call fails.
- */
- List fetchMeasurementsFor(String contextName,
- String matcherName,
- boolean countdown) throws RemoteException;
-
- /**
- * Fetches all matcher names we used so far.
- *
- * @return The matcher names.
- * @throws RemoteException When the RMI call fails.
- */
- List fetchAllMatcherNames() throws RemoteException;
-
- /**
- * Gets a snapshot of the previously recorded measurements for abort evaluation.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcherName The name of the matcher we need to filter for.
- * @param countdown True if we need the countdown values false otherwise.
- * @return The snapshot.
- * @throws RemoteException When the RMI call fails.
- */
- RmiStageStatisticsSnapshot getSnapshot(String contextName,
- String matcherName,
- boolean countdown) throws RemoteException;
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/RmiExitService.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/RmiExitService.java
deleted file mode 100644
index 86872d2f..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/RmiExitService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/**
- * Defines how we need to unregister remotes and shutting down the service.
- */
-public interface RmiExitService extends Remote {
-
- /**
- * unregisters remotes and shuts down.
- *
- * @throws RemoteException When the RMI call fails.
- */
- void shutdown() throws RemoteException;
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/LaunchStatisticsServiceImpl.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/LaunchStatisticsServiceImpl.java
deleted file mode 100644
index b7df5641..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/LaunchStatisticsServiceImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service.impl;
-
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-
-import java.util.List;
-
-/**
- * Map based implementation of {@link LaunchStatisticsService}.
- */
-public class LaunchStatisticsServiceImpl implements LaunchStatisticsService {
-
- @Override
- public void insertStageTimeMeasurement(final String contextName,
- final String matcherName,
- final boolean countdown,
- final RmiStageTimeMeasurement measurement) {
- SingletonLaunchStatisticsService.shared()
- .insertStageTimeMeasurement(contextName, matcherName, countdown, measurement);
- }
-
- @Override
- public List fetchAllMeasurementsForMatcher(final String matcherName) {
- return SingletonLaunchStatisticsService.shared()
- .fetchAllMeasurementsForMatcher(matcherName);
- }
-
- @Override
- public List fetchMeasurementsFor(final String contextName,
- final String matcherName,
- final boolean countdown) {
- return SingletonLaunchStatisticsService.shared()
- .fetchMeasurementsFor(contextName, matcherName, countdown);
- }
-
- @Override
- public List fetchAllMatcherNames() {
- return SingletonLaunchStatisticsService.shared()
- .fetchAllMatcherNames();
- }
-
- @Override
- public RmiStageStatisticsSnapshot getSnapshot(final String contextName,
- final String matcherName,
- final boolean countdown) {
- return SingletonLaunchStatisticsService.shared()
- .getSnapshot(contextName, matcherName, countdown);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/RmiExitServiceImpl.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/RmiExitServiceImpl.java
deleted file mode 100644
index ed8d493d..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/RmiExitServiceImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service.impl;
-
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerConstants;
-import com.github.nagyesta.abortmission.strongback.rmi.service.RmiExitService;
-
-import java.rmi.Remote;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-
-/**
- * Class taking care of the registered remotes and shutting down the service.
- */
-public class RmiExitServiceImpl implements RmiExitService {
-
- private final Remote remote;
- private final Thread thread;
- private final Registry registry;
-
- /**
- * Constructor registering the service we need to stop.
- *
- * @param remote The service.
- * @param thread The thread started when the registry was created (and waiting since).
- * @param registry The registry we created.
- */
- public RmiExitServiceImpl(final Remote remote, final Thread thread, final Registry registry) {
- this.remote = remote;
- this.thread = thread;
- this.registry = registry;
- }
-
- @Override
- public void shutdown() {
- try {
- registry.unbind(RmiServerConstants.SERVICE_NAME);
- registry.unbind(RmiServerConstants.EXIT_SERVICE_NAME);
-
- UnicastRemoteObject.unexportObject(remote, true);
- UnicastRemoteObject.unexportObject(this, true);
-
- System.out.println("CalculatorServer exiting.");
- thread.interrupt();
- } catch (final Exception e) {
- //ignore
- }
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/SingletonLaunchStatisticsService.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/SingletonLaunchStatisticsService.java
deleted file mode 100644
index cc30c230..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/service/impl/SingletonLaunchStatisticsService.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service.impl;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * Map based implementation of {@link LaunchStatisticsService}.
- */
-public class SingletonLaunchStatisticsService implements LaunchStatisticsService {
-
- private final Map>>> store = new ConcurrentHashMap<>();
-
- /**
- * Returns the shared service instance.
- *
- * @return the shared instance.
- */
- public static SingletonLaunchStatisticsService shared() {
- return SingletonLaunchStatisticsServiceHolder.INSTANCE;
- }
-
- @Override
- public void insertStageTimeMeasurement(final String contextName,
- final String matcherName,
- final boolean countdown,
- final RmiStageTimeMeasurement measurement) {
- store.computeIfAbsent(contextName, name -> new ConcurrentHashMap<>())
- .computeIfAbsent(matcherName, name -> new ConcurrentHashMap<>())
- .computeIfAbsent(countdown, c -> new CopyOnWriteArrayList<>())
- .add(measurement);
-
- }
-
- @Override
- public List fetchAllMeasurementsForMatcher(final String matcherName) {
- return store.values().stream()
- .filter(contextMap -> contextMap.containsKey(matcherName))
- .flatMap(contextMap -> Stream.of(contextMap.get(matcherName)))
- .flatMap(matcherMap -> matcherMap.values().stream())
- .flatMap(Collection::stream)
- .sorted()
- .collect(Collectors.toList());
- }
-
- @Override
- public List fetchMeasurementsFor(final String contextName,
- final String matcherName,
- final boolean countdown) {
- if (contextName == null || matcherName == null) {
- return Collections.emptyList();
- }
- return store.computeIfAbsent(contextName, name -> new ConcurrentHashMap<>())
- .computeIfAbsent(matcherName, name -> new ConcurrentHashMap<>())
- .computeIfAbsent(countdown, c -> new CopyOnWriteArrayList<>())
- .stream()
- .sorted()
- .collect(Collectors.toList());
- }
-
- @Override
- public List fetchAllMatcherNames() {
- return store.values().stream()
- .map(Map::keySet)
- .flatMap(Collection::stream)
- .distinct()
- .sorted()
- .collect(Collectors.toList());
- }
-
- @Override
- public RmiStageStatisticsSnapshot getSnapshot(final String contextName,
- final String matcherName,
- final boolean countdown) {
- final Map resultMap = fetchMeasurementsFor(contextName, matcherName, countdown).stream()
- .collect(Collectors.groupingBy(RmiStageTimeMeasurement::getResult))
- .entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
- return new RmiStageStatisticsSnapshot(
- resultMap.getOrDefault(StageResult.FAILURE, 0),
- resultMap.getOrDefault(StageResult.SUCCESS, 0),
- resultMap.getOrDefault(StageResult.ABORT, 0),
- resultMap.getOrDefault(StageResult.SUPPRESSED, 0));
- }
-
- private static class SingletonLaunchStatisticsServiceHolder {
- private static final SingletonLaunchStatisticsService INSTANCE = new SingletonLaunchStatisticsService();
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollector.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollector.java
deleted file mode 100644
index dd7bc5a0..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollector.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.healthcheck.impl.DefaultStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.base.ExternalStageStatisticsCollector;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-/**
- * RMI backed implementation of {@link com.github.nagyesta.abortmission.core.healthcheck.impl.StageStatisticsCollector}.
- */
-public class RmiBackedStageStatisticsCollector extends ExternalStageStatisticsCollector {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(RmiBackedStageStatisticsCollector.class);
- private static final StageStatisticsSnapshot DEFAULT_SNAPSHOT =
- new DefaultStageStatisticsSnapshot(0, 0, 0, 0);
-
- private final Registry registry;
-
- /**
- * Simple constructor only setting the matcher.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param matcher The matcher held by the evaluator owning this collector as well.
- * @param registry The Registry used for obtaining the RMI connection.
- * @param countdown True if the collector will be used for countdown.
- */
- public RmiBackedStageStatisticsCollector(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final Registry registry,
- final boolean countdown) {
- super(contextName, matcher, countdown);
- this.registry = registry;
- }
-
- @Override
- protected StageStatisticsSnapshot doGetSnapshot(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- try {
- final LaunchStatisticsService service = RmiServiceProvider.service(registry);
- return Optional.ofNullable(service.getSnapshot(contextName, matcher.getName(), countdown))
- .map(RmiStageStatisticsSnapshot::toStageStatisticsSnapshot)
- .orElse(DEFAULT_SNAPSHOT);
- } catch (final RemoteException e) {
- LOGGER.error("Failed to obtain snapshot.", e);
- throw new StrongbackException(e.getMessage(), e);
- }
- }
-
- @Override
- protected List doFetchAll(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown) {
- try {
- final LaunchStatisticsService service = RmiServiceProvider.service(registry);
- return service.fetchMeasurementsFor(contextName, matcher.getName(), countdown).stream()
- .map(RmiStageTimeMeasurement::toStageTimeMeasurement)
- .collect(Collectors.toList());
- } catch (final RemoteException e) {
- LOGGER.error("Failed to fetch all.", e);
- throw new StrongbackException(e.getMessage(), e);
- }
- }
-
- @Override
- protected void doLogTimeMeasurement(final String contextName,
- final MissionHealthCheckMatcher matcher,
- final boolean countdown,
- final StageTimeMeasurement measurement) {
- try {
- final LaunchStatisticsService service = RmiServiceProvider.service(registry);
- final RmiStageTimeMeasurement rmiMeasurement = new RmiStageTimeMeasurement(measurement);
- service.insertStageTimeMeasurement(contextName, matcher.getName(), countdown, rmiMeasurement);
- } catch (final RemoteException e) {
- LOGGER.error("Failed to log measurement.", e);
- throw new StrongbackException(e.getMessage(), e);
- }
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorFactory.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorFactory.java
deleted file mode 100644
index 9f2d26e0..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatistics;
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-
-import java.rmi.registry.Registry;
-
-/**
- * Factory for creating {@link RmiBackedStageStatisticsCollector} instances.
- */
-public final class RmiBackedStageStatisticsCollectorFactory implements StageStatisticsCollectorFactory {
-
- private final String contextName;
- private final Registry registry;
-
- /**
- * Creates an instance and sets the contextName and dataSource.
- *
- * @param contextName The name of the Abort-Mission context.
- * @param registry The registry we use for accessing the service.
- */
- public RmiBackedStageStatisticsCollectorFactory(final String contextName, final Registry registry) {
- this.contextName = contextName;
- this.registry = registry;
- }
-
- @Override
- public StageStatistics newCountdownStatistics(final MissionHealthCheckMatcher matcher) {
- return new RmiBackedStageStatisticsCollector(contextName, matcher, registry, true);
- }
-
- @Override
- public StageStatistics newMissionStatistics(final MissionHealthCheckMatcher matcher) {
- return new RmiBackedStageStatisticsCollector(contextName, matcher, registry, false);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshot.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshot.java
deleted file mode 100644
index d47d5243..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshot.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.healthcheck.impl.DefaultStageStatisticsSnapshot;
-
-import java.io.Serializable;
-import java.util.Objects;
-import java.util.StringJoiner;
-
-/**
- * RMI specific serializable DTO replacement of the StageStatisticsSnapshot.
- */
-public class RmiStageStatisticsSnapshot implements Serializable {
-
- public static final long serialVersionUID = 1L;
-
- private int failed;
- private int succeeded;
- private int aborted;
- private int suppressed;
-
- /**
- * Default constructor for serialization.
- */
- public RmiStageStatisticsSnapshot() {
- }
-
- /**
- * Construct the instance and sets all the fields to let this instance represent the recorded outcome of a matcher.
- *
- * @param failed The number of failed measurements.
- * @param succeeded The number of success measurements.
- * @param aborted The number of aborted measurements.
- * @param suppressed The number of suppressed measurements.
- */
- public RmiStageStatisticsSnapshot(final int failed, final int succeeded, final int aborted, final int suppressed) {
- this.failed = failed;
- this.succeeded = succeeded;
- this.aborted = aborted;
- this.suppressed = suppressed;
- }
-
- /**
- * See {@link StageStatisticsSnapshot#getFailed()}.
- *
- * @return count
- */
- public int getFailed() {
- return failed;
- }
-
- /**
- * Sets the number of failed cases.
- *
- * @param failed The count set.
- */
- public void setFailed(final int failed) {
- this.failed = failed;
- }
-
- /**
- * See {@link StageStatisticsSnapshot#getSucceeded()}.
- *
- * @return count
- */
- public int getSucceeded() {
- return succeeded;
- }
-
- /**
- * Sets the number of succeeded cases.
- *
- * @param succeeded The count set.
- */
- public void setSucceeded(final int succeeded) {
- this.succeeded = succeeded;
- }
-
- /**
- * See {@link StageStatisticsSnapshot#getSuppressed()}.
- *
- * @return count
- */
- public int getSuppressed() {
- return suppressed;
- }
-
- /**
- * Sets the number of suppressed cases.
- *
- * @param suppressed The count set.
- */
- public void setSuppressed(final int suppressed) {
- this.suppressed = suppressed;
- }
-
- /**
- * See {@link StageStatisticsSnapshot#getAborted()}.
- *
- * @return count
- */
- public int getAborted() {
- return aborted;
- }
-
- /**
- * Sets the number of aborted cases.
- *
- * @param aborted The count set.
- */
- public void setAborted(final int aborted) {
- this.aborted = aborted;
- }
-
- /**
- * Converts back to the generic variant.
- *
- * @return snapshot
- */
- public StageStatisticsSnapshot toStageStatisticsSnapshot() {
- return new DefaultStageStatisticsSnapshot(failed, succeeded, aborted, suppressed);
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof RmiStageStatisticsSnapshot)) {
- return false;
- }
- final RmiStageStatisticsSnapshot that = (RmiStageStatisticsSnapshot) o;
- return failed == that.getFailed()
- && succeeded == that.getSucceeded()
- && aborted == that.getAborted()
- && suppressed == that.getSuppressed();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(failed, succeeded, aborted, suppressed);
- }
-
- @Override
- public String toString() {
- return new StringJoiner(", ", RmiStageStatisticsSnapshot.class.getSimpleName() + "[", "]")
- .add("failed=" + failed)
- .add("succeeded=" + succeeded)
- .add("aborted=" + aborted)
- .add("suppressed=" + suppressed)
- .toString();
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurement.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurement.java
deleted file mode 100644
index 3f1d51a6..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurement.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-
-import java.io.Serializable;
-import java.util.*;
-
-/**
- * Captures the timings and outcome of one stage of the launch (countdown/mission).
- */
-public final class RmiStageTimeMeasurement implements Comparable, Serializable {
-
- public static final long serialVersionUID = 1L;
- /**
- * Name used to indicate that this is the class level measurement and not a test method.
- */
- private StageResult result;
- private long start;
- private long end;
- private String testClassId;
- private String testCaseId;
- private UUID launchId;
- private String displayName;
- private String threadName;
- private String throwableClass;
- private String throwableMessage;
- private List stackTrace;
-
- /**
- * Default contructor for serialization.
- */
- public RmiStageTimeMeasurement() {
- }
-
- /**
- * The constructor allowing us to create a new instance capturing the time measured data.
- *
- * @param measurement The measurement we captured (and need to convert).
- */
- public RmiStageTimeMeasurement(final StageTimeMeasurement measurement) {
- this.launchId = Objects.requireNonNull(measurement, "Measurement cannot be null.").getLaunchId();
- this.testClassId = measurement.getTestClassId();
- this.testCaseId = measurement.getTestCaseId();
- this.result = measurement.getResult();
- this.start = measurement.getStart();
- this.end = measurement.getEnd();
- this.displayName = measurement.getDisplayName();
- this.threadName = measurement.getThreadName();
- this.throwableClass = measurement.getThrowableClass();
- this.throwableMessage = measurement.getThrowableMessage();
- this.stackTrace = measurement.getStackTrace();
- }
-
- public UUID getLaunchId() {
- return launchId;
- }
-
- public void setLaunchId(final UUID launchId) {
- this.launchId = launchId;
- }
-
- public StageResult getResult() {
- return result;
- }
-
- public void setResult(final StageResult result) {
- this.result = result;
- }
-
- public long getStart() {
- return start;
- }
-
- public void setStart(final long start) {
- this.start = start;
- }
-
- public long getEnd() {
- return end;
- }
-
- public void setEnd(final long end) {
- this.end = end;
- }
-
- public String getTestClassId() {
- return testClassId;
- }
-
- public void setTestClassId(final String testClassId) {
- this.testClassId = testClassId;
- }
-
- public String getTestCaseId() {
- return testCaseId;
- }
-
- public void setTestCaseId(final String testCaseId) {
- this.testCaseId = testCaseId;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public RmiStageTimeMeasurement setDisplayName(final String displayName) {
- this.displayName = displayName;
- return this;
- }
-
- public String getThreadName() {
- return threadName;
- }
-
- public RmiStageTimeMeasurement setThreadName(final String threadName) {
- this.threadName = threadName;
- return this;
- }
-
- public String getThrowableClass() {
- return throwableClass;
- }
-
- public RmiStageTimeMeasurement setThrowableClass(final String throwableClass) {
- this.throwableClass = throwableClass;
- return this;
- }
-
- public String getThrowableMessage() {
- return throwableMessage;
- }
-
- public RmiStageTimeMeasurement setThrowableMessage(final String throwableMessage) {
- this.throwableMessage = throwableMessage;
- return this;
- }
-
- public List getStackTrace() {
- return stackTrace;
- }
-
- public RmiStageTimeMeasurement setStackTrace(final List stackTrace) {
- this.stackTrace = stackTrace;
- return this;
- }
-
- /**
- * Converts the values back to {@link StageTimeMeasurement}.
- *
- * @return measurement
- */
- public StageTimeMeasurement toStageTimeMeasurement() {
- return StageTimeMeasurementBuilder.builder()
- .setLaunchId(launchId)
- .setTestClassId(testClassId)
- .setTestCaseId(testCaseId)
- .setResult(result)
- .setStart(start)
- .setEnd(end)
- .setDisplayName(displayName)
- .setThreadName(threadName)
- .setThrowableClass(throwableClass)
- .setThrowableMessage(throwableMessage)
- .setStackTrace(stackTrace)
- .build();
- }
-
- @SuppressWarnings("NullableProblems")
- @Override
- public int compareTo(final RmiStageTimeMeasurement o) {
- return Comparator
- .nullsLast(
- Comparator.comparingLong(RmiStageTimeMeasurement::getStart)
- .thenComparingLong(RmiStageTimeMeasurement::getEnd)
- .thenComparing(RmiStageTimeMeasurement::getTestClassId)
- .thenComparing(RmiStageTimeMeasurement::getTestCaseId)
- .thenComparing(RmiStageTimeMeasurement::getLaunchId)
- .thenComparing(RmiStageTimeMeasurement::getResult)
- )
- .compare(this, o);
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof RmiStageTimeMeasurement)) {
- return false;
- }
- return areFieldValuesEqual((RmiStageTimeMeasurement) o);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(result, start, end, testClassId, testCaseId, launchId, displayName, threadName, throwableClass,
- throwableMessage, stackTrace);
- }
-
- private boolean areFieldValuesEqual(final RmiStageTimeMeasurement that) {
- return start == that.start
- && end == that.end
- && result == that.result
- && Objects.equals(testClassId, that.getTestClassId())
- && Objects.equals(testCaseId, that.getTestCaseId())
- && Objects.equals(launchId, that.getLaunchId())
- && Objects.equals(displayName, that.getDisplayName())
- && Objects.equals(threadName, that.getThreadName())
- && Objects.equals(throwableClass, that.getThrowableClass())
- && Objects.equals(throwableMessage, that.getThrowableMessage())
- && Objects.equals(stackTrace, that.getStackTrace());
- }
-
- @Override
- public String toString() {
- return new StringJoiner(", ", RmiStageTimeMeasurement.class.getSimpleName() + "[", "]")
- .add("launchId='" + launchId + "'")
- .add("testClassId='" + testClassId + "'")
- .add("testCaseId='" + testCaseId + "'")
- .add("result=" + result)
- .add("start=" + start)
- .add("end=" + end)
- .add("threadName='" + threadName + "'")
- .add("displayName='" + displayName + "'")
- .add("throwableClass='" + throwableClass + "'")
- .toString();
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSource.java b/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSource.java
deleted file mode 100644
index e77d0a20..00000000
--- a/strongback/strongback-rmi-supplier/src/main/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSource.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.telemetry;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.converter.BaseLaunchTelemetryConverter;
-import com.github.nagyesta.abortmission.core.telemetry.converter.ClassTelemetryConverter;
-import com.github.nagyesta.abortmission.core.telemetry.stats.ClassTelemetry;
-import com.github.nagyesta.abortmission.core.telemetry.stats.LaunchTelemetryDataSource;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-/**
- * Rmi backed implementation of {@link LaunchTelemetryDataSource}.
- */
-public class RmiBackedLaunchTelemetryDataSource extends BaseLaunchTelemetryConverter implements LaunchTelemetryDataSource {
-
- private final Registry registry;
-
- /**
- * Creates the {@link LaunchTelemetryDataSource} using the provided RMI registry.
- *
- * @param registry The RMI registry.
- */
- public RmiBackedLaunchTelemetryDataSource(final Registry registry) {
- super(new ClassTelemetryConverter());
- this.registry = registry;
- }
-
- @Override
- public SortedMap fetchClassStatistics() {
- try {
- return doFetchStatistics();
- } catch (final RemoteException e) {
- throw new StrongbackException(e.getMessage(), e);
- }
- }
-
- private SortedMap doFetchStatistics() throws RemoteException {
- final LaunchStatisticsService service = RmiServiceProvider.service(registry);
- final List matcherName = service.fetchAllMatcherNames();
- final Map> measurementsPerMatcher = matcherName.stream()
- .collect(Collectors.toMap(Function.identity(),
- name -> fetchByMatcherName(service, name)));
- return processFetchedRecords(measurementsPerMatcher);
- }
-
- private List fetchByMatcherName(final LaunchStatisticsService service, final String name) {
- try {
- return service.fetchAllMeasurementsForMatcher(name).stream()
- .map(RmiStageTimeMeasurement::toStageTimeMeasurement)
- .collect(Collectors.toList());
- } catch (final RemoteException e) {
- throw new StrongbackException(e.getMessage(), e);
- }
- }
-
- private SortedMap processFetchedRecords(
- final Map> measurementsPerMatcher) {
- final Map>> matchersByClassAndMethod = new TreeMap<>();
- final Map> byTestClassAccumulator = new TreeMap<>();
- measurementsPerMatcher.forEach((matcher, measurements) -> {
- mergeInto(matchersByClassAndMethod,
- measurements.stream().filter(s -> CLASS_ONLY.equals(s.getTestCaseId())),
- measurements.stream().filter(s -> !CLASS_ONLY.equals(s.getTestCaseId())),
- matcher);
- mergeInto(byTestClassAccumulator,
- measurements.stream().filter(s -> CLASS_ONLY.equals(s.getTestCaseId())),
- measurements.stream().filter(s -> !CLASS_ONLY.equals(s.getTestCaseId())));
- });
- return repartitionByClasses(matchersByClassAndMethod, byTestClassAccumulator);
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/main/resources/strongback-blueprint.xml b/strongback/strongback-rmi-supplier/src/main/resources/strongback-blueprint.xml
deleted file mode 100644
index b91ff247..00000000
--- a/strongback/strongback-rmi-supplier/src/main/resources/strongback-blueprint.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/MissionOutlineDefinition.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/MissionOutlineDefinition.java
deleted file mode 100644
index d433b63b..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/MissionOutlineDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor;
-import com.github.nagyesta.abortmission.core.AbortMissionCommandOps;
-import com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor;
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.outline.MissionOutline;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerConstants;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiBackedStageStatisticsCollectorFactory;
-
-import java.rmi.registry.Registry;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Consumer;
-
-import static com.github.nagyesta.abortmission.core.MissionControl.*;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-
-public class MissionOutlineDefinition extends MissionOutline {
-
- @Override
- @SuppressWarnings("checkstyle:MagicNumber")
- protected Map> defineOutline() {
- final DependencyNameExtractor extractor = new TagDependencyNameExtractor();
- final Registry registry = RmiServiceProvider.lookupRegistry(RmiServerConstants.DEFAULT_RMI_PORT);
- final Map> plan = new HashMap<>();
- plan.put(STATIC_FIRE, ops -> {
- final StageStatisticsCollectorFactory factory = getCollectorFactory(STATIC_FIRE, registry);
- final MissionHealthCheckMatcher sideBoosterMatcher = matcher()
- .dependencyWith(SIDE_BOOSTER)
- .extractor(extractor).build();
- final MissionHealthCheckMatcher centerCoreMatcher = matcher()
- .dependencyWith(CENTER_CORE)
- .extractor(extractor).build();
- ops.registerHealthCheck(
- percentageBasedEvaluator(sideBoosterMatcher, factory)
- .abortThreshold(10)
- .burnInTestCount(2).build());
- ops.registerHealthCheck(
- percentageBasedEvaluator(centerCoreMatcher, factory)
- .build());
- });
- plan.put(PARALLEL, ops -> {
- final StageStatisticsCollectorFactory factory = getCollectorFactory(PARALLEL, registry);
- final MissionHealthCheckMatcher anyClassMatcher = matcher().anyClass().build();
- ops.registerHealthCheck(
- reportOnlyEvaluator(anyClassMatcher, factory)
- .build());
- });
- return plan;
- }
-
- private StageStatisticsCollectorFactory getCollectorFactory(final String contextName, final Registry registry) {
- return new RmiBackedStageStatisticsCollectorFactory(contextName, registry);
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java
deleted file mode 100644
index bc9892ef..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersPerClassTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.Random;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PARALLEL;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PER_CLASS;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(PARALLEL)
-@SpringBootTest(classes = StaticFire.class)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@Tag(PER_CLASS)
-public class ParallelStaticFireTestWithSideBoostersPerClassTest {
-
- private static final Random RANDOM = new Random();
- private static final Logger LOGGER = LoggerFactory.getLogger(ParallelStaticFireTestWithSideBoostersPerClassTest.class);
-
- @Autowired
- private Booster centerCore;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestParallelInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire0(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire1(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire2(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire3(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- private void executeTest(final int wait) throws InterruptedException {
- //given
- LOGGER.info("Running test with max wait: " + wait);
- Thread.sleep(RANDOM.nextInt(wait));
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersTest.java
deleted file mode 100644
index bf2e3dea..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/ParallelStaticFireTestWithSideBoostersTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.Random;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PARALLEL;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.SIDE_BOOSTER;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(PARALLEL)
-@SpringBootTest(classes = StaticFire.class)
-@Tag(SIDE_BOOSTER)
-public class ParallelStaticFireTestWithSideBoostersTest {
-
- static final CopyOnWriteArraySet THREADS_USED = new CopyOnWriteArraySet<>();
- private static final Random RANDOM = new Random();
- private static final Logger LOGGER = LoggerFactory.getLogger(ParallelStaticFireTestWithSideBoostersTest.class);
-
- @Autowired
- private Booster centerCore;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestParallelInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire0(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire1(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire2(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire3(final int wait) throws InterruptedException {
- executeTest(wait);
- }
-
- private void executeTest(final int wait) throws InterruptedException {
- //given
- THREADS_USED.add(Thread.currentThread().getName());
- LOGGER.info("Running test with max wait: " + wait);
- Thread.sleep(RANDOM.nextInt(wait));
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/RmiBackedStaticFireBoosterTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/RmiBackedStaticFireBoosterTest.java
deleted file mode 100644
index 908694e1..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/RmiBackedStaticFireBoosterTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.core.MissionControl;
-import com.github.nagyesta.abortmission.strongback.rmi.RmiStrongbackController;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerManager;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.platform.testkit.engine.EngineTestKit;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;
-
-public class RmiBackedStaticFireBoosterTest {
-
- private static RmiStrongbackController strongbackController;
-
- @BeforeAll
- static void beforeAll() {
- final RmiServerManager serverManager = new RmiServerManager();
- strongbackController = new RmiStrongbackController(serverManager);
- new Thread(() -> strongbackController.erect()).start();
- }
-
- @AfterAll
- static void afterAll() {
- strongbackController.retract();
- }
-
- @Test
- @Tag("integration")
- @SuppressWarnings("checkstyle:MagicNumber")
- public void testAssumption() throws NoSuchMethodException {
- EngineTestKit
- .engine("junit-jupiter")
- .selectors(selectClass(StaticFireTestCenterCoreOnly.class),
- selectClass(StaticFireTestWithSideBoosters.class),
- selectClass(StaticFireTestWithSideBoostersPerClass.class))
- .execute()
- .testEvents()
- .assertStatistics(stats -> stats
- .skipped(DISABLED_CASES)
- .started(TOTAL_CASES)
- .succeeded(SUCCESSFUL_CASES)
- .aborted(ABORTED_CASES)
- .failed(FAILED_CASES));
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestWithSideBoosters.class)
- .forEach(evaluator -> {
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestWithSideBoostersPerClass.class)
- .forEach(evaluator -> {
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS_PER_CLASS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(SIDE_BOOSTER_NOMINAL_STATS_PER_CLASS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- MissionControl.matchingHealthChecks(STATIC_FIRE, StaticFireTestCenterCoreOnly.class.getDeclaredMethod("testIsOnFire"))
- .forEach(evaluator -> {
- assertEquals(CENTER_CORE_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(CENTER_CORE_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- }
-
- @Test
- @Tag("integration")
- @SuppressWarnings("checkstyle:MagicNumber")
- public void testParallelAssumption() {
- EngineTestKit
- .engine("junit-jupiter")
- .selectors(selectClass(ParallelStaticFireTestWithSideBoostersPerClassTest.class),
- selectClass(ParallelStaticFireTestWithSideBoostersTest.class))
- .configurationParameter("junit.jupiter.execution.parallel.enabled", "true")
- .configurationParameter("junit.jupiter.execution.parallel.mode.default", "concurrent")
- .configurationParameter("junit.jupiter.execution.parallel.mode.classes.default", "concurrent")
- .configurationParameter("junit.jupiter.execution.parallel.config.strategy", "fixed")
- .configurationParameter("junit.jupiter.execution.parallel.config.fixed.parallelism", "4")
- .execute()
- .testEvents()
- .assertStatistics(stats -> stats
- .skipped(0)
- .started(SUCCESSFUL_PARALLEL_CASES)
- .succeeded(SUCCESSFUL_PARALLEL_CASES)
- .aborted(0)
- .failed(0));
- MissionControl.matchingHealthChecks(PARALLEL, StaticFireTestWithSideBoosters.class)
- .forEach(evaluator -> {
- assertEquals(PARALLEL_NOMINAL_STATS.getReadOnlyCountdown().getSnapshot(),
- evaluator.getStats().getReadOnlyCountdown().getSnapshot());
- assertEquals(PARALLEL_NOMINAL_STATS.getReadOnlyMission().getSnapshot(),
- evaluator.getStats().getReadOnlyMission().getSnapshot());
- });
- assertTrue(ParallelStaticFireTestWithSideBoostersTest.THREADS_USED.size() > 1);
- }
-
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestCenterCoreOnly.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestCenterCoreOnly.java
deleted file mode 100644
index 34a6c2ca..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestCenterCoreOnly.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.core.annotation.LaunchSequence;
-import com.github.nagyesta.abortmission.core.annotation.SuppressAbortDecisions;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Tags;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@SuppressAbortDecisions
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@LaunchSequence(MissionOutlineDefinition.class)
-public class StaticFireTestCenterCoreOnly {
-
- @Autowired
- private Booster centerCore;
-
- @Test
- @Tags({@Tag(BOOSTER), @Tag(CENTER_CORE)})
- public void testIsOnFire() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-
- @Test
- public void testIsOnFireNotMatchingRules() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoosters.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoosters.java
deleted file mode 100644
index 857b5f8b..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoosters.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.core.annotation.SuppressAbortDecisions;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@Tag(SIDE_BOOSTER)
-public class StaticFireTestWithSideBoosters {
-
- @Autowired
- private Booster centerCore;
- @Autowired
- private Booster sideBooster;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire(final int ignore) {
- //given
-
- //when
- final boolean actual = sideBooster.isOnFire();
-
- //then
- assertTrue(actual);
- }
-
- @Test
- @SuppressAbortDecisions
- @Tag(BOOSTER)
- @Tag(CENTER_CORE)
- public void testIsOnFireNoAbort() {
- //given
-
- //when
- final boolean actual = centerCore.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoostersPerClass.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoostersPerClass.java
deleted file mode 100644
index 2ee7a908..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/jupiter/StaticFireTestWithSideBoostersPerClass.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.jupiter;
-
-import com.github.nagyesta.abortmission.booster.jupiter.annotation.LaunchAbortArmed;
-import com.github.nagyesta.abortmission.testkit.spring.Booster;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFire;
-import com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PER_CLASS;
-import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.STATIC_FIRE;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@LaunchAbortArmed(STATIC_FIRE)
-@SpringBootTest(classes = StaticFire.class)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-@Tag(PER_CLASS)
-public class StaticFireTestWithSideBoostersPerClass {
-
- @Autowired
- private Booster sideBooster;
-
- private static Stream attemptIndexProvider() {
- return StaticFireTestAssets.staticFireTestInputProvider().mapToObj(Arguments::of);
- }
-
- @ParameterizedTest
- @MethodSource("attemptIndexProvider")
- public void testIsOnFire(final int ignore) {
- //given
-
- //when
- final boolean actual = sideBooster.isOnFire();
-
- //then
- assertTrue(actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManagerTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManagerTest.java
deleted file mode 100644
index 898a45c1..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServerManagerTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-
-import java.rmi.AlreadyBoundException;
-
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.spy;
-
-@Tag("unit")
-class RmiServerManagerTest {
-
- @Test
- void testStartServerShouldCatchAndConvertExceptionsWhenDoStartThrowsOne() throws Exception {
- //given
- final RmiServerManager underTest = spy(new RmiServerManager(1));
- doThrow(new AlreadyBoundException()).when(underTest).doStart();
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::startServer);
-
- //then exception
- }
-
-
- @Test
- void testStartServerShouldNotThrowExceptionsWhenDoStartThrowsInterruptedException() throws Exception {
- //given
- final RmiServerManager underTest = spy(new RmiServerManager(1));
- doThrow(new InterruptedException()).when(underTest).doStart();
-
- //when
- underTest.startServer();
-
- //then exception
- }
-
- @Test
- void testStopServerShouldCatchAndConvertExceptionsWhenDoStopThrowsOne() throws Exception {
- //given
- final RmiServerManager underTest = spy(new RmiServerManager(1));
- doThrow(new AlreadyBoundException()).when(underTest).doStop();
-
- //when
- Assertions.assertThrows(StrongbackException.class, underTest::stopServer);
-
- //then exception
- }
-
- @Test
- void testStopServerQuietlyShouldCatchAllExceptionsWhenDoStopThrowsOne() throws Exception {
- //given
- final RmiServerManager underTest = spy(new RmiServerManager(1));
- doThrow(new AlreadyBoundException()).when(underTest).doStop();
-
- //when
- Assertions.assertDoesNotThrow(underTest::stopServerQuietly);
-
- //then exception
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProviderIntegrationTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProviderIntegrationTest.java
deleted file mode 100644
index 5670900d..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/server/RmiServiceProviderIntegrationTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.server;
-
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-
-import java.rmi.ConnectException;
-
-@Tag("integration")
-class RmiServiceProviderIntegrationTest {
-
- private static final int PORT_NUMBER_1 = 30033;
- private static final int PORT_NUMBER_2 = 30034;
-
- @Test
- void testCreateRegistryShouldThrowExceptionWhenCalledTwice() {
- //given
-
- //when
- Assertions.assertDoesNotThrow(() -> RmiServiceProvider.createRegistry(PORT_NUMBER_1));
- Assertions.assertThrows(StrongbackException.class, () -> RmiServiceProvider.createRegistry(PORT_NUMBER_1));
-
- //then + exception
- }
-
- @Test
- void testLookupRegistryShouldSucceedWhenCalledAfterCreatingFirst() {
- //given
- Assertions.assertThrows(ConnectException.class, () -> RmiServiceProvider.lookupRegistry(PORT_NUMBER_2).list());
- RmiServiceProvider.createRegistry(PORT_NUMBER_2);
-
- //when
- Assertions.assertDoesNotThrow(() -> RmiServiceProvider.lookupRegistry(PORT_NUMBER_2).list());
-
- //then + exception
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/AbstractInMemoryDataSourceIntegrationTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/AbstractInMemoryDataSourceIntegrationTest.java
deleted file mode 100644
index 426c475a..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/AbstractInMemoryDataSourceIntegrationTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerConstants;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.service.impl.SingletonLaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.*;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@SuppressWarnings({"checkstyle:JavadocVariable", "checkstyle:VisibilityModifier", "checkstyle:DesignForExtension"})
-public class AbstractInMemoryDataSourceIntegrationTest {
-
- protected static final String MATCHER_PREFIX = "matcher-";
- protected static final String METHOD_PREFIX = "methodName";
- protected static final String CLASS_NAME = "com.github.nagyesta.abortmission."
- + "strongback.h2.repository.AbstractInMemoryDataSourceIntegrationTest";
- private static final String DISPLAY_NAME_PREFIX = "DN_";
- private static final String EXCEPTION_MESSAGE = "This is a test exception.";
-
- protected final String contextName;
- protected int port;
- protected LaunchStatisticsService service;
- protected Registry registry;
-
- protected AbstractInMemoryDataSourceIntegrationTest(final String contextName, final int port) {
- this.contextName = contextName;
- this.port = port;
- this.registry = RmiServiceProvider.createRegistry(port);
- }
-
- protected static Map> mapFromStream(final Stream stream) {
- return stream.collect(Collectors.toMap(
- i -> MATCHER_PREFIX + i,
- i -> Collections.singletonList(generateMeasurement(i))));
- }
-
- protected static Map> mapFromMultiStream(final Stream stream) {
- return stream.collect(Collectors.toMap(
- i -> MATCHER_PREFIX + i,
- i -> IntStream.rangeClosed(0, i).boxed()
- .map(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())));
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- protected static StageTimeMeasurement generateMeasurement(final Integer i) {
- final String testCaseId = Optional.of(i % 3)
- .filter(n -> n != 0)
- .map(n -> METHOD_PREFIX + n)
- .orElse(CLASS_ONLY);
- final StageResult stageResult = StageResult.values()[i % StageResult.values().length];
- final Optional throwable = Optional.of(stageResult)
- .filter(r -> StageResult.FAILURE == r || StageResult.SUPPRESSED == r)
- .map(n -> new RuntimeException(EXCEPTION_MESSAGE).fillInStackTrace());
- return StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.randomUUID())
- .setTestClassId(CLASS_NAME)
- .setTestCaseId(testCaseId)
- .setDisplayName(DISPLAY_NAME_PREFIX + testCaseId)
- .setStart(i)
- .setEnd(i + i)
- .setThreadName(Thread.currentThread().getName())
- .setThrowableClass(throwable.map(Throwable::getClass).map(Class::getName).orElse(null))
- .setThrowableMessage(throwable.map(Throwable::getMessage).orElse(null))
- .setStackTrace(throwable.map(Throwable::getStackTrace)
- .map(s -> Arrays.stream(s).map(StackTraceElement::toString).collect(Collectors.toList()))
- .orElse(null))
- .setResult(stageResult)
- .build();
- }
-
- protected void assertSnapshotCountersMatch(final List expected,
- final RmiStageStatisticsSnapshot actualCountdown,
- final RmiStageStatisticsSnapshot actualMission) {
- final Map expectedCountdown = filterAndCount(expected, s -> s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedCountdown, actualCountdown);
-
- final Map expectedMission = filterAndCount(expected, s -> !s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedMission, actualMission);
- }
-
-
- protected void assertSnapshotCountersMatch(final List expected,
- final StageStatisticsSnapshot actualCountdown,
- final StageStatisticsSnapshot actualMission) {
- final Map expectedCountdown = filterAndCount(expected, s -> s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedCountdown, actualCountdown);
-
- final Map expectedMission = filterAndCount(expected, s -> !s.getTestCaseId().equals(CLASS_ONLY));
- assertResultsMatch(expectedMission, actualMission);
- }
-
- private Map filterAndCount(final List expected,
- final Predicate predicate) {
- return expected
- .stream()
- .filter(predicate)
- .collect(Collectors.groupingBy(StageTimeMeasurement::getResult))
- .entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().size()));
- }
-
- private void assertResultsMatch(final Map expected, final RmiStageStatisticsSnapshot actual) {
- Assertions.assertEquals(expected.getOrDefault(StageResult.FAILURE, 0), actual.getFailed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.ABORT, 0), actual.getAborted());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUPPRESSED, 0), actual.getSuppressed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUCCESS, 0), actual.getSucceeded());
- }
-
- private void assertResultsMatch(final Map expected, final StageStatisticsSnapshot actual) {
- Assertions.assertEquals(expected.getOrDefault(StageResult.FAILURE, 0), actual.getFailed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.ABORT, 0), actual.getAborted());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUPPRESSED, 0), actual.getSuppressed());
- Assertions.assertEquals(expected.getOrDefault(StageResult.SUCCESS, 0), actual.getSucceeded());
- }
-
- protected void insertAll(final Map> input) throws RemoteException {
- for (final Map.Entry> entry : input.entrySet()) {
- final String matcherName = entry.getKey();
- final List measurementList = entry.getValue();
- for (final StageTimeMeasurement measurement : measurementList) {
- final boolean isCountdown = CLASS_ONLY.equals(measurement.getTestCaseId());
- service.insertStageTimeMeasurement(contextName, matcherName, isCountdown, new RmiStageTimeMeasurement(measurement));
- }
- }
- }
-
- @BeforeEach
- void setUp() {
- try {
- service = new SingletonLaunchStatisticsService();
- final Remote abortMissionService = UnicastRemoteObject.exportObject(service, port);
- if (Arrays.asList(registry.list()).contains(RmiServerConstants.SERVICE_NAME)) {
- registry.rebind(RmiServerConstants.SERVICE_NAME, abortMissionService);
- } else {
- registry.bind(RmiServerConstants.SERVICE_NAME, abortMissionService);
- }
- } catch (final Exception ex) {
- throw new StrongbackException("Server startup failed.", ex);
- }
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsServiceIntegrationTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsServiceIntegrationTest.java
deleted file mode 100644
index adb1e978..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/service/LaunchStatisticsServiceIntegrationTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.service;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.junit.jupiter.params.provider.NullAndEmptySource;
-import org.junit.jupiter.params.provider.ValueSource;
-
-import java.rmi.RemoteException;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class LaunchStatisticsServiceIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- private static final String CONTEXT_NAME = "repo";
-
- @SuppressWarnings("checkstyle:MagicNumber")
- LaunchStatisticsServiceIntegrationTest() {
- super(CONTEXT_NAME, 32234);
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream noCollisionInsertDataProvider() {
- return Stream.builder()
- .add(Arguments.of(mapFromStream(IntStream.of(0).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(1, 3, 42).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.rangeClosed(0, 30).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(1, 3).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.rangeClosed(2, 5).boxed())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testInsertStageTimeMeasurementShouldInsertUniqueRecordsWhenCalledWithoutCollision(
- final Map> input) throws RemoteException {
- //given
- final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
-
- //when
- for (final Map.Entry> entry : input.entrySet()) {
- final String key = entry.getKey();
- final List measurementList = entry.getValue();
- for (final StageTimeMeasurement measurement : measurementList) {
- final boolean isCountdown = CLASS_ONLY.equals(measurement.getTestCaseId());
- underTest.insertStageTimeMeasurement(contextName, key, isCountdown, new RmiStageTimeMeasurement(measurement));
- }
- }
-
- //then
- for (final Map.Entry> entry : input.entrySet()) {
- final String matcherName = entry.getKey();
- final List measurements = entry.getValue();
- final TreeSet actual = this.service.fetchAllMeasurementsForMatcher(matcherName)
- .stream()
- .map(RmiStageTimeMeasurement::getLaunchId)
- .collect(Collectors.toCollection(TreeSet::new));
- final TreeSet expected = measurements.stream()
- .map(StageTimeMeasurement::getLaunchId)
- .collect(Collectors.toCollection(TreeSet::new));
- Assertions.assertIterableEquals(expected, actual);
- }
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchMeasurementsForMatcherShouldFilterTheInsertedMeasurementsWhenCalledWithValidInput(
- final Map> input) throws RemoteException {
- //given
- final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
- final String matcherName = findMatcherName(input);
- insertAll(input);
-
- //when
- final List actual = underTest.fetchMeasurementsFor(CONTEXT_NAME, matcherName, false);
-
- //then
- final List expected = input.get(matcherName)
- .stream()
- .filter(s -> !s.getTestCaseId().equals(CLASS_ONLY))
- .sorted()
- .map(RmiStageTimeMeasurement::new)
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @ParameterizedTest
- @NullAndEmptySource
- @ValueSource(strings = {METHOD_PREFIX, CLASS_NAME, MATCHER_PREFIX})
- void testFetchMeasurementsForMatcherShouldReturnNoMeasurementsWhenCalledWithUnknownMatcher(
- final String lookup) throws RemoteException {
- //given
- final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
- final RmiStageTimeMeasurement measurement = new RmiStageTimeMeasurement(generateMeasurement(1));
- insertSingleMeasurement(MATCHER_PREFIX + 1, measurement);
-
- //when
- final List actual = underTest.fetchMeasurementsFor(CONTEXT_NAME, lookup, false);
-
- //then
- Assertions.assertNotNull(actual);
- Assertions.assertIterableEquals(Collections.emptyList(), actual);
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchAllMatcherNamesShouldReturnADistinctListOfTheInsertedMatcherNamesWhenCalled(
- final Map> input) throws RemoteException {
- //given
- final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
- insertAll(input);
-
- //when
- final List actual = underTest.fetchAllMatcherNames();
-
- //then
- final List expected = input.keySet()
- .stream()
- .distinct()
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testGetSnapshotOfAMatcherShouldReturnTheAggregatedStatusCountsWhenCalled(
- final Map> input) throws RemoteException {
- //given
- final LaunchStatisticsService underTest = RmiServiceProvider.service(RmiServiceProvider.lookupRegistry(port));
- final String matcherName = findMatcherName(input);
- insertAll(input);
-
- //when
- final RmiStageStatisticsSnapshot actualCountdown = underTest.getSnapshot(CONTEXT_NAME, matcherName, true);
- final RmiStageStatisticsSnapshot actualMission = underTest.getSnapshot(CONTEXT_NAME, matcherName, false);
-
- //then
- assertSnapshotCountersMatch(input.get(matcherName), actualCountdown, actualMission);
- }
-
- private String findMatcherName(final Map> input) {
- return input.keySet().stream()
- .max(Comparator.naturalOrder())
- .orElseThrow(IllegalStateException::new);
- }
-
- private void insertSingleMeasurement(final String matcherName, final RmiStageTimeMeasurement measurement) throws RemoteException {
- service.insertStageTimeMeasurement(CONTEXT_NAME, matcherName, false, measurement);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorIntegrationTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorIntegrationTest.java
deleted file mode 100644
index 96baae33..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorIntegrationTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.service.AbstractInMemoryDataSourceIntegrationTest;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-import static org.mockito.Mockito.*;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-class RmiBackedStageStatisticsCollectorIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- @SuppressWarnings("checkstyle:MagicNumber")
- RmiBackedStageStatisticsCollectorIntegrationTest() {
- super("collector", 30343);
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream measurementProvider() {
- return Stream.builder()
- .add(Arguments.of(Collections.emptyList()))
- .add(Arguments.of(IntStream.rangeClosed(0, 4)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .add(Arguments.of(IntStream.of(42)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .add(Arguments.of(IntStream.of(34, 43, 12, 5)
- .mapToObj(AbstractInMemoryDataSourceIntegrationTest::generateMeasurement)
- .collect(Collectors.toList())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testLogAndIncrementShouldSaveMeasurementWhenCalledWithValidInput(
- final List measurements) throws RemoteException {
- //given
- final Registry registry = RmiServiceProvider.lookupRegistry(port);
- final boolean countdown = false;
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final RmiBackedStageStatisticsCollector underTest =
- new RmiBackedStageStatisticsCollector(contextName, matcher, registry, countdown);
-
- //when
- measurements.forEach(underTest::logAndIncrement);
-
- //then
- verify(matcher, atLeast(measurements.size())).getName();
- final List actual = service.fetchMeasurementsFor(contextName, MATCHER_PREFIX, countdown);
- Collections.sort(actual);
- final List expected = measurements.stream()
- .sorted()
- .map(RmiStageTimeMeasurement::new)
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expected, actual);
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testGetSnapshotShouldCountAndGroupMeasurementWhenCalled(
- final List measurements) throws RemoteException {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- final Registry registry = RmiServiceProvider.lookupRegistry(port);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final RmiBackedStageStatisticsCollector underTestCountdown =
- new RmiBackedStageStatisticsCollector(contextName, matcher, registry, true);
- final RmiBackedStageStatisticsCollector underTestMission =
- new RmiBackedStageStatisticsCollector(contextName, matcher, registry, false);
- for (final StageTimeMeasurement m : measurements) {
- final boolean countdown = m.getTestCaseId().equals(CLASS_ONLY);
- service.insertStageTimeMeasurement(contextName, MATCHER_PREFIX, countdown, new RmiStageTimeMeasurement(m));
- }
-
- //when
- final StageStatisticsSnapshot actualCountdown = underTestCountdown.getSnapshot();
- final StageStatisticsSnapshot actualMission = underTestMission.getSnapshot();
-
- //then
- verify(matcher, atLeastOnce()).getName();
- assertSnapshotCountersMatch(measurements, actualCountdown, actualMission);
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testFetchAllShouldReturnAllSavedMeasurementsInTheRightOrderWhenCalled(
- final List measurements) throws RemoteException {
- //given
- final boolean countdown = false;
- final Registry registry = RmiServiceProvider.lookupRegistry(port);
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER_PREFIX);
- final RmiBackedStageStatisticsCollector underTest =
- new RmiBackedStageStatisticsCollector(contextName, matcher, registry, countdown);
- for (final StageTimeMeasurement m : measurements) {
- service.insertStageTimeMeasurement(contextName, MATCHER_PREFIX, countdown, new RmiStageTimeMeasurement(m));
- }
-
- //when
- final List actual = underTest.doFetchAll(contextName, matcher, countdown);
-
- //then
- verify(matcher, atLeastOnce()).getName();
- Assertions.assertIterableEquals(measurements.stream()
- .sorted()
- .collect(Collectors.toList()), actual);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorTest.java
deleted file mode 100644
index 7e45fdb1..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiBackedStageStatisticsCollectorTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher;
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import com.github.nagyesta.abortmission.strongback.base.StrongbackException;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServerConstants;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.mockito.InOrder;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.util.UUID;
-
-import static org.mockito.Mockito.*;
-
-@Tag("unit")
-class RmiBackedStageStatisticsCollectorTest {
-
- private static final String CONTEXT = "context";
- private static final String MATCHER = "matcher";
- private static final StageTimeMeasurement ABORTED = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.randomUUID())
- .setTestClassId("testClassId")
- .setTestCaseId("testCaseId")
- .setResult(StageResult.ABORT)
- .setStart(0)
- .setEnd(1)
- .build();
-
- @Test
- void testDoGetSnapshotShouldThrowStrongbackExceptionWhenCaughtException() throws Exception {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final LaunchStatisticsService service = mock(LaunchStatisticsService.class);
- when(service.getSnapshot(anyString(), anyString(), anyBoolean())).thenThrow(new RemoteException());
- final Registry registry = mock(Registry.class);
- when(registry.lookup(eq(RmiServerConstants.SERVICE_NAME))).thenReturn(service);
-
- final RmiBackedStageStatisticsCollector underTest = new RmiBackedStageStatisticsCollector(CONTEXT, matcher, registry, true);
-
- //when
- Assertions.assertThrows(StrongbackException.class, () -> underTest.doGetSnapshot(CONTEXT, matcher, true));
-
- //then + exception
- final InOrder inOrder = inOrder(registry, service, matcher);
- inOrder.verify(registry).lookup(eq(RmiServerConstants.SERVICE_NAME));
- inOrder.verify(service).getSnapshot(eq(CONTEXT), eq(MATCHER), eq(true));
- inOrder.verifyNoMoreInteractions();
- }
-
- @Test
- void testDoFetchAllShouldThrowStrongbackExceptionWhenCaughtException() throws Exception {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final LaunchStatisticsService service = mock(LaunchStatisticsService.class);
- when(service.fetchMeasurementsFor(anyString(), anyString(), anyBoolean())).thenThrow(new RemoteException());
- final Registry registry = mock(Registry.class);
- when(registry.lookup(eq(RmiServerConstants.SERVICE_NAME))).thenReturn(service);
-
- final RmiBackedStageStatisticsCollector underTest = new RmiBackedStageStatisticsCollector(CONTEXT, matcher, registry, true);
-
- //when
- Assertions.assertThrows(StrongbackException.class, () -> underTest.doFetchAll(CONTEXT, matcher, true));
-
- //then + exception
- final InOrder inOrder = inOrder(registry, service, matcher);
- inOrder.verify(registry).lookup(eq(RmiServerConstants.SERVICE_NAME));
- inOrder.verify(service).fetchMeasurementsFor(eq(CONTEXT), eq(MATCHER), eq(true));
- inOrder.verifyNoMoreInteractions();
- }
-
- @Test
- void testDoLogTimeMeasurementShouldThrowStrongbackExceptionWhenCaughtException() throws Exception {
- //given
- final MissionHealthCheckMatcher matcher = mock(MissionHealthCheckMatcher.class);
- when(matcher.getName()).thenReturn(MATCHER);
- final LaunchStatisticsService service = mock(LaunchStatisticsService.class);
- doThrow(new RemoteException())
- .when(service).insertStageTimeMeasurement(anyString(), anyString(), anyBoolean(), any(RmiStageTimeMeasurement.class));
- final Registry registry = mock(Registry.class);
- when(registry.lookup(eq(RmiServerConstants.SERVICE_NAME))).thenReturn(service);
-
- final RmiBackedStageStatisticsCollector underTest = new RmiBackedStageStatisticsCollector(CONTEXT, matcher, registry, true);
-
- //when
- Assertions.assertThrows(StrongbackException.class, () ->
- underTest.doLogTimeMeasurement(CONTEXT, matcher, true, ABORTED));
-
- //then + exception
- final InOrder inOrder = inOrder(registry, service, matcher);
- inOrder.verify(registry).lookup(eq(RmiServerConstants.SERVICE_NAME));
- inOrder.verify(service).insertStageTimeMeasurement(eq(CONTEXT), eq(MATCHER), eq(true), any(RmiStageTimeMeasurement.class));
- inOrder.verifyNoMoreInteractions();
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshotTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshotTest.java
deleted file mode 100644
index 402666e2..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageStatisticsSnapshotTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.stream.Stream;
-
-@Tag("unit")
-class RmiStageStatisticsSnapshotTest {
-
- private static final RmiStageStatisticsSnapshot ALL_ZERO = new RmiStageStatisticsSnapshot(0, 0, 0, 0);
- private static final RmiStageStatisticsSnapshot ONE_FAIL = new RmiStageStatisticsSnapshot(1, 0, 0, 0);
- private static final RmiStageStatisticsSnapshot ONE_SUCCESS = new RmiStageStatisticsSnapshot(0, 1, 0, 0);
- private static final RmiStageStatisticsSnapshot ONE_ABORT = new RmiStageStatisticsSnapshot(0, 0, 1, 0);
- private static final RmiStageStatisticsSnapshot ONE_SUPPRESS = new RmiStageStatisticsSnapshot(0, 0, 0, 1);
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream statsProvider() {
- return Stream.builder()
- .add(Arguments.of(0, 0, 0, 0))
- .add(Arguments.of(0, 0, 0, 1))
- .add(Arguments.of(0, 0, 1, 0))
- .add(Arguments.of(0, 1, 0, 0))
- .add(Arguments.of(1, 0, 0, 0))
- .add(Arguments.of(1, 2, 3, 4))
- .add(Arguments.of(4, 3, 2, 1))
- .build();
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream equalsProvider() {
- return Stream.builder()
- .add(Arguments.of(ALL_ZERO, ALL_ZERO, true))
- .add(Arguments.of(ONE_FAIL, ALL_ZERO, false))
- .add(Arguments.of(ONE_SUCCESS, ALL_ZERO, false))
- .add(Arguments.of(ONE_ABORT, ALL_ZERO, false))
- .add(Arguments.of(ONE_SUPPRESS, ALL_ZERO, false))
- .add(Arguments.of(ALL_ZERO, ONE_FAIL, false))
- .add(Arguments.of(ALL_ZERO, ONE_SUCCESS, false))
- .add(Arguments.of(ALL_ZERO, ONE_ABORT, false))
- .add(Arguments.of(ALL_ZERO, ONE_SUPPRESS, false))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("statsProvider")
- void testConvertToStageStatisticsSnapshotShouldConvertAllValuableFieldsWhenCalled(
- final int failed, final int succeeded, final int aborted, final int suppressed) {
- //given
- final RmiStageStatisticsSnapshot underTest = new RmiStageStatisticsSnapshot(failed, succeeded, aborted, suppressed);
-
- //when
- final StageStatisticsSnapshot actual = underTest.toStageStatisticsSnapshot();
-
- //then
- Assertions.assertEquals(failed, actual.getFailed());
- Assertions.assertEquals(succeeded, actual.getSucceeded());
- Assertions.assertEquals(aborted, actual.getAborted());
- Assertions.assertEquals(suppressed, actual.getSuppressed());
- }
-
- @ParameterizedTest
- @MethodSource("statsProvider")
- @SuppressWarnings("LocalCanBeFinal")
- void testSerializationShouldRetainValuesAsIsWhenCalled(
- final int failed, final int succeeded, final int aborted, final int suppressed) throws Exception {
- //given
- final RmiStageStatisticsSnapshot underTest = new RmiStageStatisticsSnapshot();
- underTest.setAborted(aborted);
- underTest.setFailed(failed);
- underTest.setSucceeded(succeeded);
- underTest.setSuppressed(suppressed);
-
- try (PipedInputStream pipedInputStream = new PipedInputStream();
- PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
- ObjectOutputStream outputStream = new ObjectOutputStream(pipedOutputStream);
- ObjectInputStream inputStream = new ObjectInputStream(pipedInputStream)) {
-
- //when
- outputStream.writeObject(underTest);
- final Object actual = inputStream.readObject();
-
- //then
- Assertions.assertTrue(actual instanceof RmiStageStatisticsSnapshot);
- Assertions.assertEquals(underTest, actual);
- }
- }
-
- @ParameterizedTest
- @MethodSource("equalsProvider")
- void testEqualsAndHashCodeShouldBehaveProperlyWhenCalled(
- final RmiStageStatisticsSnapshot a, final RmiStageStatisticsSnapshot b, final boolean equal) {
- //given
-
- //when
- final boolean actualEquals = a.equals(b);
- final int hashA = a.hashCode();
- final int hashB = b.hashCode();
-
- //then
- Assertions.assertEquals(equal, actualEquals);
- Assertions.assertEquals(hashA == hashB, equal);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurementTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurementTest.java
deleted file mode 100644
index c8a906d4..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/stats/RmiStageTimeMeasurementTest.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.stats;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageResult;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurementBuilder;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.util.List;
-import java.util.UUID;
-import java.util.stream.Stream;
-
-@Tag("unit")
-@SuppressWarnings("checkstyle:MagicNumber")
-class RmiStageTimeMeasurementTest {
-
- private static final StageTimeMeasurement ABORTED = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.randomUUID())
- .setTestClassId("testClassId")
- .setTestCaseId("testCaseId")
- .setResult(StageResult.ABORT)
- .setStart(0)
- .setEnd(1)
- .build();
- private static final StageTimeMeasurement FAILED = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345be"))
- .setTestClassId(StageTimeMeasurement.class.getSimpleName())
- .setTestCaseId(StageTimeMeasurement.CLASS_ONLY)
- .setResult(StageResult.FAILURE)
- .setStart(10)
- .setEnd(21)
- .build();
- private static final StageTimeMeasurement FAILED_2 = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345be"))
- .setTestClassId(StageTimeMeasurement.class.getSimpleName())
- .setTestCaseId(StageTimeMeasurement.CLASS_ONLY)
- .setResult(StageResult.FAILURE)
- .setStart(10)
- .setEnd(22)
- .build();
- private static final StageTimeMeasurement SUPPRESSED = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUPPRESSED)
- .setStart(40)
- .setEnd(42)
- .build();
- private static final StageTimeMeasurement SUPPRESSED_2 = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUPPRESSED)
- .setStart(41)
- .setEnd(42)
- .build();
- private static final StageTimeMeasurement SUPPRESSED_3 = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class-2")
- .setTestCaseId("method")
- .setResult(StageResult.SUPPRESSED)
- .setStart(41)
- .setEnd(42)
- .build();
- private static final StageTimeMeasurement SUPPRESSED_4 = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method-2")
- .setResult(StageResult.SUPPRESSED)
- .setStart(41)
- .setEnd(42)
- .build();
- private static final StageTimeMeasurement SUCCESS = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUCCESS)
- .setStart(41)
- .setEnd(42)
- .setThreadName("main")
- .build();
-
- private static final StageTimeMeasurement SUCCESS_NEW_THREAD = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUCCESS)
- .setStart(41)
- .setEnd(42)
- .setThreadName("thread")
- .build();
-
- private static final StageTimeMeasurement SUCCESS_EMPTY_STACK = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUCCESS)
- .setStart(41)
- .setEnd(42)
- .setThreadName("main")
- .setStackTrace(List.of())
- .build();
-
- private static final StageTimeMeasurement SUCCESS_EXCEPTION = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUCCESS)
- .setStart(41)
- .setEnd(42)
- .setThreadName("main")
- .setThrowableClass("java.lang.RuntimeException")
- .build();
-
- private static final StageTimeMeasurement SUCCESS_MESSAGE = StageTimeMeasurementBuilder.builder()
- .setLaunchId(UUID.fromString("fa79f083-0a5c-4454-9bc3-c886f6c345bf"))
- .setTestClassId("class")
- .setTestCaseId("method")
- .setResult(StageResult.SUCCESS)
- .setStart(41)
- .setEnd(42)
- .setThreadName("main")
- .setThrowableMessage("message")
- .build();
-
- private static Stream measurementProvider() {
- return Stream.builder()
- .add(ABORTED)
- .add(FAILED)
- .add(SUPPRESSED)
- .build()
- .map(Arguments::of);
- }
-
- private static Stream equalsProvider() {
- return Stream.builder()
- .add(Arguments.of(new RmiStageTimeMeasurement(ABORTED), new RmiStageTimeMeasurement(ABORTED), true))
- .add(Arguments.of(new RmiStageTimeMeasurement(FAILED), new RmiStageTimeMeasurement(ABORTED), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(FAILED), new RmiStageTimeMeasurement(FAILED_2), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED), new RmiStageTimeMeasurement(SUPPRESSED_2), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED_3), new RmiStageTimeMeasurement(SUPPRESSED_2), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED_2), new RmiStageTimeMeasurement(SUPPRESSED_4), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED_2), new RmiStageTimeMeasurement(SUCCESS), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(ABORTED), new RmiStageTimeMeasurement(SUPPRESSED), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED), new RmiStageTimeMeasurement(FAILED), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUPPRESSED), new RmiStageTimeMeasurement(ABORTED), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUCCESS), new RmiStageTimeMeasurement(SUCCESS_EMPTY_STACK), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUCCESS), new RmiStageTimeMeasurement(SUCCESS_EXCEPTION), false))
- .add(Arguments.of(new RmiStageTimeMeasurement(SUCCESS), new RmiStageTimeMeasurement(SUCCESS_MESSAGE), false))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- void testConvertToStageTimeMeasurementShouldConvertAllValuableFieldsWhenCalled(
- final StageTimeMeasurement expected) {
- //given
- final RmiStageTimeMeasurement underTest = new RmiStageTimeMeasurement(expected);
-
- //when
- final StageTimeMeasurement actual = underTest.toStageTimeMeasurement();
-
- //then
- Assertions.assertEquals(expected, actual);
- }
-
- @ParameterizedTest
- @MethodSource("measurementProvider")
- @SuppressWarnings("LocalCanBeFinal")
- void testSerializationShouldRetainValuesAsIsWhenCalled(
- final StageTimeMeasurement input) throws Exception {
- //given
- final RmiStageTimeMeasurement underTest = new RmiStageTimeMeasurement();
- underTest.setStart(input.getStart());
- underTest.setEnd(input.getEnd());
- underTest.setTestCaseId(input.getTestCaseId());
- underTest.setTestClassId(input.getTestClassId());
- underTest.setResult(input.getResult());
- underTest.setLaunchId(input.getLaunchId());
- underTest.setDisplayName(input.getDisplayName());
- underTest.setThreadName(input.getThreadName());
- underTest.setStackTrace(input.getStackTrace());
- underTest.setThrowableClass(input.getThrowableClass());
- underTest.setThrowableMessage(input.getThrowableMessage());
-
- try (PipedInputStream pipedInputStream = new PipedInputStream();
- PipedOutputStream pipedOutputStream = new PipedOutputStream(pipedInputStream);
- ObjectOutputStream outputStream = new ObjectOutputStream(pipedOutputStream);
- ObjectInputStream inputStream = new ObjectInputStream(pipedInputStream)) {
-
- //when
- outputStream.writeObject(underTest);
- final Object actual = inputStream.readObject();
-
- //then
- Assertions.assertTrue(actual instanceof RmiStageTimeMeasurement);
- Assertions.assertEquals(underTest, actual);
- }
- }
-
- @ParameterizedTest
- @MethodSource("equalsProvider")
- void testEqualsAndHashCodeShouldBehaveProperlyWhenCalled(
- final RmiStageTimeMeasurement a, final RmiStageTimeMeasurement b, final boolean equal) {
- //given
-
- //when
- final boolean actualEquals = a.equals(b);
- final int hashA = a.hashCode();
- final int hashB = b.hashCode();
-
- //then
- Assertions.assertEquals(equal, actualEquals);
- Assertions.assertEquals(hashA == hashB, equal);
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSourceIntegrationTest.java b/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSourceIntegrationTest.java
deleted file mode 100644
index 2f39291e..00000000
--- a/strongback/strongback-rmi-supplier/src/test/java/com/github/nagyesta/abortmission/strongback/rmi/telemetry/RmiBackedLaunchTelemetryDataSourceIntegrationTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.github.nagyesta.abortmission.strongback.rmi.telemetry;
-
-import com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement;
-import com.github.nagyesta.abortmission.core.telemetry.stats.ClassTelemetry;
-import com.github.nagyesta.abortmission.core.telemetry.stats.StageLaunchStats;
-import com.github.nagyesta.abortmission.core.telemetry.stats.TestRunTelemetry;
-import com.github.nagyesta.abortmission.strongback.rmi.server.RmiServiceProvider;
-import com.github.nagyesta.abortmission.strongback.rmi.service.AbstractInMemoryDataSourceIntegrationTest;
-import com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService;
-import com.github.nagyesta.abortmission.strongback.rmi.stats.RmiStageTimeMeasurement;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import java.rmi.RemoteException;
-import java.rmi.registry.Registry;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-
-import static com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement.CLASS_ONLY;
-
-@Tag("integration")
-@Execution(ExecutionMode.SAME_THREAD)
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-class RmiBackedLaunchTelemetryDataSourceIntegrationTest extends AbstractInMemoryDataSourceIntegrationTest {
-
- @SuppressWarnings("checkstyle:MagicNumber")
- RmiBackedLaunchTelemetryDataSourceIntegrationTest() {
- super("telemetry", 29877);
- }
-
- @SuppressWarnings("checkstyle:MagicNumber")
- private static Stream noCollisionInsertDataProvider() {
- return Stream.builder()
- .add(Arguments.of(mapFromStream(IntStream.of(0).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.of(1, 3, 42).boxed())))
- .add(Arguments.of(mapFromStream(IntStream.rangeClosed(0, 30).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(9).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.of(1, 3).boxed())))
- .add(Arguments.of(mapFromMultiStream(IntStream.rangeClosed(2, 5).boxed())))
- .build();
- }
-
- @ParameterizedTest
- @MethodSource("noCollisionInsertDataProvider")
- void testFetchClassStatisticsShouldFetchStatisticsGroupedByClassWhenCalled(
- final Map> input) throws RemoteException {
- //given
- final Registry registry = RmiServiceProvider.lookupRegistry(port);
- insertAll(input);
- final RmiBackedLaunchTelemetryDataSource underTest = new RmiBackedLaunchTelemetryDataSource(registry);
-
- //when
- final SortedMap actual = underTest.fetchClassStatistics();
-
- //then
- final Map actualLaunchStatsMap = toLaunches(actual);
- final Set actualMethods = new TreeSet<>(actualLaunchStatsMap.keySet());
- final List allMeasurements = fetchAllMeasurements();
- final List expectedMethods = mapToMethodNames(allMeasurements);
- Assertions.assertIterableEquals(expectedMethods, actualMethods);
-
- expectedMethods.forEach(method -> {
- final StageLaunchStats actualLaunch = actualLaunchStatsMap.get(method);
- final List expectedMeasurements = allMeasurements.stream()
- .filter(s -> s.getTestCaseId().equals(method))
- .map(TestRunTelemetry::new)
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expectedMeasurements, actualLaunch.getTimeMeasurements());
- });
-
- final StageLaunchStats actualCountdown = toCountdown(actual);
- final List expectedCountdowns = allMeasurements.stream()
- .filter(s -> s.getTestCaseId().equals(CLASS_ONLY))
- .map(TestRunTelemetry::new)
- .sorted()
- .collect(Collectors.toList());
- Assertions.assertIterableEquals(expectedCountdowns, actualCountdown.getTimeMeasurements());
- }
-
- private Map toLaunches(final SortedMap actual) {
- return actual.get(AbstractInMemoryDataSourceIntegrationTest.CLASS_NAME)
- .getLaunches();
- }
-
- private StageLaunchStats toCountdown(final SortedMap actual) {
- return actual.get(AbstractInMemoryDataSourceIntegrationTest.CLASS_NAME)
- .getCountdown();
- }
-
- private List mapToMethodNames(final List allMeasurements) {
- return allMeasurements.stream()
- .map(StageTimeMeasurement::getTestCaseId)
- .filter(s -> !CLASS_ONLY.equals(s))
- .distinct()
- .sorted()
- .collect(Collectors.toList());
- }
-
- private List fetchAllMeasurements() throws RemoteException {
- final List list = new ArrayList<>();
- final LaunchStatisticsService serviceOuter = service;
- for (final String s : service.fetchAllMatcherNames()) {
- final List rmiStageTimeMeasurements = serviceOuter.fetchAllMeasurementsForMatcher(s);
- for (final RmiStageTimeMeasurement rmiStageTimeMeasurement : rmiStageTimeMeasurements) {
- final StageTimeMeasurement toStageTimeMeasurement = rmiStageTimeMeasurement.toStageTimeMeasurement();
- list.add(toStageTimeMeasurement);
- }
- }
- return list;
- }
-}
diff --git a/strongback/strongback-rmi-supplier/src/test/resources/.gitkeep b/strongback/strongback-rmi-supplier/src/test/resources/.gitkeep
deleted file mode 100644
index e69de29b..00000000