コード例 #1
0
  @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());
  }
コード例 #2
0
  @Test
  public void testStartFails() {
    appender.topicBindingName = null;

    appender.start();

    assertFalse(appender.isStarted());
  }
コード例 #3
0
  @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();
    }
  }
コード例 #4
0
  @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();
    }
  }