@Test public void loadNoFile() { new LoadParams(config, "").commit(); }
source, record.getLoggerName(), LoadParams.convLevelString(record.getLevel()), message, throwable);
private void applyProperties(Properties prop) { Boolean debug = Boolean.parseBoolean(getValue(KEY_DEBUG, DEFAULT_DEBUG, prop)); tx.debug(debug); tx.bootStrapMode(ReactiveAudit.BootStrapMode.valueOf(getValue(KEY_BOOTSTRAP_MODE, DEFAULT_BOOTSTRAP_MODE, prop).toUpperCase())); tx.bootStrapCPUDelay(Long.parseLong(getValue(KEY_BOOTSTRAP_CPUDELAY, DEFAULT_BOOTSTRAP_CPUDELAY, prop))); tx.bootStrapDelay(Long.parseLong(getValue(KEY_BOOTSTRAP_DELAY, DEFAULT_BOOTSTRAP_DELAY, prop))); tx.throwExceptions(Boolean.parseBoolean(getValue(KEY_THROW_EXCEPTIONS, DEFAULT_THROW_EXCEPTIONS, prop))); tx.latencyFile(getValue(KEY_FILE_LATENCY, DEFAULT_FILE_LATENCY, prop)); tx.latencyNetwork(getValue(KEY_NETWORK_LATENCY, DEFAULT_NETWORK_LATENCY, prop)); tx.latencyCPU(getValue(KEY_CPU_LATENCY, DEFAULT_CPU_LATENCY, prop)); tx.logOutput(getValue(KEY_LOG_OUTPUT, DEFAULT_LOG_OUTPUT, prop), getValue(KEY_LOG_FORMAT, DEFAULT_LOG_FORMAT, prop), getValue(KEY_LOG_SIZE, DEFAULT_LOG_SIZE, prop)); String threadPattern = getValue(KEY_THREAD_PATTERN, DEFAULT_THREAD_PATTERN, prop); if (threadPattern.length() == 0) // Empty is not allowed threadPattern = "(^.*$)"; tx.threadPattern(threadPattern); tx.commit(); }
@Test public void variableProperties() { LoadParams.resetAllEnv(); String url = getClass().getResource("/testEnv.properties").toExternalForm(); ReactiveAudit.config.incSuppress(); try { new LoadParams(config, url).commit(); assertEquals(config.getThreadPattern(), System.getProperty("os.name")); } finally { ReactiveAudit.config.decSuppress(); } }
prop.putAll(getAllEnv()); applyProperties(new VariablesProperties(prop));
LoadParams.resetAllEnv(); for (Handler h : config.logger.getHandlers()) try new LoadParams(config, "XXX").commit();
LoadParams.resetAllEnv(); System.setProperty(KEY_LOG_OUTPUT, "console"); System.setProperty(KEY_LOG_FORMAT, "format"); System.setProperty(KEY_BOOTSTRAP_DELAY, "10"); System.setProperty(KEY_BOOTSTRAP_MODE, "annotation"); new LoadParams(ReactiveAudit.config, null).commit(); assertTrue(config.logger.getHandlers()[0] instanceof ConsoleHandler); assertEquals("format", ((AuditLogFormat) config.logger.getHandlers()[0].getFormatter()).getFormat()); System.clearProperty(KEY_BOOTSTRAP_MODE); System.clearProperty(KEY_BOOTSTRAP_DELAY); LoadParams.resetAllEnv();
new LoadParams(this, url).commit(); Handler console = new ConsoleHandler(); console.setLevel(Level.FINE);