diff options
author | Thomas <> | 2022-01-09 16:54:19 +0100 |
---|---|---|
committer | Thomas <> | 2022-01-09 16:54:19 +0100 |
commit | b5980663a63b3c128a8714fe7c13339eaa0a2955 (patch) | |
tree | 1925491265aa19dcdb221be6ae05fdb4d700e533 /eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth | |
parent | e3639ef805f1e525415c43cbda80ed71cc43a70c (diff) | |
download | EAAF-Components-b5980663a63b3c128a8714fe7c13339eaa0a2955.tar.gz EAAF-Components-b5980663a63b3c128a8714fe7c13339eaa0a2955.tar.bz2 EAAF-Components-b5980663a63b3c128a8714fe7c13339eaa0a2955.zip |
fix(core): change validation of loaded process-definitions to fix problem of circular-dependencies loading
Diffstat (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth')
-rw-r--r-- | eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/logging/MemoryLoggingAppender.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/logging/MemoryLoggingAppender.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/logging/MemoryLoggingAppender.java new file mode 100644 index 00000000..2b885d59 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/logging/MemoryLoggingAppender.java @@ -0,0 +1,56 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth.logging; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.read.ListAppender; + +/** + * In-Memory Logging-Appender to check log messages. + * + * @author tlenz + * + */ +public class MemoryLoggingAppender extends ListAppender<ILoggingEvent> { + + public void reset() { + this.list.clear(); + } + + public boolean contains(String string, Level level) { + return this.list.stream() + .anyMatch(event -> event.getMessage().toString().contains(string) + && event.getLevel().equals(level)); + } + + public int countEventsForLogger(String loggerName) { + return (int) this.list.stream() + .filter(event -> event.getLoggerName().contains(loggerName)) + .count(); + } + + public List<ILoggingEvent> search(String string) { + return this.list.stream() + .filter(event -> event.getMessage().toString().contains(string)) + .collect(Collectors.toList()); + } + + public List<ILoggingEvent> search(String string, Level level) { + return this.list.stream() + .filter(event -> event.getMessage().toString().contains(string) + && event.getLevel().equals(level)) + .collect(Collectors.toList()); + } + + public int getSize() { + return this.list.size(); + } + + public List<ILoggingEvent> getLoggedEvents() { + return Collections.unmodifiableList(this.list); + } + +} |