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);
}
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));
}
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);
}
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();
}
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();
}
Aggregations