Silence engine startup and shutdown messages in tests
This commit is contained in:
parent
889d106470
commit
d4c8494b34
1 changed files with 11 additions and 2 deletions
|
@ -20,7 +20,9 @@
|
|||
package de.staropensource.sosengine.base.srctests;
|
||||
|
||||
import de.staropensource.sosengine.base.Engine;
|
||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||
import de.staropensource.sosengine.base.EngineInternals;
|
||||
import de.staropensource.sosengine.base.type.InternalAccessArea;
|
||||
import de.staropensource.sosengine.unittest.UnitLogger;
|
||||
import lombok.Getter;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
|
@ -94,9 +96,13 @@ public class TestBase {
|
|||
*/
|
||||
@BeforeEach
|
||||
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();
|
||||
EngineConfiguration.getInstance().loadDefaultConfiguration();
|
||||
EngineInternals.getInstance().setShutdownHandler(exitCode -> {});
|
||||
EngineInternals.getInstance().restrictAccess(InternalAccessArea.SHUTDOWN_HANDLER_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +111,10 @@ public class TestBase {
|
|||
*/
|
||||
@AfterAll
|
||||
static void shutdownEngine() {
|
||||
if (Engine.getInstance() != null)
|
||||
if (Engine.getInstance() != null) {
|
||||
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
|
||||
EngineConfiguration.getInstance().loadConfiguration();
|
||||
Engine.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue