Search in sources :

Example 16 with Endpoint

use of org.apache.bookkeeper.stream.proto.common.Endpoint in project bookkeeper by apache.

the class LocationClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    scheduler = OrderedScheduler.newSchedulerBuilder().name("location-client-test").numThreads(1).build();
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    client = new LocationClientImpl(settings, scheduler);
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint) LocationClientImpl(org.apache.bookkeeper.clients.impl.internal.LocationClientImpl)

Example 17 with Endpoint

use of org.apache.bookkeeper.stream.proto.common.Endpoint in project bookkeeper by apache.

the class LocationClientTest method testLocateStorageContainers.

@Test
public void testLocateStorageContainers() throws Exception {
    List<OneStorageContainerEndpointResponse> responses = client.locateStorageContainers(Lists.newArrayList(Revisioned.of(ROOT_STORAGE_CONTAINER_ID, -1L))).get();
    assertEquals(1, responses.size());
    OneStorageContainerEndpointResponse oneResponse = responses.get(0);
    assertEquals(StatusCode.SUCCESS, oneResponse.getStatusCode());
    Endpoint endpoint = oneResponse.getEndpoint().getRwEndpoint();
    log.info("Current cluster endpoints = {}", cluster.getRpcEndpoints());
    log.info("Response : rw endpoint = {}", endpoint);
    assertTrue(cluster.getRpcEndpoints().contains(endpoint));
    assertEquals(1, oneResponse.getEndpoint().getRoEndpointCount());
    endpoint = oneResponse.getEndpoint().getRoEndpoint(0);
    log.info("Response : ro endpoint = {}", endpoint);
    assertTrue(cluster.getRpcEndpoints().contains(endpoint));
}
Also used : Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint) OneStorageContainerEndpointResponse(org.apache.bookkeeper.stream.proto.storage.OneStorageContainerEndpointResponse) Test(org.junit.Test)

Example 18 with Endpoint

use of org.apache.bookkeeper.stream.proto.common.Endpoint in project bookkeeper by apache.

the class StorageClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    defaultBackendUri = URI.create("distributedlog://" + cluster.getZkServers() + "/stream/storage");
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    adminClient = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin();
    nsName = "test_namespace";
    FutureUtils.result(adminClient.createNamespace(nsName, colConf));
    client = StorageClientBuilder.newBuilder().withSettings(settings).withNamespace(nsName).build();
    streamName = "test_stream";
    createStream(streamName);
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint)

Example 19 with Endpoint

use of org.apache.bookkeeper.stream.proto.common.Endpoint in project bookkeeper by apache.

the class TableClientSimpleTest method doSetup.

@Override
protected void doSetup() throws Exception {
    defaultBackendUri = URI.create("distributedlog://" + cluster.getZkServers() + "/stream/storage");
    scheduler = OrderedScheduler.newSchedulerBuilder().name("table-client-test").numThreads(1).build();
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    String namespace = "test_namespace";
    adminClient = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin();
    storageClient = StorageClientBuilder.newBuilder().withSettings(settings).withNamespace(namespace).build();
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint)

Example 20 with Endpoint

use of org.apache.bookkeeper.stream.proto.common.Endpoint in project bookkeeper by apache.

the class TableClientTest method doSetup.

@Override
protected void doSetup() throws Exception {
    defaultBackendUri = URI.create("distributedlog://" + cluster.getZkServers() + "/stream/storage");
    scheduler = OrderedScheduler.newSchedulerBuilder().name("table-client-test").numThreads(1).build();
    StorageClientSettings settings = StorageClientSettings.newBuilder().addEndpoints(cluster.getRpcEndpoints().toArray(new Endpoint[cluster.getRpcEndpoints().size()])).usePlaintext(true).build();
    String namespace = "test_namespace";
    adminClient = StorageClientBuilder.newBuilder().withSettings(settings).buildAdmin();
    storageClient = StorageClientBuilder.newBuilder().withSettings(settings).withNamespace(namespace).build();
}
Also used : StorageClientSettings(org.apache.bookkeeper.clients.config.StorageClientSettings) Endpoint(org.apache.bookkeeper.stream.proto.common.Endpoint)

Aggregations

Endpoint (org.apache.bookkeeper.stream.proto.common.Endpoint)20 Test (org.junit.Test)8 StorageClientSettings (org.apache.bookkeeper.clients.config.StorageClientSettings)7 NetUtils.createEndpoint (org.apache.bookkeeper.clients.utils.NetUtils.createEndpoint)3 NetUtils.parseEndpoint (org.apache.bookkeeper.clients.utils.NetUtils.parseEndpoint)3 OneStorageContainerEndpointResponse (org.apache.bookkeeper.stream.proto.storage.OneStorageContainerEndpointResponse)3 StorageConfiguration (org.apache.bookkeeper.stream.storage.conf.StorageConfiguration)3 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)3 JCommander (com.beust.jcommander.JCommander)2 Optional (java.util.Optional)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutionException (java.util.concurrent.ExecutionException)2 Slf4j (lombok.extern.slf4j.Slf4j)2 StorageServerChannel (org.apache.bookkeeper.clients.impl.channel.StorageServerChannel)2 StorageContainerEndpoint (org.apache.bookkeeper.stream.proto.storage.StorageContainerEndpoint)2 RangeStoreBuilder (org.apache.bookkeeper.stream.storage.RangeStoreBuilder)2 StorageResources (org.apache.bookkeeper.stream.storage.StorageResources)2 Parameter (com.beust.jcommander.Parameter)1 ByteString (com.google.protobuf.ByteString)1 Server (io.grpc.Server)1