use of org.apache.curator.test.TestingServer in project metron by apache.
the class ConfigurationFunctionsTest method setup.
@BeforeClass
public static void setup() throws Exception {
testZkServer = new TestingServer(true);
zookeeperUrl = testZkServer.getConnectString();
client = ConfigurationsUtils.getClient(zookeeperUrl);
client.start();
pushConfigs(SAMPLE_CONFIG_PATH);
pushConfigs(PARSER_CONFIGS_PATH);
}
use of org.apache.curator.test.TestingServer in project metron by apache.
the class ZKServerComponent method start.
@Override
public void start() throws UnableToStartException {
try {
testZkServer = new TestingServer(true);
zookeeperUrl = testZkServer.getConnectString();
if (postStartCallback.isPresent()) {
postStartCallback.get().accept(this);
}
} catch (Exception e) {
throw new UnableToStartException("Unable to start TestingServer", e);
}
}
use of org.apache.curator.test.TestingServer in project hive by apache.
the class TestActivePassiveHA method beforeTest.
@BeforeClass
public static void beforeTest() throws Exception {
MiniHS2.cleanupLocalDir();
zkServer = new TestingServer();
Class.forName(MiniHS2.getJdbcDriverName());
}
use of org.apache.curator.test.TestingServer in project hive by apache.
the class TestZookeeperLockManager method setup.
@Before
public void setup() {
conf = new HiveConf();
lockObjData = new HiveLockObjectData("1", "10", "SHARED", "show tables", conf);
hiveLock = new HiveLockObject(TABLE, lockObjData);
zLock = new ZooKeeperHiveLock(TABLE_LOCK_PATH, hiveLock, HiveLockMode.SHARED);
while (server == null) {
try {
server = new TestingServer();
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
client = builder.connectString(server.getConnectString()).retryPolicy(new RetryOneTime(1)).build();
client.start();
} catch (Exception e) {
System.err.println("Getting bind exception - retrying to allocate server");
server = null;
}
}
}
use of org.apache.curator.test.TestingServer in project pravega by pravega.
the class ZkStoreRetentionTest method testOwnershipOfExistingBucket.
@Test(timeout = 10000)
public void testOwnershipOfExistingBucket() throws Exception {
TestingServer zkServer2 = new TestingServerStarter().start();
zkServer2.start();
CuratorFramework zkClient2 = CuratorFrameworkFactory.newClient(zkServer2.getConnectString(), 10000, 1000, (r, e, s) -> false);
zkClient2.start();
ScheduledExecutorService executor2 = Executors.newScheduledThreadPool(10);
String hostId = UUID.randomUUID().toString();
StreamMetadataStore streamMetadataStore2 = StreamStoreFactory.createZKStore(zkClient2, 1, executor2);
TaskMetadataStore taskMetadataStore = TaskStoreFactory.createInMemoryStore(executor2);
HostControllerStore hostStore = HostStoreFactory.createInMemoryStore(HostMonitorConfigImpl.dummyConfig());
SegmentHelper segmentHelper = SegmentHelperMock.getSegmentHelperMock();
ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
StreamMetadataTasks streamMetadataTasks2 = new StreamMetadataTasks(streamMetadataStore2, hostStore, taskMetadataStore, segmentHelper, executor2, hostId, connectionFactory, false, "");
String scope = "scope1";
String streamName = "stream1";
streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope, streamName, RetentionPolicy.builder().build(), null, executor2).join();
String scope2 = "scope2";
String streamName2 = "stream2";
streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope2, streamName2, RetentionPolicy.builder().build(), null, executor2).join();
StreamCutService service2 = new StreamCutService(1, hostId, streamMetadataStore2, streamMetadataTasks2, executor2);
service2.startAsync();
service2.awaitRunning();
assertTrue(service2.getBuckets().stream().allMatch(x -> x.getRetentionFutureMap().size() == 2));
service2.stopAsync();
service2.awaitTerminated();
zkClient2.close();
zkServer2.close();
streamMetadataTasks2.close();
connectionFactory.close();
executor2.shutdown();
}
Aggregations