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();
}
Aggregations