Search in sources :

Example 66 with TestingServer

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

the class ResumeCheckpointManuallyITCase method testExternalizedFSCheckpointsZookeeper.

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

Example 67 with TestingServer

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

the class ResumeCheckpointManuallyITCase method testExternalizedFullRocksDBCheckpointsWithLocalRecoveryZookeeper.

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

Example 68 with TestingServer

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

the class ResumeCheckpointManuallyITCase method testExternalizedIncrementalRocksDBCheckpointsWithLocalRecoveryZookeeper.

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

Example 69 with TestingServer

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

the class EventTimeWindowCheckpointingITCase method getConfiguration.

private Configuration getConfiguration() throws Exception {
    // print a message when starting a test method to avoid Travis' <tt>"Maven produced no
    // output for xxx seconds."</tt> messages
    System.out.println("Starting " + getClass().getCanonicalName() + "#" + name.getMethodName() + ".");
    // Testing HA Scenario / ZKCompletedCheckpointStore with incremental checkpoints
    StateBackendEnum stateBackendEnum = getStateBackend();
    if (ROCKSDB_INCREMENTAL_ZK.equals(stateBackendEnum)) {
        zkServer = new TestingServer();
        zkServer.start();
    }
    Configuration config = createClusterConfig();
    config.setInteger(NettyShuffleEnvironmentOptions.NETWORK_BUFFERS_PER_CHANNEL, buffersPerChannel);
    switch(stateBackendEnum) {
        case MEM:
            this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE);
            break;
        case FILE:
            {
                final File backups = tempFolder.newFolder().getAbsoluteFile();
                this.stateBackend = new FsStateBackend(Path.fromLocalFile(backups));
                break;
            }
        case ROCKSDB_FULL:
            {
                setupRocksDB(config, -1, false);
                break;
            }
        case ROCKSDB_INCREMENTAL:
            // Test RocksDB based timer service as well
            config.set(RocksDBOptions.TIMER_SERVICE_FACTORY, EmbeddedRocksDBStateBackend.PriorityQueueStateType.ROCKSDB);
            setupRocksDB(config, 16, true);
            break;
        case ROCKSDB_INCREMENTAL_ZK:
            {
                setupRocksDB(config, 16, true);
                break;
            }
        default:
            throw new IllegalStateException("No backend selected.");
    }
    // Configure DFS DSTL for this test as it might produce too much GC pressure if
    // ChangelogStateBackend is used.
    // Doing it on cluster level unconditionally as randomization currently happens on the job
    // level (environment); while this factory can only be set on the cluster level.
    FsStateChangelogStorageFactory.configure(config, tempFolder.newFolder());
    return config;
}
Also used : TestingServer(org.apache.curator.test.TestingServer) MiniClusterResourceConfiguration(org.apache.flink.runtime.testutils.MiniClusterResourceConfiguration) Configuration(org.apache.flink.configuration.Configuration) MemoryStateBackend(org.apache.flink.runtime.state.memory.MemoryStateBackend) File(java.io.File) FsStateBackend(org.apache.flink.runtime.state.filesystem.FsStateBackend)

Example 70 with TestingServer

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

the class CuratorZookeeperClientTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    int availablePort = SocketUtils.findAvailableTcpPort();
    ts = new TestingServer(availablePort);
    eventHoldingZookeeperEventWatcher = new EventHoldingZookeeperEventWatcher();
    curatorZookeeperClient = createCuratorZookeeperClient(ts.getConnectString(), eventHoldingZookeeperEventWatcher);
    curatorZookeeperClient.createPath(PARENT_PATH);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) BeforeClass(org.junit.BeforeClass)

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