Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the Extension Version. #207

Merged
merged 9 commits into from
Sep 18, 2024
42 changes: 38 additions & 4 deletions sdccc/src/main/java/com/draeger/medical/sdccc/TestSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
Expand Down Expand Up @@ -684,8 +685,7 @@ public static void main(final String[] args) throws IOException {
EnabledTestConfig.class,
TestParameterConfig.class,
List.of(),
DefaultTestSuiteConfig.DEFAULT_DIRECTORIES,
null);
DefaultTestSuiteConfig.DEFAULT_DIRECTORIES);
}

/**
Expand All @@ -702,6 +702,33 @@ public static CommandLineOptions initialize(final String[] args) {
return new CommandLineOptions(args);
}

/**
* Run the test suite with the given already parsed command line arguments and the
* specified enabled test config constants.
*
* @param cmdLine parsed command line arguments
* @param enabledTestConfigClass class containing test identifier constants
* @param testParameterClass class containing test parameter
* @param sdcTestDirectories directories to search for test cases
* @param defaultConfigModules default configuration modules for extended EnabledTestConfig and TestParameterConfig
*/
public static void runWithArgs(
final CommandLineOptions cmdLine,
final Class<? extends EnabledTestConfig> enabledTestConfigClass,
final Class<? extends TestParameterConfig> testParameterClass,
final List<Module> defaultConfigModules,
final String[] sdcTestDirectories)
throws IOException {
runWithArgs(
cmdLine,
enabledTestConfigClass,
testParameterClass,
defaultConfigModules,
sdcTestDirectories,
null,
null);
}

/**
* Run the test suite with the given already parsed command line arguments and the
* specified enabled test config constants.
Expand All @@ -712,14 +739,18 @@ public static CommandLineOptions initialize(final String[] args) {
* @param sdcTestDirectories directories to search for test cases
* @param defaultConfigModules default configuration modules for extended EnabledTestConfig and TestParameterConfig
* @param overrides abstract module to override test run injector
* @param logInitializationInfos lambda that is called after the logger has been initialized and SDCcc's version
* information has been logged out to give the caller the opportunity to add
* additional information.
*/
public static void runWithArgs(
final CommandLineOptions cmdLine,
final Class<? extends EnabledTestConfig> enabledTestConfigClass,
final Class<? extends TestParameterConfig> testParameterClass,
final List<Module> defaultConfigModules,
final String[] sdcTestDirectories,
@Nullable final AbstractModule overrides)
@Nullable final AbstractModule overrides,
@Nullable final Consumer<Logger> logInitializationInfos)
throws IOException {
// setup logging
final var testRunDir = TestRunConfig.createTestRunDirectory(
Expand Down Expand Up @@ -775,7 +806,10 @@ public static void runWithArgs(
} else {
versionString = "";
}
LOG.info("Starting SDCcc {}", versionString);
LOG.info("Starting SDCcc{}", versionString);
if (logInitializationInfos != null) {
logInitializationInfos.accept(LOG);
}

try {

Expand Down
Loading