Search in sources :

Example 61 with TestingServer

use of org.apache.curator.test.TestingServer 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)

Example 62 with TestingServer

use of org.apache.curator.test.TestingServer in project Gaffer by gchq.

the class AddElementsFromKafkaHandlerIT method before.

@BeforeEach
public void before() throws Exception {
    bootstrapServers = "localhost:" + getOpenPort();
    // Create zookeeper server
    zkServer = new TestingServer(-1, createTemporaryDirectory("zkTmpDir"));
    zkServer.start();
    testFileSink = createTestFileSink();
    // Create kafka server
    kafkaServer = TestUtils.createServer(new KafkaConfig(serverProperties()), new MockTime());
    MapStore.resetStaticMap();
}
Also used : TestingServer(org.apache.curator.test.TestingServer) MockTime(kafka.utils.MockTime) KafkaConfig(kafka.server.KafkaConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 63 with TestingServer

use of org.apache.curator.test.TestingServer in project pinpoint by naver.

the class ZookeeperClusterTest method createZookeeperServer.

private static TestingServer createZookeeperServer(int port) throws Exception {
    TestingServer mockZookeeperServer = new TestingServer(port);
    mockZookeeperServer.start();
    return mockZookeeperServer;
}
Also used : TestingServer(org.apache.curator.test.TestingServer)

Example 64 with TestingServer

use of org.apache.curator.test.TestingServer in project flink by apache.

the class YARNHighAvailabilityITCase method setup.

@BeforeClass
public static void setup() throws Exception {
    zkServer = new TestingServer();
    storageDir = FOLDER.newFolder().getAbsolutePath();
    // startYARNWithConfig should be implemented by subclass
    YARN_CONFIGURATION.setClass(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class, ResourceScheduler.class);
    YARN_CONFIGURATION.set(YarnTestBase.TEST_CLUSTER_NAME_KEY, LOG_DIR);
    YARN_CONFIGURATION.setInt(YarnConfiguration.NM_PMEM_MB, 4096);
    startYARNWithConfig(YARN_CONFIGURATION);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) BeforeClass(org.junit.BeforeClass)

Example 65 with TestingServer

use of org.apache.curator.test.TestingServer in project flink by apache.

the class ResumeCheckpointManuallyITCase method testExternalizedIncrementalRocksDBCheckpointsZookeeper.

@Test
public void testExternalizedIncrementalRocksDBCheckpointsZookeeper() throws Exception {
    TestingServer zkServer = new TestingServer();
    zkServer.start();
    try {
        final File checkpointDir = temporaryFolder.newFolder();
        testExternalizedCheckpoints(checkpointDir, zkServer.getConnectString(), createRocksDBStateBackend(checkpointDir, true), false);
    } finally {
        zkServer.stop();
    }
}
Also used : TestingServer(org.apache.curator.test.TestingServer) File(java.io.File) Test(org.junit.Test)

Aggregations

TestingServer (org.apache.curator.test.TestingServer)150 Before (org.junit.Before)38 Test (org.junit.Test)30 CuratorFramework (org.apache.curator.framework.CuratorFramework)28 File (java.io.File)27 Properties (java.util.Properties)18 KafkaConfig (kafka.server.KafkaConfig)15 RetryOneTime (org.apache.curator.retry.RetryOneTime)15 Test (org.testng.annotations.Test)15 ExponentialBackoffRetry (org.apache.curator.retry.ExponentialBackoffRetry)14 IOException (java.io.IOException)13 Timing (org.apache.curator.test.Timing)13 HashMap (java.util.HashMap)12 ZkClient (org.I0Itec.zkclient.ZkClient)12 ServerSocket (java.net.ServerSocket)11 KafkaServerStartable (kafka.server.KafkaServerStartable)11 ZkUtils (kafka.utils.ZkUtils)11 ZkConnection (org.I0Itec.zkclient.ZkConnection)11 BeforeClass (org.junit.BeforeClass)11 TestingServerStarter (io.pravega.test.common.TestingServerStarter)9