Package java.util.logging

Examples of java.util.logging.StreamHandler.publish()


    assertEquals("MockFormatter_Head" + "testPublish_NoFilter"
        + "testPublish_NoFilter", aos.toString());

    r.setLevel(Level.OFF);
    h.setLevel(Level.OFF);
    h.publish(r);
    h.flush();
    assertEquals("MockFormatter_Head" + "testPublish_NoFilter"
        + "testPublish_NoFilter", aos.toString());
  }
View Full Code Here


    StreamHandler h = new StreamHandler(aos, new MockFormatter());
    h.setFilter(new MockFilter());

    LogRecord r = new LogRecord(Level.INFO, "testPublish_WithFilter");
    h.setLevel(Level.INFO);
    h.publish(r);
    h.flush();
    assertEquals("", aos.toString());
    assertSame(r, CallVerificationStack.getInstance().pop());

    h.setLevel(Level.WARNING);
View Full Code Here

    h.flush();
    assertEquals("", aos.toString());
    assertSame(r, CallVerificationStack.getInstance().pop());

    h.setLevel(Level.WARNING);
    h.publish(r);
    h.flush();
    assertEquals("", aos.toString());
    assertTrue(CallVerificationStack.getInstance().empty());

    h.setLevel(Level.CONFIG);
View Full Code Here

    h.flush();
    assertEquals("", aos.toString());
    assertTrue(CallVerificationStack.getInstance().empty());

    h.setLevel(Level.CONFIG);
    h.publish(r);
    h.flush();
    assertEquals("", aos.toString());
    assertSame(r, CallVerificationStack.getInstance().pop());

    r.setLevel(Level.OFF);
View Full Code Here

    assertEquals("", aos.toString());
    assertSame(r, CallVerificationStack.getInstance().pop());

    r.setLevel(Level.OFF);
    h.setLevel(Level.OFF);
    h.publish(r);
    h.flush();
    assertEquals("", aos.toString());
    assertTrue(CallVerificationStack.getInstance().empty());
  }
View Full Code Here

   * handle exceptional case
   */
  public void testPublish_Null() {
    StreamHandler h = new StreamHandler(new ByteArrayOutputStream(),
        new SimpleFormatter());
    h.publish(null);
  }

  /*
   * Test publish(), null log record, without output stream
   */
 
View Full Code Here

  /*
   * Test publish(), null log record, without output stream
   */
  public void testPublish_Null_NoOutputStream() {
    StreamHandler h = new StreamHandler();
    h.publish(null);
    // regression test for Harmony-1279
    MockFilter filter = new MockFilter();
    h.setLevel(Level.FINER);
    h.setFilter(filter);
    LogRecord record = new LogRecord(Level.FINE, "abc");
View Full Code Here

    // regression test for Harmony-1279
    MockFilter filter = new MockFilter();
    h.setLevel(Level.FINER);
    h.setFilter(filter);
    LogRecord record = new LogRecord(Level.FINE, "abc");
    h.publish(record);
    // verify that filter.isLoggable is not called, because there's no
    // associated output stream.
    assertTrue(CallVerificationStack.getInstance().empty());
  }
View Full Code Here

   */
  public void testPublish_EmptyMsg() {
    ByteArrayOutputStream aos = new ByteArrayOutputStream();
    StreamHandler h = new StreamHandler(aos, new MockFormatter());
    LogRecord r = new LogRecord(Level.INFO, "");
    h.publish(r);
    h.flush();
    assertEquals("MockFormatter_Head", aos.toString());
  }

  /*
 
View Full Code Here

   */
  public void testPublish_NullMsg() {
    ByteArrayOutputStream aos = new ByteArrayOutputStream();
    StreamHandler h = new StreamHandler(aos, new MockFormatter());
    LogRecord r = new LogRecord(Level.INFO, null);
    h.publish(r);
    h.flush();
    assertEquals("MockFormatter_Head", aos.toString());
  }

  /*
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.