Search in sources :

Example 1 with DLServer

use of com.twitter.distributedlog.service.DistributedLogCluster.DLServer in project distributedlog by twitter.

the class DistributedLogServerTestCase method setupNoAdHocCluster.

public void setupNoAdHocCluster() throws Exception {
    noAdHocCluster = createCluster(noAdHocConf);
    noAdHocCluster.start();
    noAdHocServer = new DLServer(noAdHocConf, noAdHocCluster.getUri(), 7002);
    noAdHocClient = createDistributedLogClient("no-ad-hoc-client");
}
Also used : DLServer(com.twitter.distributedlog.service.DistributedLogCluster.DLServer)

Example 2 with DLServer

use of com.twitter.distributedlog.service.DistributedLogCluster.DLServer in project distributedlog by twitter.

the class TestRegionUnavailable method setup.

@Before
@Override
public void setup() throws Exception {
    DistributedLogConfiguration localConf = new DistributedLogConfiguration();
    localConf.addConfiguration(conf);
    localConf.setFeatureProviderClass(TestFeatureProvider.class);
    DistributedLogConfiguration remoteConf = new DistributedLogConfiguration();
    remoteConf.addConfiguration(conf);
    super.setup();
    int localPort = 9010;
    int remotePort = 9020;
    for (int i = 0; i < numServersPerDC; i++) {
        localCluster.add(createDistributedLogServer(localConf, localPort + i));
        remoteCluster.add(createDistributedLogServer(remoteConf, remotePort + i));
    }
    Map<SocketAddress, String> regionMap = new HashMap<SocketAddress, String>();
    for (DLServer server : localCluster) {
        regionMap.put(server.getAddress(), "local");
    }
    for (DLServer server : remoteCluster) {
        regionMap.put(server.getAddress(), "remote");
    }
    client = createTwoRegionDLClient("two_regions_client", regionMap);
}
Also used : DistributedLogConfiguration(com.twitter.distributedlog.DistributedLogConfiguration) HashMap(java.util.HashMap) DLServer(com.twitter.distributedlog.service.DistributedLogCluster.DLServer) SocketAddress(java.net.SocketAddress) Before(org.junit.Before)

Example 3 with DLServer

use of com.twitter.distributedlog.service.DistributedLogCluster.DLServer in project distributedlog by twitter.

the class TestRegionUnavailable method testRegionUnavailable.

@Test(timeout = 60000)
public void testRegionUnavailable() throws Exception {
    String name = "dlserver-region-unavailable";
    registerStream(name);
    for (long i = 1; i <= 10; i++) {
        client.dlClient.write(name, ByteBuffer.wrap(("" + i).getBytes())).get();
    }
    // check local region
    for (DLServer server : localCluster) {
        checkStreams(0, server);
    }
}
Also used : DLServer(com.twitter.distributedlog.service.DistributedLogCluster.DLServer) Test(org.junit.Test)

Aggregations

DLServer (com.twitter.distributedlog.service.DistributedLogCluster.DLServer)3 DistributedLogConfiguration (com.twitter.distributedlog.DistributedLogConfiguration)1 SocketAddress (java.net.SocketAddress)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 Test (org.junit.Test)1