Silence engine startup and shutdown messages in tests
All checks were successful
build-and-test / test (push) Successful in 1m24s
build-and-test / build (push) Successful in 1m35s
build-and-test / generate-javadoc (push) Successful in 1m45s

This commit is contained in:
JeremyStar™ 2024-09-01 19:01:44 +02:00
parent 889d106470
commit d4c8494b34
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -20,7 +20,9 @@
package de.staropensource.sosengine.base.srctests; package de.staropensource.sosengine.base.srctests;
import de.staropensource.sosengine.base.Engine; import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.EngineInternals; import de.staropensource.sosengine.base.EngineInternals;
import de.staropensource.sosengine.base.type.InternalAccessArea;
import de.staropensource.sosengine.unittest.UnitLogger; import de.staropensource.sosengine.unittest.UnitLogger;
import lombok.Getter; import lombok.Getter;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
@ -94,9 +96,13 @@ public class TestBase {
*/ */
@BeforeEach @BeforeEach
void initializeEngine() { void initializeEngine() {
if (doInitialization && Engine.getInstance() == null) { if (Engine.getInstance() == null && doInitialization) {
logger.diag("Initializing engine");
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
new Engine(); new Engine();
EngineConfiguration.getInstance().loadDefaultConfiguration();
EngineInternals.getInstance().setShutdownHandler(exitCode -> {}); EngineInternals.getInstance().setShutdownHandler(exitCode -> {});
EngineInternals.getInstance().restrictAccess(InternalAccessArea.SHUTDOWN_HANDLER_UPDATE);
} }
} }
@ -105,7 +111,10 @@ public class TestBase {
*/ */
@AfterAll @AfterAll
static void shutdownEngine() { static void shutdownEngine() {
if (Engine.getInstance() != null) if (Engine.getInstance() != null) {
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
EngineConfiguration.getInstance().loadConfiguration();
Engine.getInstance().shutdown(); Engine.getInstance().shutdown();
} }
} }
}