@Test public void testAppendFailure() { appender.start(); // make sure the append method does not work appender.topicPublisher = null; ILoggingEvent le = createLoggingEvent(); for (int i = 1; i <= 3; i++) { appender.append(le); assertEquals(i, context.getStatusManager().getCount()); assertTrue(appender.isStarted()); } appender.append(le); assertEquals(4, context.getStatusManager().getCount()); assertFalse(appender.isStarted()); }
@Test public void testStartFails() { appender.topicBindingName = null; appender.start(); assertFalse(appender.isStarted()); }
@Test public void testStartUserPass() { appender.setUserName("test"); appender.setPassword("test"); appender.start(); assertTrue(appender.isStarted()); try { assertEquals(appender.topicBindingName, appender.topicPublisher.getTopic().getTopicName()); } catch (Exception e) { fail(); } }
@Test public void testStartMinimalInfo() { // let's leave only what's in the setup() // method, minus the providerURL appender.setProviderURL(null); appender.start(); assertTrue(appender.isStarted()); try { assertEquals(appender.topicBindingName, appender.topicPublisher.getTopic().getTopicName()); } catch (Exception e) { fail(); } }