use of io.pravega.client.stream.impl.ByteArraySerializer in project pravega by pravega.
the class SynchronizerTest method testCompactionShrinksSet.
@Test(timeout = 20000)
public void testCompactionShrinksSet() throws EndOfSegmentException {
String streamName = "testCompactionShrinksSet";
String scope = "scope";
MockSegmentStreamFactory ioFactory = new MockSegmentStreamFactory();
@Cleanup MockClientFactory clientFactory = new MockClientFactory(scope, ioFactory);
SetSynchronizer<String> set = SetSynchronizer.createNewSet(streamName, clientFactory);
RevisionedStreamClient<byte[]> rsc = clientFactory.createRevisionedStreamClient(streamName, new ByteArraySerializer(), SynchronizerConfig.builder().build());
set.add("Foo");
assertNull(rsc.getMark());
set.add("Bar");
assertNull(rsc.getMark());
set.clear();
assertNotNull(rsc.getMark());
Iterator<?> iter = rsc.readFrom(rsc.getMark());
assertTrue(iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
set.add("Foo2");
assertNotNull(rsc.getMark());
assertEquals(1, set.getCurrentSize());
}
Aggregations