Search in sources :

Example 1 with ByteArraySerializer

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());
}
Also used : MockSegmentStreamFactory(io.pravega.client.stream.mock.MockSegmentStreamFactory) Cleanup(lombok.Cleanup) ByteArraySerializer(io.pravega.client.stream.impl.ByteArraySerializer) MockClientFactory(io.pravega.client.stream.mock.MockClientFactory) Test(org.junit.Test)

Aggregations

ByteArraySerializer (io.pravega.client.stream.impl.ByteArraySerializer)1 MockClientFactory (io.pravega.client.stream.mock.MockClientFactory)1 MockSegmentStreamFactory (io.pravega.client.stream.mock.MockSegmentStreamFactory)1 Cleanup (lombok.Cleanup)1 Test (org.junit.Test)1