Example #1
-1
  @Before
  public void setUp() throws Exception {
    testingCluster = new TestingCluster(1);
    testingCluster.start();

    cf =
        CuratorFrameworkFactory.builder()
            .connectString(testingCluster.getConnectString())
            .retryPolicy(new ExponentialBackoffRetry(1, 10))
            .compressionProvider(new PotentiallyGzippedCompressionProvider(false))
            .build();
    cf.start();
    cf.create().creatingParentsIfNeeded().forPath(basePath);

    worker = new Worker("worker", "localhost", 3, "0");

    workerCuratorCoordinator =
        new WorkerCuratorCoordinator(
            jsonMapper,
            new IndexerZkConfig(
                new ZkPathsConfig() {
                  @Override
                  public String getBase() {
                    return basePath;
                  }
                },
                null,
                null,
                null,
                null,
                null),
            new TestRemoteTaskRunnerConfig(new Period("PT1S")),
            cf,
            worker);
    workerCuratorCoordinator.start();

    // Start a task monitor
    workerTaskMonitor = createTaskMonitor();
    jsonMapper.registerSubtypes(new NamedType(TestMergeTask.class, "test"));
    jsonMapper.registerSubtypes(new NamedType(TestRealtimeTask.class, "test_realtime"));
    workerTaskMonitor.start();

    task = TestMergeTask.createDummyTask("test");
  }