@AfterClass public static void cleanupClass() { System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); StatusLogger.getLogger().reset(); final File file = new File(STATUS_LOG); file.delete(); }
@BeforeClass public static void setupClass() { try { Class.forName("java.io.ObjectInputFilter"); useObjectInputStream = true; } catch (ClassNotFoundException ex) { // Ignore the exception } ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(configFactory); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@Test public void testNoProps() { System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY, CONFIG); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); final Configuration config = ctx.getConfiguration(); assertTrue("Configuration is not an XmlConfiguration", config instanceof XmlConfiguration); }
@BeforeClass public static void setupClass() { ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@AfterClass public static void cleanupClass() { System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); StatusLogger.getLogger().reset(); }
@AfterClass public static void cleanupClass() { System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); StatusLogger.getLogger().reset(); }
@After public void cleanup() { final LoggerContext ctx = LoggerContext.getContext(false); ctx.reconfigure(); StatusLogger.getLogger().reset(); }
@BeforeClass public static void setupClass() { ThreadContext.clearAll(); ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { ThreadContext.clearAll(); ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@BeforeClass public static void setupClass() { StatusLogger.getLogger().setLevel(Level.OFF); ConfigurationFactory.setConfigurationFactory(cf); final LoggerContext ctx = LoggerContext.getContext(); ctx.reconfigure(); }
@Test public void testAdvertisementsRemovedOnConfigStop() { verifyExpectedEntriesAdvertised(InMemoryAdvertiser.getAdvertisedEntries()); final LoggerContext ctx = LoggerContext.getContext(); ctx.stop(); final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries(); assertTrue("Entries found: " + entries, entries.isEmpty()); //reconfigure for subsequent testing ctx.start(); }
/** * Tests that you can add an output stream appender dynamically. */ private void addAppender(final OutputStream outputStream, final String outputStreamName) { final LoggerContext context = LoggerContext.getContext(false); final Configuration config = context.getConfiguration(); final PatternLayout layout = PatternLayout.createDefaultLayout(config); final Appender appender = OutputStreamAppender.createAppender(layout, null, outputStream, outputStreamName, false, true); appender.start(); config.addAppender(appender); ConfigurationTestUtils.updateLoggers(appender, config); }
private void addAppender(final Writer writer, final String writerName) { final LoggerContext context = LoggerContext.getContext(false); final Configuration config = context.getConfiguration(); final PatternLayout layout = PatternLayout.createDefaultLayout(config); final Appender appender = WriterAppender.createAppender(layout, null, writer, writerName, false, true); appender.start(); config.addAppender(appender); ConfigurationTestUtils.updateLoggers(appender, config); }
@Test public void testAdvertisementsAddedOnReconfigAfterStop() { verifyExpectedEntriesAdvertised(InMemoryAdvertiser.getAdvertisedEntries()); final LoggerContext ctx = LoggerContext.getContext(); ctx.stop(); final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries(); assertTrue("Entries found: " + entries, entries.isEmpty()); ctx.start(); verifyExpectedEntriesAdvertised(InMemoryAdvertiser.getAdvertisedEntries()); } }
@BeforeClass public static void setupClass() throws Exception { tcpServer = new TcpSocketTestServer(PORT); tcpServer.start(); udpServer = new UdpSocketTestServer(); udpServer.start(); LoggerContext.getContext().reconfigure(); ThreadContext.clearAll(); }