Search in sources :

Example 1 with ExponentialBackoffRetry

use of org.apache.storm.shade.org.apache.curator.retry.ExponentialBackoffRetry in project storm by apache.

the class LocalFsBlobStoreSynchronizerTest method testNimbodesWithLatestVersionOfBlob.

@Test
public void testNimbodesWithLatestVersionOfBlob() throws Exception {
    try (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");
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) CuratorFramework(org.apache.storm.shade.org.apache.curator.framework.CuratorFramework) ExponentialBackoffRetry(org.apache.storm.shade.org.apache.curator.retry.ExponentialBackoffRetry) NimbusInfo(org.apache.storm.nimbus.NimbusInfo) Test(org.junit.Test)

Aggregations

TestingServer (org.apache.curator.test.TestingServer)1 NimbusInfo (org.apache.storm.nimbus.NimbusInfo)1 CuratorFramework (org.apache.storm.shade.org.apache.curator.framework.CuratorFramework)1 ExponentialBackoffRetry (org.apache.storm.shade.org.apache.curator.retry.ExponentialBackoffRetry)1 Test (org.junit.Test)1