use of io.pravega.test.integration.utils.SetupUtils in project pravega by pravega.
the class SingleThreadEndToEndTest method testReadWrite.
@Test(timeout = 60000)
public void testReadWrite() throws Exception {
@Cleanup("stopAllServices") SetupUtils setupUtils = new SetupUtils();
setupUtils.startAllServices(1);
setupUtils.createTestStream("stream", 1);
@Cleanup EventStreamWriter<Integer> writer = setupUtils.getIntegerWriter("stream");
writer.writeEvent(1);
writer.flush();
@Cleanup val rgm = setupUtils.createReaderGroupManager("stream");
@Cleanup EventStreamReader<Integer> reader = setupUtils.getIntegerReader("stream", rgm);
EventRead<Integer> event = reader.readNextEvent(10000);
Assert.assertEquals(1, (int) event.getEvent());
}
use of io.pravega.test.integration.utils.SetupUtils in project pravega by pravega.
the class SingleThreadEndToEndTest method testSealedStream.
@Test(timeout = 60000)
public void testSealedStream() throws Exception {
@Cleanup("stopAllServices") SetupUtils setupUtils = new SetupUtils();
setupUtils.startAllServices(1);
@Cleanup StreamManager streamManager = StreamManager.create(setupUtils.getClientConfig());
streamManager.createScope("scope");
streamManager.createStream("scope", "stream", StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(1)).build());
@Cleanup EventStreamWriter<byte[]> writer = setupUtils.getClientFactory().createEventWriter("stream", new ByteArraySerializer(), EventWriterConfig.builder().retryAttempts(2).enableLargeEvents(true).build());
writer.writeEvent(new byte[Serializer.MAX_EVENT_SIZE + 1]).join();
writer.flush();
assertTrue(streamManager.sealStream("scope", "stream"));
AssertExtensions.assertThrows(SegmentSealedException.class, () -> writer.writeEvent(new byte[Serializer.MAX_EVENT_SIZE + 1]).join());
AssertExtensions.assertThrows(IllegalStateException.class, () -> writer.writeEvent(new byte[1]).join());
writer.flush();
}
Aggregations