Search in sources :

Example 1 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class AbstractFailoverTests method startPravegaControllerInstances.

static URI startPravegaControllerInstances(final URI zkUri) throws ExecutionException {
    Service controllerService = Utils.createPravegaControllerService(zkUri);
    if (!controllerService.isRunning()) {
        controllerService.start(true);
    }
    Futures.getAndHandleExceptions(controllerService.scaleService(3), ExecutionException::new);
    List<URI> conUris = controllerService.getServiceDetails();
    log.info("conuris {} {}", conUris.get(0), conUris.get(1));
    log.debug("Pravega Controller service  details: {}", conUris);
    // Fetch all the RPC endpoints and construct the client URIs.
    final List<String> uris = conUris.stream().filter(uri -> Utils.DOCKER_BASED ? uri.getPort() == Utils.DOCKER_CONTROLLER_PORT : uri.getPort() == Utils.MARATHON_CONTROLLER_PORT).map(URI::getAuthority).collect(Collectors.toList());
    URI controllerURI = URI.create("tcp://" + String.join(",", uris));
    log.info("Controller Service direct URI: {}", controllerURI);
    return controllerURI;
}
Also used : Service(io.pravega.test.system.framework.services.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutionException(java.util.concurrent.ExecutionException) URI(java.net.URI)

Example 2 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class ControllerFailoverTest method setup.

@Environment
public static void setup() throws MarathonException, ExecutionException {
    // 1. check if zk is running, if not start it
    Service zkService = Utils.createZookeeperService();
    if (!zkService.isRunning()) {
        zkService.start(true);
    }
    List<URI> zkUris = zkService.getServiceDetails();
    log.debug("zookeeper service details: {}", zkUris);
    // get the zk ip details and pass it to bk, host, controller
    URI zkUri = zkUris.get(0);
    // 2, check if bk is running, otherwise start, get the zk ip
    Service bkService = Utils.createBookkeeperService(zkUri);
    if (!bkService.isRunning()) {
        bkService.start(true);
    }
    List<URI> bkUris = bkService.getServiceDetails();
    log.debug("bookkeeper service details: {}", bkUris);
    // 3. start controller
    Service controllerService = Utils.createPravegaControllerService(zkUri);
    if (!controllerService.isRunning()) {
        controllerService.start(true);
    }
    Futures.getAndHandleExceptions(controllerService.scaleService(2), ExecutionException::new);
    List<URI> conUris = controllerService.getServiceDetails();
    log.info("conuris {} {}", conUris.get(0), conUris.get(1));
    log.debug("Pravega Controller service  details: {}", conUris);
    // Fetch all the RPC endpoints and construct the client URIs.
    final List<String> uris = conUris.stream().filter(uri -> Utils.DOCKER_BASED ? uri.getPort() == Utils.DOCKER_CONTROLLER_PORT : uri.getPort() == Utils.MARATHON_CONTROLLER_PORT).map(URI::getAuthority).collect(Collectors.toList());
    URI controllerURI = URI.create("tcp://" + String.join(",", uris));
    log.info("Controller Service direct URI: {}", controllerURI);
    // 4.start host
    Service segService = Utils.createPravegaSegmentStoreService(zkUri, conUris.get(0));
    if (!segService.isRunning()) {
        segService.start(true);
    }
    List<URI> segUris = segService.getServiceDetails();
    log.debug("pravega host service details: {}", segUris);
}
Also used : Service(io.pravega.test.system.framework.services.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutionException(java.util.concurrent.ExecutionException) URI(java.net.URI) Environment(io.pravega.test.system.framework.Environment)

Example 3 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class MultiControllerTest method setup.

@Environment
public static void setup() throws MarathonException, ExecutionException {
    Service zkService = Utils.createZookeeperService();
    if (!zkService.isRunning()) {
        zkService.start(true);
    }
    List<URI> zkUris = zkService.getServiceDetails();
    log.info("zookeeper service details: {}", zkUris);
    Service controllerService = Utils.createPravegaControllerService(zkUris.get(0));
    if (!controllerService.isRunning()) {
        controllerService.start(true);
    }
    Futures.getAndHandleExceptions(controllerService.scaleService(3), ExecutionException::new);
    List<URI> conUris = controllerService.getServiceDetails();
    log.info("conuris {} {}", conUris.get(0), conUris.get(1));
    log.debug("Pravega Controller service  details: {}", conUris);
    // Fetch all the RPC endpoints and construct the client URIs.
    final List<String> uris = conUris.stream().filter(uri -> DOCKER_BASED ? uri.getPort() == Utils.DOCKER_CONTROLLER_PORT : uri.getPort() == Utils.MARATHON_CONTROLLER_PORT).map(URI::getAuthority).collect(Collectors.toList());
    URI controllerURI = URI.create("tcp://" + String.join(",", uris));
    log.info("Controller Service direct URI: {}", controllerURI);
}
Also used : Service(io.pravega.test.system.framework.services.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutionException(java.util.concurrent.ExecutionException) URI(java.net.URI) Environment(io.pravega.test.system.framework.Environment)

Example 4 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class ControllerRestApiTest method setup.

/**
 * This is used to setup the various services required by the system test framework.
 *
 * @throws InterruptedException If interrupted
 * @throws MarathonException    when error in setup
 * @throws URISyntaxException   If URI is invalid
 */
@Environment
public static void setup() throws MarathonException {
    // 1. check if zk is running, if not start it
    Service zkService = Utils.createZookeeperService();
    if (!zkService.isRunning()) {
        zkService.start(true);
    }
    List<URI> zkUris = zkService.getServiceDetails();
    log.debug("zookeeper service details: {}", zkUris);
    // get the zk ip details and pass it to bk, host, controller
    URI zkUri = zkUris.get(0);
    // 2, check if bk is running, otherwise start, get the zk ip
    Service bkService = Utils.createBookkeeperService(zkUri);
    if (!bkService.isRunning()) {
        bkService.start(true);
    }
    List<URI> bkUris = bkService.getServiceDetails();
    log.debug("bookkeeper service details: {}", bkUris);
    // 3. start controller
    Service conService = Utils.createPravegaControllerService(zkUri);
    if (!conService.isRunning()) {
        conService.start(true);
    }
    List<URI> conUris = conService.getServiceDetails();
    log.debug("Pravega Controller service details: {}", conUris);
    // 4.start host
    Service segService = Utils.createPravegaSegmentStoreService(zkUri, conUris.get(0));
    if (!segService.isRunning()) {
        segService.start(true);
    }
    List<URI> segUris = segService.getServiceDetails();
    log.debug("pravega host service details: {}", segUris);
}
Also used : Service(io.pravega.test.system.framework.services.Service) URI(java.net.URI) Environment(io.pravega.test.system.framework.Environment)

Example 5 with Service

use of io.pravega.test.system.framework.services.Service in project pravega by pravega.

the class PravegaControllerTest method setup.

/**
 * This is used to setup the various services required by the system test framework.
 *
 * @throws MarathonException if error in setup
 */
@Environment
public static void setup() throws MarathonException {
    Service zk = Utils.createZookeeperService();
    if (!zk.isRunning()) {
        zk.start(true);
    }
    Service con = Utils.createPravegaControllerService(zk.getServiceDetails().get(0));
    if (!con.isRunning()) {
        con.start(true);
    }
}
Also used : Service(io.pravega.test.system.framework.services.Service) Environment(io.pravega.test.system.framework.Environment)

Aggregations

Service (io.pravega.test.system.framework.services.Service)48 URI (java.net.URI)41 Before (org.junit.Before)18 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)16 ControllerImpl (io.pravega.client.control.impl.ControllerImpl)12 Environment (io.pravega.test.system.framework.Environment)12 ClientConfig (io.pravega.client.ClientConfig)10 StreamManagerImpl (io.pravega.client.admin.impl.StreamManagerImpl)8 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)8 Test (org.junit.Test)8 ExecutionException (java.util.concurrent.ExecutionException)7 SocketConnectionFactoryImpl (io.pravega.client.connection.impl.SocketConnectionFactoryImpl)6 Cleanup (lombok.Cleanup)5 ReaderGroupManager (io.pravega.client.admin.ReaderGroupManager)3 PravegaControllerService (io.pravega.test.system.framework.services.marathon.PravegaControllerService)3 EventStreamClientFactory (io.pravega.client.EventStreamClientFactory)2 StreamManager (io.pravega.client.admin.StreamManager)2 ConnectionFactory (io.pravega.client.connection.impl.ConnectionFactory)2 ControllerImpl (io.pravega.client.stream.impl.ControllerImpl)2 Invocation (javax.ws.rs.client.Invocation)2