Java Code Examples for java.util.logging.LogRecord#getSequenceNumber()

The following examples show how to use java.util.logging.LogRecord#getSequenceNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputGestureTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testReadAToolbar() throws Exception {
    InputStream is = getClass().getResourceAsStream("NB_PROF634066243");
    SortedMap<Integer,InputGesture> expectedGestures = new TreeMap<Integer,InputGesture>();
    expectedGestures.put(62, InputGesture.TOOLBAR);
    expectedGestures.put(63, InputGesture.MENU);
    TestHandler records = new TestHandler(is);
    for (int cnt = 0;; cnt++) {
        LOG.log(Level.INFO, "Reading {0}th record", cnt);
        LogRecord r = records.read();
        if (r == null) {
            break;
        }
        if (r.getSequenceNumber() > expectedGestures.lastKey()) {
            break;
        }
        LOG.log(Level.INFO, "Read {0}th record, seq {1}", new Object[] { cnt, r.getSequenceNumber() });

        InputGesture g = InputGesture.valueOf(r);
        InputGesture exp = expectedGestures.get((int)r.getSequenceNumber());
        assertEquals(cnt + ": For: " + r.getSequenceNumber() + " txt:\n`"+ r.getMessage() +
            "\nkey: " + r.getResourceBundleName()
            , exp, g);
    }
    is.close();
}
 
Example 2
Source File: LogRecords.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void publish(LogRecord record) {
    long sn = record.getSequenceNumber();
    if (afterLast) {
        if (sn <= lastNumber) {
            return ;
        } else {
            afterLast = false;
        }
    }
    lastNumber = sn;
    hd.publish(record);
}
 
Example 3
Source File: InputGestureTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testReadALogAndTestInputGestures() throws Exception {
    InputStream is = getClass().getResourceAsStream("NB1216449736.0");
    SortedMap<Integer,InputGesture> expectedGestures = new TreeMap<Integer,InputGesture>();
    expectedGestures.put(35, InputGesture.MENU);
    expectedGestures.put(59, InputGesture.KEYBOARD);
    expectedGestures.put(66, InputGesture.MENU);
    expectedGestures.put(80, InputGesture.MENU);
    expectedGestures.put(81, InputGesture.MENU);
    expectedGestures.put(177, InputGesture.KEYBOARD);
    expectedGestures.put(197, InputGesture.KEYBOARD);
    expectedGestures.put(205, InputGesture.MENU);
    TestHandler records = new TestHandler(is);
    for (int cnt = 0;; cnt++) {
        LOG.log(Level.INFO, "Reading {0}th record", cnt);
        LogRecord r = records.read();
        if (r == null) {
            break;
        }
        if (r.getSequenceNumber() > expectedGestures.lastKey()) {
            break;
        }
        LOG.log(Level.INFO, "Read {0}th record, seq {1}", new Object[] { cnt, r.getSequenceNumber() });

        InputGesture g = InputGesture.valueOf(r);
        InputGesture exp = expectedGestures.get((int)r.getSequenceNumber());
        assertEquals(cnt + ": For: " + r.getSequenceNumber() + " txt:\n`"+ r.getMessage() +
            "\nkey: " + r.getResourceBundleName()
            , exp, g);
    }
    is.close();
}