Package net.sf.katta.client

Examples of net.sf.katta.client.DeployClient


    }
    return optionMap;
  }

  protected static void addIndex(InteractionProtocol protocol, String name, String path, int replicationLevel) {
    IDeployClient deployClient = new DeployClient(protocol);
    if (name.trim().equals("*")) {
      throw new IllegalArgumentException("Index with name " + name + " isn't allowed.");
    }
    if (deployClient.existsIndex(name)) {
      throw new IllegalArgumentException("Index with name " + name + " already exists.");
    }

    try {
      long startTime = System.currentTimeMillis();
      IIndexDeployFuture deployFuture = deployClient.addIndex(name, path, replicationLevel);
      while (true) {
        long duration = System.currentTimeMillis() - startTime;
        if (deployFuture.getState() == IndexState.DEPLOYED) {
          System.out.println("\ndeployed index '" + name + "' in " + duration + " ms");
          break;
View Full Code Here


      printError("interrupted wait on index deployment");
    }
  }

  protected static void removeIndex(InteractionProtocol protocol, final String indexName) {
    IDeployClient deployClient = new DeployClient(protocol);
    if (!deployClient.existsIndex(indexName)) {
      throw new IllegalArgumentException("index '" + indexName + "' does not exist");
    }
    deployClient.removeIndex(indexName);
  }
View Full Code Here

    }
  }

  private static void deployIndex(InteractionProtocol protocol, String indexName, File index)
          throws InterruptedException {
    DeployClient deployClient1 = new DeployClient(protocol);
    IIndexDeployFuture deployment = deployClient1.addIndex(indexName, index.getAbsolutePath(), 1);
    LOG.info("Joining deployment on " + deployment.getClass().getName());
    deployment.joinDeployment();
  }
View Full Code Here

    InteractionProtocol protocol = new InteractionProtocol(zkClient, _miniCluster.getZkConfiguration());
    Master master = new Master(protocol, false);
    master.start();
    TestUtil.waitUntilBecomeMaster(master);

    final IDeployClient deployClient = new DeployClient(_protocol);
    WatchedEvent event = new WatchedEvent(new WatcherEvent(EventType.None.getIntValue(), KeeperState.Expired
            .getIntValue(), null));
    for (int i = 0; i < 25; i++) {
      final String indexName = "index" + i;
      IIndexDeployFuture deployFuture = deployClient.addIndex(indexName, INDEX_FILE.getAbsolutePath(), 1);
      zkClient.getEventLock().lock();
      zkClient.process(event);
      zkClient.getEventLock().unlock();
      IndexState indexState = deployFuture.joinDeployment();
      assertEquals("" + deployClient.getIndexMetaData(indexName).getDeployError(), IndexState.DEPLOYED, indexState);

      if (indexState == IndexState.ERROR) {
        IndexDeployError deployError = protocol.getIndexMD(indexName).getDeployError();
        Set<Shard> shards = protocol.getIndexMD(indexName).getShards();
        for (Shard shard : shards) {
View Full Code Here

    super(2);
  }

  @Test
  public void measureSearchPerformance() throws Exception {
    DeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    deployClient.addIndex("index1", TestResources.INDEX1.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex("index2", TestResources.INDEX2.getAbsolutePath(), 1).joinDeployment();

    final ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("foo: bar");
    long start = System.currentTimeMillis();
    for (int i = 0; i < 10000; i++) {
View Full Code Here

    super(2, false, false);
  }

  @Override
  protected void afterClusterStart() throws Exception {
    IDeployClient _deployClient = new DeployClient(_miniCluster.getProtocol());
    // generate 3 index (2 shards + once combined index)
    _luceneIndex = File.createTempFile(LuceneClientTest.class.getSimpleName(), "-lucene");
    _kattaIndex = File.createTempFile(LuceneClientTest.class.getSimpleName(), "-katta");
    _kattaIndex.delete();
    _luceneIndex.delete();
View Full Code Here

    super(SleepServer.class, 1, false, false);
  }

  @Override
  protected void afterClusterStart() throws Exception {
    IDeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    deployClient.addIndex(INDEX1, TestResources.MAP_FILE_A.getAbsolutePath(), 1).joinDeployment();
    _client = new SleepClient(new DefaultNodeSelectionPolicy(), _miniCluster.getZkConfiguration(),
            new ClientConfiguration());
  }
View Full Code Here

    _zkServer.shutdown();
  }

  private static void deployIndex(InteractionProtocol protocol, String indexName, File index)
          throws InterruptedException {
    DeployClient deployClient1 = new DeployClient(protocol);
    IIndexDeployFuture deployment = deployClient1.addIndex(indexName, index.getAbsolutePath(), 1);
    LOG.info("Joining deployment on " + deployment.getClass().getName());
    deployment.joinDeployment();
  }
View Full Code Here

    }
  }

  @Test
  public void testCleanupOfClientWatchesOnUndeploy_KATTA_182() throws Exception {
    IDeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    IndexMetaData indexMD = deployClient.getIndexMetaData(INDEX1);
    deployClient.removeIndex(INDEX1);
    TestUtil.waitUntilShardsUndeployed(_protocol, indexMD);

    Client client = _client.getClient();
    assertThat(client.getIndices()).excludes((Object) INDEX_1);
    Map<String, Set<Watcher>> existWatches = getExistsWatches(client);
View Full Code Here

      // remove all indices
      if (_undeployIndicesAfterEachTest) {
        List<String> indices = _protocol.getIndices();
        for (String index : indices) {
          IndexMetaData indexMD = _protocol.getIndexMD(index);
          DeployClient deployClient = new DeployClient(_protocol);
          deployClient.removeIndex(index);
          TestUtil.waitUntilShardsUndeployed(_protocol, indexMD);
        }
      } else {
        List<String> indices = _protocol.getIndices();
        for (String index : indices) {
View Full Code Here

TOP

Related Classes of net.sf.katta.client.DeployClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.