use of io.pravega.segmentstore.contracts.tables.TableStore in project pravega by pravega.
the class StreamMetricsTest method setup.
@Before
public void setup() throws Exception {
controllerPort = TestUtils.getAvailableListenPort();
final String serviceHost = "localhost";
final int servicePort = TestUtils.getAvailableListenPort();
final int containerCount = 4;
// 1. Start Metrics service
log.info("Initializing metrics provider ...");
MetricsConfig metricsConfig = MetricsConfig.builder().with(MetricsConfig.ENABLE_STATISTICS, true).with(MetricsConfig.ENABLE_STATSD_REPORTER, false).build();
metricsConfig.setDynamicCacheEvictionDuration(Duration.ofSeconds(60));
MetricsProvider.initialize(metricsConfig);
statsProvider = MetricsProvider.getMetricsProvider();
statsProvider.startWithoutExporting();
log.info("Metrics Stats provider is started");
// 2. Start ZK
this.zkTestServer = new TestingServerStarter().start();
// 3. Start Pravega SegmentStore service.
serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
monitor = new AutoScaleMonitor(store, AutoScalerConfig.builder().build());
TableStore tableStore = serviceBuilder.createTableStoreService();
this.server = new PravegaConnectionListener(false, false, "localhost", servicePort, store, tableStore, monitor.getStatsRecorder(), monitor.getTableSegmentStatsRecorder(), new PassingTokenVerifier(), null, null, true, this.serviceBuilder.getLowPriorityExecutor(), SecurityConfigDefaults.TLS_PROTOCOL_VERSION);
this.server.startListening();
// 4. Start Pravega Controller service
this.controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
this.controllerWrapper.awaitRunning();
this.controller = controllerWrapper.getController();
}
use of io.pravega.segmentstore.contracts.tables.TableStore in project pravega by pravega.
the class StreamSeekTest method setUp.
@Before
public void setUp() throws Exception {
zkTestServer = new TestingServerStarter().start();
serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
TableStore tableStore = serviceBuilder.createTableStoreService();
server = new PravegaConnectionListener(false, servicePort, store, tableStore, serviceBuilder.getLowPriorityExecutor());
server.startListening();
controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
controllerWrapper.awaitRunning();
}
use of io.pravega.segmentstore.contracts.tables.TableStore in project pravega by pravega.
the class MultiReadersEndToEndTest method runTestUsingMock.
private void runTestUsingMock(final Set<String> streamNames, final int numParallelReaders, final int numSegments) throws Exception {
int servicePort = TestUtils.getAvailableListenPort();
@Cleanup ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
TableStore tableStore = serviceBuilder.createTableStoreService();
@Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, servicePort, store, tableStore, serviceBuilder.getLowPriorityExecutor());
server.startListening();
@Cleanup MockStreamManager streamManager = new MockStreamManager("scope", "localhost", servicePort);
@Cleanup MockClientFactory clientFactory = streamManager.getClientFactory();
streamManager.createScope("scope");
streamNames.stream().forEach(stream -> {
streamManager.createStream("scope", stream, StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(numSegments)).build());
@Cleanup EventStreamWriter<Integer> eventWriter = clientFactory.createEventWriter(stream, new IntegerSerializer(), EventWriterConfig.builder().build());
for (Integer i = 0; i < NUM_TEST_EVENTS; i++) {
eventWriter.writeEvent(String.valueOf(i), i);
}
eventWriter.flush();
log.info("Wrote {} events", NUM_TEST_EVENTS);
});
final String readerGroupName = "testReaderGroup";
ReaderGroupConfig.ReaderGroupConfigBuilder builder = ReaderGroupConfig.builder();
streamNames.forEach(s -> builder.stream(Stream.of("scope", s)));
streamManager.createReaderGroup(readerGroupName, builder.build());
Collection<Integer> read = readAllEvents(numParallelReaders, clientFactory, readerGroupName, numSegments);
Assert.assertEquals(NUM_TEST_EVENTS * streamNames.size(), read.size());
// Check unique events.
Assert.assertEquals(NUM_TEST_EVENTS, new TreeSet<>(read).size());
streamManager.deleteReaderGroup(readerGroupName);
}
use of io.pravega.segmentstore.contracts.tables.TableStore in project pravega by pravega.
the class ReaderGroupStreamCutUpdateTest method setUp.
@Before
public void setUp() throws Exception {
zkTestServer = new TestingServerStarter().start();
serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
TableStore tableStore = serviceBuilder.createTableStoreService();
server = new PravegaConnectionListener(false, servicePort, store, tableStore, serviceBuilder.getLowPriorityExecutor());
server.startListening();
controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
controllerWrapper.awaitRunning();
}
use of io.pravega.segmentstore.contracts.tables.TableStore in project pravega by pravega.
the class StreamRecreationTest method setUp.
@Before
public void setUp() throws Exception {
executor = ExecutorServiceHelpers.newScheduledThreadPool(1, "test");
zkTestServer = new TestingServerStarter().start();
serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
serviceBuilder.initialize();
StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
TableStore tableStore = serviceBuilder.createTableStoreService();
server = new PravegaConnectionListener(false, servicePort, store, tableStore, serviceBuilder.getLowPriorityExecutor());
server.startListening();
controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
controllerWrapper.awaitRunning();
}
Aggregations