Package krati.retention

Examples of krati.retention.EventBatchHeader


        assertEquals(capacity, batch.getSize());
       
        batch.setCompletionTime(System.currentTimeMillis() + 1);
        assertTrue(batch.getCreationTime() < batch.getCompletionTime());
       
        EventBatchHeader header = batch.getHeader();
        assertEquals(batch.getVersion(), header.getVersion());
        assertEquals(batch.getSize(), header.getSize());
        assertEquals(batch.getOrigin(), header.getOrigin());
        assertEquals(batch.getCreationTime(), header.getCreationTime());
        assertEquals(batch.getCompletionTime(), header.getCompletionTime());
        assertTrue(header.getMinClock().compareTo(batch.getMinClock()) == Occurred.EQUICONCURRENTLY);
        assertTrue(header.getMaxClock().compareTo(batch.getMaxClock()) == Occurred.EQUICONCURRENTLY);
       
        long nextOffset;
        ArrayList<Event<String>> list = new ArrayList<Event<String>>();
        nextOffset = batch.get(batch.getOrigin(), list);
        assertEquals(batch.getSize(), list.size());
View Full Code Here


        do {
            clock = _randClockFactory.next();
        } while(batch.put(new SimpleEvent<String>("Event." + clock, clock)));
        batch.setCompletionTime(System.currentTimeMillis());
       
        EventBatchHeader header = batch.getHeader();
       
        SimpleEventBatchSerializer<String> batchSerializer =
            new SimpleEventBatchSerializer<String>(new StringSerializer(), new ClockSerializer());
        byte[] bytes = batchSerializer.serialize(batch);
        EventBatch<String> batch2 = batchSerializer.deserialize(bytes);
        EventBatchHeader header2 = batch2.getHeader();
       
        assertEquals(header.getVersion(), header2.getVersion());
        assertEquals(header.getSize(), header2.getSize());
        assertEquals(header.getOrigin(), header2.getOrigin());
        assertEquals(header.getCreationTime(), header2.getCreationTime());
        assertEquals(header.getCompletionTime(), header2.getCompletionTime());
        assertTrue(header.getMinClock().compareTo(header2.getMinClock()) == Occurred.EQUICONCURRENTLY);
        assertTrue(header.getMaxClock().compareTo(header2.getMaxClock()) == Occurred.EQUICONCURRENTLY);
    }
View Full Code Here

TOP

Related Classes of krati.retention.EventBatchHeader

Copyright © 2018 www.massapicom. 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.