Search in sources :

Example 1 with AbstractClientFactoryImpl

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

the class StreamMetadataTasksTest method testeventHelperNPE.

@Test(timeout = 30000)
public void testeventHelperNPE() throws Exception {
    StreamMetadataStore streamMetadataStore = getStore();
    ImmutableMap<BucketStore.ServiceType, Integer> map = ImmutableMap.of(BucketStore.ServiceType.RetentionService, 1, BucketStore.ServiceType.WatermarkingService, 1);
    bucketStore = StreamStoreFactory.createInMemoryBucketStore(map);
    TaskMetadataStore taskMetadataStore = TaskStoreFactory.createZKStore(zkClient, executor);
    SegmentHelper segmentHelperMock = SegmentHelperMock.getSegmentHelperMock();
    List<Map.Entry<Double, Double>> newRanges = new ArrayList<>();
    newRanges.add(new AbstractMap.SimpleEntry<>(0.5, 0.75));
    newRanges.add(new AbstractMap.SimpleEntry<>(0.75, 1.0));
    EventHelper helper = EventHelperMock.getEventHelperMock(executor, "host", ((AbstractStreamMetadataStore) streamMetadataStore).getHostTaskIndex());
    @Cleanup StreamMetadataTasks streamMetadataTasks = new StreamMetadataTasks(streamMetadataStore, bucketStore, taskMetadataStore, segmentHelperMock, executor, "host", new GrpcAuthHelper(authEnabled, "key", 300), helper);
    CompletableFuture<ScaleResponse> scaleResponse = streamMetadataTasks.manualScale(SCOPE, "hellow", Collections.singletonList(1L), newRanges, 30, 0L);
    if (!scaleResponse.isDone()) {
        AbstractClientFactoryImpl clientFactory = mock(AbstractClientFactoryImpl.class);
        streamMetadataTasks.initializeStreamWriters(clientFactory, "_requestStream");
    }
    assertEquals(ScaleResponse.ScaleStreamStatus.FAILURE, scaleResponse.join().getStatus());
}
Also used : TaskMetadataStore(io.pravega.controller.store.task.TaskMetadataStore) AbstractClientFactoryImpl(io.pravega.client.stream.impl.AbstractClientFactoryImpl) ArrayList(java.util.ArrayList) ScaleResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse) AbstractStreamMetadataStore(io.pravega.controller.store.stream.AbstractStreamMetadataStore) StreamMetadataStore(io.pravega.controller.store.stream.StreamMetadataStore) SegmentHelper(io.pravega.controller.server.SegmentHelper) Cleanup(lombok.Cleanup) AbstractMap(java.util.AbstractMap) GrpcAuthHelper(io.pravega.controller.server.security.auth.GrpcAuthHelper) EventHelper(io.pravega.controller.task.EventHelper) Test(org.junit.Test)

Aggregations

AbstractClientFactoryImpl (io.pravega.client.stream.impl.AbstractClientFactoryImpl)1 SegmentHelper (io.pravega.controller.server.SegmentHelper)1 GrpcAuthHelper (io.pravega.controller.server.security.auth.GrpcAuthHelper)1 AbstractStreamMetadataStore (io.pravega.controller.store.stream.AbstractStreamMetadataStore)1 StreamMetadataStore (io.pravega.controller.store.stream.StreamMetadataStore)1 TaskMetadataStore (io.pravega.controller.store.task.TaskMetadataStore)1 ScaleResponse (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse)1 EventHelper (io.pravega.controller.task.EventHelper)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Cleanup (lombok.Cleanup)1 Test (org.junit.Test)1