Examples of EventLog


Examples of org.eclipse.sapphire.tests.EventLog

       
        base.add( "a" );
        base.add( "b" );
        base.add( "c" );
       
        final EventLog log = new EventLog();
        observable.attach( log );
       
        observable.removeAll( ListFactory.unmodifiable( "b", "c", "d" ) );

        assertEquals( ListFactory.unmodifiable( "a" ), base );
        assertEquals( 1, log.size() );

        log.clear();
        observable.removeAll( ListFactory.unmodifiable( "d", "e" ) );
       
        assertEquals( ListFactory.unmodifiable( "a" ), base );
        assertEquals( 0, log.size() );
    }
View Full Code Here

Examples of org.eclipse.sapphire.tests.EventLog

       
        base.add( "a" );
        base.add( "b" );
        base.add( "c" );
       
        final EventLog log = new EventLog();
        observable.attach( log );
       
        observable.retainAll( ListFactory.unmodifiable( "a", "c" ) );

        assertEquals( ListFactory.unmodifiable( "a", "c" ), base );
        assertEquals( 1, log.size() );

        log.clear();
        observable.retainAll( ListFactory.unmodifiable( "a", "c" ) );
       
        assertEquals( ListFactory.unmodifiable( "a", "c" ), base );
        assertEquals( 0, log.size() );
    }
View Full Code Here

Examples of org.eclipse.sapphire.tests.EventLog

       
        base.add( "a" );
        base.add( "b" );
        base.add( "c" );
       
        final EventLog log = new EventLog();
        observable.attach( log );
       
        observable.clear();

        assertTrue( base.isEmpty() );
        assertEquals( 1, log.size() );

        log.clear();
        observable.clear();
       
        assertTrue( base.isEmpty() );
        assertEquals( 0, log.size() );
    }
View Full Code Here

Examples of org.eclipse.sapphire.tests.EventLog

       
        base.put( "a", "1" );
        base.put( "b", "2" );
        base.put( "c", "3" );
       
        final EventLog log = new EventLog();
        observable.attach( log );
       
        final Iterator<Map.Entry<String,String>> itr = observable.entrySet().iterator();
       
        assertTrue( itr.hasNext() );
       
        final Map.Entry<String,String> a = itr.next();
       
        assertEquals( "a", a.getKey() );
        assertEquals( "1", a.getValue() );
       
        assertTrue( itr.hasNext() );
       
        final Map.Entry<String,String> b = itr.next();
       
        assertEquals( "b", b.getKey() );
        assertEquals( "2", b.getValue() );
       
        itr.remove();
       
        assertEquals( MapFactory.start().add( "a", "1" ).add( "c", "3" ).result(), base );
        assertEquals( 1, log.size() );
       
        assertTrue( itr.hasNext() );
       
        final Map.Entry<String,String> c = itr.next();
       
View Full Code Here

Examples of org.eclipse.sapphire.tests.EventLog

        final ObservableMap<String,String> observable = new ObservableMap<String,String>( base );
       
        base.put( "a", "1" );
        base.put( "b", "2" );
       
        final EventLog log = new EventLog();
        observable.attach( log );
       
        observable.put( "c", "3" );

        assertEquals( MapFactory.start().add( "a", "1" ).add( "b", "2" ).add( "c", "3" ).result(), base );
        assertEquals( 1, log.size() );
       
        log.clear();
        observable.put( "b", "22" );

        assertEquals( MapFactory.start().add( "a", "1" ).add( "b", "22" ).add( "c", "3" ).result(), base );
        assertEquals( 1, log.size() );
       
        log.clear();
        observable.put( "c", "3" );

        assertEquals( MapFactory.start().add( "a", "1" ).add( "b", "22" ).add( "c", "3" ).result(), base );
        assertEquals( 0, log.size() );
    }
View Full Code Here

Examples of org.hyperic.sigar.win32.EventLog

    public void open() {
        for (int i = 0; i < eventLogs.length; i++) {
            try {
                if (eventLogs[i] == null) {
                    eventLogs[i] = new EventLog();
                    eventLogs[i].open(logNames[i]);

                    // note, the first processed event will be the next one generated, this one
                    // was generated in the past, prior to this call to open().
                    lastCollectedEventId[i] = eventLogs[i].getNewestRecord();
View Full Code Here

Examples of org.hyperic.sigar.win32.EventLog

import org.hyperic.sigar.win32.Win32Exception;

public class EventLogTail {

    private static void tail(String name, Tail tail) throws Win32Exception {
        EventLog log = new EventLog();
        log.open(name);
        int max = log.getNumberOfRecords();
        if (tail.number < max) {
            max = tail.number;
        }
        int last = log.getNewestRecord()+1;
        int first = last - max;

        for (int i=first; i<last; i++) {
            EventLogRecord record = log.read(i);
            System.out.println(record);
        }
        log.close();
    }
View Full Code Here

Examples of org.hyperic.sigar.win32.EventLog

    public TestEventLog(String name) {
        super(name);
    }

    public void testOpenClose() throws Exception {
        EventLog log = new EventLog();

        // Try to close an event log that isn't open
        try {
            log.close();
            fail("Closing an unopened event log succeeded");
        } catch (Win32Exception e) {
            // OK
        }

        log.open(EventLog.APPLICATION);
        log.close();

        // Try to reopen using the System log
        log.open(EventLog.SYSTEM);
        log.close();
    }
View Full Code Here

Examples of org.hyperic.sigar.win32.EventLog

        log.close();
    }

    public void testGetNumberOfRecords() throws Exception {
        int numRecords;
        EventLog log = new EventLog();

        log.open(EventLog.APPLICATION);
        try {
            numRecords = log.getNumberOfRecords();
        } catch (Exception e) {
            fail("Unable to get the number of records");
        }

        log.close();
    }
View Full Code Here

Examples of org.hyperic.sigar.win32.EventLog

        log.close();
    }

    public void testGetOldestRecord() throws Exception {
        int oldestRecord;
        EventLog log = new EventLog();

        log.open(EventLog.APPLICATION);
        try {
            oldestRecord = log.getOldestRecord();
        } catch (Exception e) {
            fail("Unable to get the oldest event record");
        }

        log.close();
    }
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.