Search in sources :

Example 11 with ControllerWrapper

use of io.pravega.test.integration.demo.ControllerWrapper in project pravega by pravega.

the class ControllerFailoverTest method testSessionExpiryToleranceMinimalServices.

@Test(timeout = 120000)
public void testSessionExpiryToleranceMinimalServices() throws Exception {
    final int controllerPort = TestUtils.getAvailableListenPort();
    final String serviceHost = "localhost";
    final int containerCount = 4;
    final ControllerWrapper controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, false, controllerPort, serviceHost, servicePort, containerCount, -1);
    testSessionExpiryTolerance(controllerWrapper, controllerPort);
}
Also used : ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) Test(org.junit.Test)

Example 12 with ControllerWrapper

use of io.pravega.test.integration.demo.ControllerWrapper in project pravega by pravega.

the class ControllerStreamMetadataTest method setUp.

@Before
public void setUp() throws Exception {
    final int controllerPort = TestUtils.getAvailableListenPort();
    final String serviceHost = "localhost";
    final int servicePort = TestUtils.getAvailableListenPort();
    final int containerCount = 4;
    try {
        // 1. Start ZK
        this.zkTestServer = new TestingServerStarter().start();
        // 2. Start Pravega service.
        ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
        serviceBuilder.initialize();
        StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
        this.server = new PravegaConnectionListener(false, servicePort, store);
        this.server.startListening();
        // 3. Start controller
        this.controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
        this.controllerWrapper.awaitRunning();
        this.controller = controllerWrapper.getController();
        this.streamConfiguration = StreamConfiguration.builder().scope(SCOPE).streamName(STREAM).scalingPolicy(ScalingPolicy.fixed(1)).build();
    } catch (Exception e) {
        log.error("Error during setup", e);
        throw e;
    }
}
Also used : StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) TestingServerStarter(io.pravega.test.common.TestingServerStarter) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) Before(org.junit.Before)

Example 13 with ControllerWrapper

use of io.pravega.test.integration.demo.ControllerWrapper in project pravega by pravega.

the class SetupUtils method startAllServices.

/**
 * Start all pravega related services required for the test deployment.
 *
 * @param numThreads the number of threads for the internal client threadpool.
 * @throws Exception on any errors.
 */
public void startAllServices(Integer numThreads) throws Exception {
    if (!this.started.compareAndSet(false, true)) {
        log.warn("Services already started, not attempting to start again");
        return;
    }
    this.connectionFactory = new ConnectionFactoryImpl(clientConfig, numThreads);
    this.controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(clientConfig).build(), connectionFactory.getInternalExecutor());
    this.clientFactory = new ClientFactoryImpl(scope, controller, connectionFactory);
    // Start zookeeper.
    this.zkTestServer = new TestingServerStarter().start();
    this.zkTestServer.start();
    // Start Pravega Service.
    ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
    this.server = new PravegaConnectionListener(false, servicePort, store);
    this.server.startListening();
    log.info("Started Pravega Service");
    // Start Controller.
    this.controllerWrapper = new ControllerWrapper(this.zkTestServer.getConnectString(), false, true, controllerRPCPort, "localhost", servicePort, Config.HOST_STORE_CONTAINER_COUNT, controllerRESTPort);
    this.controllerWrapper.awaitRunning();
    this.controllerWrapper.getController().createScope(scope).get();
    log.info("Initialized Pravega Controller");
}
Also used : StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) TestingServerStarter(io.pravega.test.common.TestingServerStarter) ControllerImpl(io.pravega.client.stream.impl.ControllerImpl) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) ConnectionFactoryImpl(io.pravega.client.netty.impl.ConnectionFactoryImpl) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder)

Example 14 with ControllerWrapper

use of io.pravega.test.integration.demo.ControllerWrapper in project pravega by pravega.

the class ControllerFailoverTest method testStop.

@Test(timeout = 30000)
public void testStop() throws Exception {
    final int controllerPort = TestUtils.getAvailableListenPort();
    final String serviceHost = "localhost";
    final int containerCount = 4;
    final ControllerWrapper controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, false, controllerPort, serviceHost, servicePort, containerCount, TestUtils.getAvailableListenPort());
    controllerWrapper.awaitRunning();
    controllerWrapper.close();
}
Also used : ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) Test(org.junit.Test)

Example 15 with ControllerWrapper

use of io.pravega.test.integration.demo.ControllerWrapper in project pravega by pravega.

the class ReadWriteTest method setup.

@Before
public void setup() throws Exception {
    final int controllerPort = TestUtils.getAvailableListenPort();
    final String serviceHost = "localhost";
    final int servicePort = TestUtils.getAvailableListenPort();
    final int containerCount = 4;
    // 1. Start ZK
    this.zkTestServer = new TestingServerStarter().start();
    // 2. Start Pravega SegmentStore service.
    ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
    this.server = new PravegaConnectionListener(false, servicePort, store);
    this.server.startListening();
    // 3. Start Pravega Controller service
    this.controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), false, controllerPort, serviceHost, servicePort, containerCount);
    this.controllerWrapper.awaitRunning();
    this.controller = controllerWrapper.getController();
}
Also used : StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) TestingServerStarter(io.pravega.test.common.TestingServerStarter) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) Before(org.junit.Before)

Aggregations

ControllerWrapper (io.pravega.test.integration.demo.ControllerWrapper)20 TestingServerStarter (io.pravega.test.common.TestingServerStarter)17 StreamSegmentStore (io.pravega.segmentstore.contracts.StreamSegmentStore)16 PravegaConnectionListener (io.pravega.segmentstore.server.host.handler.PravegaConnectionListener)16 Before (org.junit.Before)14 ServiceBuilder (io.pravega.segmentstore.server.store.ServiceBuilder)5 Test (org.junit.Test)5 ConnectionFactoryImpl (io.pravega.client.netty.impl.ConnectionFactoryImpl)2 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)2 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)2 Controller (io.pravega.client.stream.impl.Controller)2 Cleanup (lombok.Cleanup)2 TestingServer (org.apache.curator.test.TestingServer)2 ClientFactory (io.pravega.client.ClientFactory)1 ReaderGroupManagerImpl (io.pravega.client.admin.impl.ReaderGroupManagerImpl)1 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)1 Stream (io.pravega.client.stream.Stream)1 ControllerImpl (io.pravega.client.stream.impl.ControllerImpl)1 JavaSerializer (io.pravega.client.stream.impl.JavaSerializer)1 StreamImpl (io.pravega.client.stream.impl.StreamImpl)1