use of org.apache.accumulo.fate.zookeeper.ZooReader in project accumulo by apache.
the class MasterReplicationCoordinatorTest method randomServer.
@Test
public void randomServer() {
Master master = EasyMock.createMock(Master.class);
ZooReader reader = EasyMock.createMock(ZooReader.class);
Instance inst = EasyMock.createMock(Instance.class);
EasyMock.expect(master.getInstance()).andReturn(inst);
EasyMock.expect(inst.getInstanceID()).andReturn("1234");
EasyMock.replay(master, reader, inst);
MasterReplicationCoordinator coordinator = new MasterReplicationCoordinator(master, reader);
TServerInstance inst1 = new TServerInstance(HostAndPort.fromParts("host1", 1234), "session");
Assert.assertEquals(inst1, coordinator.getRandomTServer(Collections.singleton(inst1), 0));
}
use of org.apache.accumulo.fate.zookeeper.ZooReader in project accumulo by apache.
the class MonitorUtil method getLocation.
public static String getLocation(Instance instance) throws KeeperException, InterruptedException {
ZooReader zr = new ZooReader(instance.getZooKeepers(), 30000);
byte[] loc = zr.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR_HTTP_ADDR, null);
return loc == null ? null : new String(loc, UTF_8);
}
Aggregations