use of org.apache.curator.test.TestingServer in project hadoop by apache.
the class TestZKRMStateStore method setupCuratorServer.
public static TestingServer setupCuratorServer() throws Exception {
TestingServer curatorTestingServer = new TestingServer();
curatorTestingServer.start();
return curatorTestingServer;
}
use of org.apache.curator.test.TestingServer in project hadoop by apache.
the class TestRMStoreCommands method testFormatStateStoreCmdForZK.
@Test
public void testFormatStateStoreCmdForZK() throws Exception {
StateChangeRequestInfo req = new StateChangeRequestInfo(HAServiceProtocol.RequestSource.REQUEST_BY_USER);
try (TestingServer curatorTestingServer = TestZKRMStateStore.setupCuratorServer();
CuratorFramework curatorFramework = TestZKRMStateStore.setupCuratorFramework(curatorTestingServer)) {
Configuration conf = TestZKRMStateStore.createHARMConf("rm1,rm2", "rm1", 1234, false, curatorTestingServer);
ResourceManager rm = new MockRM(conf);
rm.start();
rm.getRMContext().getRMAdminService().transitionToActive(req);
String zkStateRoot = ZKRMStateStore.ROOT_ZNODE_NAME;
assertEquals("RM State store parent path should have a child node " + zkStateRoot, zkStateRoot, curatorFramework.getChildren().forPath(YarnConfiguration.DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH).get(0));
rm.close();
try {
ResourceManager.deleteRMStateStore(conf);
} catch (Exception e) {
fail("Exception should not be thrown during format rm state store" + " operation.");
}
assertTrue("After store format parent path should have no child nodes", curatorFramework.getChildren().forPath(YarnConfiguration.DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH).isEmpty());
}
}
use of org.apache.curator.test.TestingServer in project storm by apache.
the class BlobSynchronizerTest method testNimbodesWithLatestVersionOfBlob.
@Test
public void testNimbodesWithLatestVersionOfBlob() throws Exception {
TestingServer server = new TestingServer();
CuratorFramework zkClient = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3));
zkClient.start();
// Creating nimbus hosts containing latest version of blob
zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
zkClient.create().creatingParentContainersIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
Set<NimbusInfo> set = BlobStoreUtils.getNimbodesWithLatestSequenceNumberOfBlob(zkClient, "key1");
assertEquals("Failed to get the correct nimbus hosts with latest blob version", (set.iterator().next()).getHost(), "nimbus2");
zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus1:7800-1");
zkClient.delete().deletingChildrenIfNeeded().forPath("/blobstore/key1/nimbus2:7800-2");
zkClient.close();
server.close();
}
use of org.apache.curator.test.TestingServer in project Mycat-Server by MyCATApache.
the class DistributedSequenceHandlerTest method initialize.
@Before
public void initialize() throws Exception {
distributedSequenceHandler = new DistributedSequenceHandler[16];
MycatConfig mycatConfig = new MycatConfig();
testingServer = new TestingServer();
testingServer.start();
for (int i = 0; i < 16; i++) {
distributedSequenceHandler[i] = new DistributedSequenceHandler(mycatConfig.getSystem());
distributedSequenceHandler[i].initializeZK(testingServer.getConnectString());
distributedSequenceHandler[i].nextId("");
}
}
use of org.apache.curator.test.TestingServer in project Mycat-Server by MyCATApache.
the class IncrSequenceZKHandlerTest method initialize.
@Before
public void initialize() throws Exception {
testingServer = new TestingServer();
testingServer.start();
incrSequenceZKHandler = new IncrSequenceZKHandler[MAX_CONNECTION];
results = new ConcurrentSkipListSet();
}
Aggregations