Search in sources :

Example 11 with StreamManagerImpl

use of io.pravega.client.admin.impl.StreamManagerImpl in project pravega by pravega.

the class ReadWriteAndScaleWithFailoverTest method setup.

@Before
public void setup() {
    // Get zk details to verify if controller, SSS are running
    Service zkService = Utils.createZookeeperService();
    List<URI> zkUris = zkService.getServiceDetails();
    log.debug("Zookeeper service details: {}", zkUris);
    // get the zk ip details and pass it to  host, controller
    URI zkUri = zkUris.get(0);
    // Verify controller is running.
    controllerInstance = Utils.createPravegaControllerService(zkUri);
    assertTrue(controllerInstance.isRunning());
    List<URI> conURIs = controllerInstance.getServiceDetails();
    log.info("Pravega Controller service instance 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());
    controllerURIDirect = URI.create("tcp://" + String.join(",", uris));
    log.info("Controller Service direct URI: {}", controllerURIDirect);
    // Verify segment store is running.
    segmentStoreInstance = Utils.createPravegaSegmentStoreService(zkUri, controllerURIDirect);
    assertTrue(segmentStoreInstance.isRunning());
    log.info("Pravega Segmentstore service instance details: {}", segmentStoreInstance.getServiceDetails());
    // num. of readers + num. of writers + 1 to run checkScale operation
    executorService = ExecutorServiceHelpers.newScheduledThreadPool(NUM_READERS + NUM_WRITERS + 1, "ReadWriteAndScaleWithFailoverTest-main");
    controllerExecutorService = ExecutorServiceHelpers.newScheduledThreadPool(2, "ReadWriteAndScaleWithFailoverTest-controller");
    // get Controller Uri
    controller = new ControllerImpl(ControllerImplConfig.builder().clientConfig(ClientConfig.builder().controllerURI(controllerURIDirect).build()).maxBackoffMillis(5000).build(), controllerExecutorService);
    testState = new TestState(false);
    testState.writersListComplete.add(0, testState.writersComplete);
    streamManager = new StreamManagerImpl(ClientConfig.builder().controllerURI(controllerURIDirect).build());
    createScopeAndStream(scope, SCALE_STREAM, config, streamManager);
    log.info("Scope passed to client factory {}", scope);
    clientFactory = new ClientFactoryImpl(scope, controller);
    readerGroupManager = ReaderGroupManager.withScope(scope, ClientConfig.builder().controllerURI(controllerURIDirect).build());
}
Also used : ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) ControllerImpl(io.pravega.client.stream.impl.ControllerImpl) Service(io.pravega.test.system.framework.services.Service) StreamManagerImpl(io.pravega.client.admin.impl.StreamManagerImpl) URI(java.net.URI) Before(org.junit.Before)

Aggregations

StreamManagerImpl (io.pravega.client.admin.impl.StreamManagerImpl)11 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)9 URI (java.net.URI)9 ControllerImpl (io.pravega.client.stream.impl.ControllerImpl)7 Service (io.pravega.test.system.framework.services.Service)7 Before (org.junit.Before)6 StreamManager (io.pravega.client.admin.StreamManager)5 Test (org.junit.Test)5 ClientFactory (io.pravega.client.ClientFactory)3 ReaderGroupManager (io.pravega.client.admin.ReaderGroupManager)3 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)3 Cleanup (lombok.Cleanup)3 CreateScopeRequest (io.pravega.controller.server.rest.generated.model.CreateScopeRequest)2 CreateStreamRequest (io.pravega.controller.server.rest.generated.model.CreateStreamRequest)2 ReaderGroupProperty (io.pravega.controller.server.rest.generated.model.ReaderGroupProperty)2 ReaderGroupsList (io.pravega.controller.server.rest.generated.model.ReaderGroupsList)2 ReaderGroupsListReaderGroups (io.pravega.controller.server.rest.generated.model.ReaderGroupsListReaderGroups)2 RetentionConfig (io.pravega.controller.server.rest.generated.model.RetentionConfig)2 ScalingConfig (io.pravega.controller.server.rest.generated.model.ScalingConfig)2 StreamProperty (io.pravega.controller.server.rest.generated.model.StreamProperty)2