All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tracee.SimpleTraceeBackend Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
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