Search in sources :

Example 41 with StreamCutImpl

use of io.pravega.client.stream.impl.StreamCutImpl in project pravega by pravega.

the class ControllerServiceImplTest method createReaderGroup.

protected void createReaderGroup(String scope, String stream, String rgName, UUID rgId) {
    final Segment seg0 = new Segment(scope, stream, 0L);
    final Segment seg1 = new Segment(scope, stream, 1L);
    ImmutableMap<Segment, Long> startStreamCut = ImmutableMap.of(seg0, 10L, seg1, 10L);
    Map<Stream, StreamCut> startSC = ImmutableMap.of(Stream.of(scope, stream), new StreamCutImpl(Stream.of(scope, stream), startStreamCut));
    ImmutableMap<Segment, Long> endStreamCut = ImmutableMap.of(seg0, 200L, seg1, 300L);
    Map<Stream, StreamCut> endSC = ImmutableMap.of(Stream.of(scope, stream), new StreamCutImpl(Stream.of(scope, stream), endStreamCut));
    ReaderGroupConfig config = ReaderGroupConfig.builder().automaticCheckpointIntervalMillis(30000L).groupRefreshTimeMillis(20000L).maxOutstandingCheckpointRequest(2).retentionType(ReaderGroupConfig.StreamDataRetention.AUTOMATIC_RELEASE_AT_LAST_CHECKPOINT).startingStreamCuts(startSC).endingStreamCuts(endSC).build();
    config = ReaderGroupConfig.cloneConfig(config, rgId, 0L);
    ResultObserver<CreateReaderGroupResponse> result = new ResultObserver<>();
    this.controllerService.createReaderGroup(ModelHelper.decode(scope, rgName, config), result);
    CreateReaderGroupResponse createRGStatus = result.get();
    assertEquals("Create Reader Group", CreateReaderGroupResponse.Status.SUCCESS, createRGStatus.getStatus());
}
Also used : ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) StreamCut(io.pravega.client.stream.StreamCut) StreamCutImpl(io.pravega.client.stream.impl.StreamCutImpl) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) CreateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateReaderGroupResponse) Stream(io.pravega.client.stream.Stream) Segment(io.pravega.client.segment.impl.Segment)

Aggregations

StreamCutImpl (io.pravega.client.stream.impl.StreamCutImpl)41 Segment (io.pravega.client.segment.impl.Segment)37 StreamCut (io.pravega.client.stream.StreamCut)34 Test (org.junit.Test)33 Stream (io.pravega.client.stream.Stream)28 ReaderGroupConfig (io.pravega.client.stream.ReaderGroupConfig)27 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)17 ArgumentMatchers.anyLong (org.mockito.ArgumentMatchers.anyLong)17 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)15 HashMap (java.util.HashMap)15 AtomicLong (java.util.concurrent.atomic.AtomicLong)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)12 Controller (io.pravega.controller.stream.api.grpc.v1.Controller)11 Map (java.util.Map)10 Cleanup (lombok.Cleanup)10 StreamImpl (io.pravega.client.stream.impl.StreamImpl)8 ImmutableMap (com.google.common.collect.ImmutableMap)7 EventStreamClientFactory (io.pravega.client.EventStreamClientFactory)7 ReaderGroupManager (io.pravega.client.admin.ReaderGroupManager)7 ClientConfig (io.pravega.client.ClientConfig)6