Пример #1
0
  @BeforeClass
  public static void onBeforeClass() throws Exception {
    ZkConfiguration conf1 = new ZkConfiguration();
    ZkConfiguration conf2 = new ZkConfiguration();
    conf1.setZKRootPath("LuceneLoadIntegrationTest/luceneCluster");
    conf2.setZKRootPath("LuceneLoadIntegrationTest/loadtestCluster");
    cleanup(conf1);
    cleanup(conf2);
    FileUtil.deleteFolder(new NodeConfiguration().getShardFolder());

    _zkServer = ZkKattaUtil.startZkServer(new ZkConfiguration());
    _luceneCluster = new KattaMiniCluster(LuceneServer.class, conf1, NODE_COUNT_LUCENE, 30000);
    _loadtestCluster = new KattaMiniCluster(SleepServer.class, conf2, NODE_COUNT_LOADTEST, 40000);
    _luceneCluster.setZkServer(_zkServer);
    _loadtestCluster.setZkServer(_zkServer);
    _luceneCluster.start();
    _loadtestCluster.start();

    TestUtil.waitUntilLeaveSafeMode(_luceneCluster.getMaster());
    TestUtil.waitUntilLeaveSafeMode(_loadtestCluster.getMaster());
    TestUtil.waitUntilNumberOfLiveNode(_luceneCluster.getProtocol(), NODE_COUNT_LUCENE);
    TestUtil.waitUntilNumberOfLiveNode(_loadtestCluster.getProtocol(), NODE_COUNT_LOADTEST);

    LOG.info("Deploying indices");
    deployIndex(_luceneCluster.getProtocol(), "index1", TestResources.INDEX1);

    // Verify setup.
    // LOG.info("\n\nLUCENE CLUSTER STRUCTURE:\n");
    // _luceneCluster.getProtocol().showStructure(false);
    // LOG.info("\n\nLOADTEST CLUSTER STRUCTURE:\n");
    // _loadtestCluster.getProtocol().showStructure(false);
  }
Пример #2
0
 private static void cleanup(ZkConfiguration conf) {
   FileUtil.deleteFolder(new File(conf.getZKDataDir()));
   FileUtil.deleteFolder(new File(conf.getZKDataLogDir()));
 }