Search in sources :

Example 6 with TxnSegments

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

the class ControllerBootstrapTest method bootstrapTest.

@Test(timeout = 20000)
public void bootstrapTest() throws Exception {
    Controller controller = controllerWrapper.getController();
    // Now start Pravega service.
    serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    store = serviceBuilder.createStreamSegmentService();
    tableStore = serviceBuilder.createTableStoreService();
    server = new PravegaConnectionListener(false, servicePort, store, tableStore, serviceBuilder.getLowPriorityExecutor());
    server.startListening();
    // Create test scope. This operation should succeed.
    Boolean scopeStatus = controller.createScope(SCOPE).join();
    Assert.assertEquals(true, scopeStatus);
    // Try creating a stream. It should not complete until Pravega host has started.
    // After Pravega host starts, stream should be successfully created.
    StreamConfiguration streamConfiguration = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(1)).build();
    CompletableFuture<Boolean> streamStatus = controller.createStream(SCOPE, STREAM, streamConfiguration);
    Assert.assertTrue(!streamStatus.isDone());
    // Ensure that create stream succeeds.
    Boolean status = streamStatus.join();
    Assert.assertEquals(true, status);
    // Now create transaction should succeed.
    CompletableFuture<TxnSegments> txIdFuture = controller.createTransaction(new StreamImpl(SCOPE, STREAM), 10000);
    TxnSegments id = txIdFuture.join();
    Assert.assertNotNull(id);
    controllerWrapper.awaitRunning();
}
Also used : TxnSegments(io.pravega.client.stream.impl.TxnSegments) StreamImpl(io.pravega.client.stream.impl.StreamImpl) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Controller(io.pravega.client.control.impl.Controller) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) Test(org.junit.Test)

Aggregations

TxnSegments (io.pravega.client.stream.impl.TxnSegments)6 StreamImpl (io.pravega.client.stream.impl.StreamImpl)4 Segment (io.pravega.client.segment.impl.Segment)3 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)3 StreamSegments (io.pravega.client.stream.impl.StreamSegments)3 UUID (java.util.UUID)3 Controller (io.pravega.client.control.impl.Controller)2 Stream (io.pravega.client.stream.Stream)2 SegmentWithRange (io.pravega.client.stream.impl.SegmentWithRange)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Cleanup (lombok.Cleanup)2 lombok.val (lombok.val)2 Test (org.junit.Test)2 Strings (com.google.common.base.Strings)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ManagedChannel (io.grpc.ManagedChannel)1 Server (io.grpc.Server)1 Status (io.grpc.Status)1