io.tracee.SimpleTraceeBackend Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tracee-testhelper Show documentation
Show all versions of tracee-testhelper Show documentation
Please refer to https://github.com/tracee/tracee.
package io.tracee;
import io.tracee.configuration.TraceeFilterConfiguration;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* A testhelper for TraceeBackend dependent tests.
*/
public class SimpleTraceeBackend extends HashMap implements TraceeBackend {
private Map valuesBeforeLastClear = Collections.emptyMap();
public static SimpleTraceeBackend createNonLoggingAllPermittingBackend() {
return new SimpleTraceeBackend(new PermitAllTraceeFilterConfiguration(), new NoopTraceeLoggerFactory());
}
public SimpleTraceeBackend(TraceeFilterConfiguration configuration, TraceeLoggerFactory loggerFactory) {
this.configuration = configuration;
this.loggerFactory = loggerFactory;
}
private final TraceeFilterConfiguration configuration;
private final TraceeLoggerFactory loggerFactory;
/**
* {@inheritDoc}
*
This implementation ignores profiles and always uses the default configuration.
*/
@Override
public TraceeFilterConfiguration getConfiguration(String profileName) {
return configuration;
}
@Override
public TraceeFilterConfiguration getConfiguration() {
return configuration;
}
@Override
public TraceeLoggerFactory getLoggerFactory() {
return loggerFactory;
}
@Override
public void clear() {
this.valuesBeforeLastClear = new HashMap(this);
super.clear();
}
public Map getValuesBeforeLastClear() {
return valuesBeforeLastClear;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy