Package net.sf.katta.client

Examples of net.sf.katta.client.DeployClient


  public List<String> deployTestIndexes(File indexFile, int deployCount, int replicationCount)
          throws InterruptedException {
    List<String> indices = new ArrayList<String>();
    ArrayList<IIndexDeployFuture> deployFutures = new ArrayList<IIndexDeployFuture>();
    IDeployClient deployClient = new DeployClient(_protocol);
    for (int i = 0; i < deployCount; i++) {
      String indexName = indexFile.getName() + i;
      IIndexDeployFuture deployFuture = deployClient.addIndex(indexName, indexFile.getAbsolutePath(), replicationCount);
      indices.add(indexName);
      deployFutures.add(deployFuture);
    }
    for (IIndexDeployFuture deployFuture : deployFutures) {
      deployFuture.joinDeployment();
View Full Code Here


    super(MapFileServer.class, 2, false, false);
  }

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

  private static Logger LOG = Logger.getLogger(DeployUndeploySearchInLoop.class);

  public static void main(String[] args) throws Exception {
    LuceneClient luceneClient = new LuceneClient();
    ZkConfiguration zkConfig = new ZkConfiguration();
    DeployClient deployClient = new DeployClient(ZkKattaUtil.startZkClient(zkConfig, 60000), zkConfig);

    QueryParser parser = new QueryParser(Version.LUCENE_30, "field", new KeywordAnalyzer());
    Query query = parser.parse("foo: b*");

    int runThroughs = 2;
    while (true) {
      try {
        String indexName = "index" + runThroughs;
        LOG.info("deploying index '" + indexName + "'");
        deployClient.addIndex(indexName, "/Users/jz/Documents/workspace/ms/katta/src/test/testIndexA", 1)
                .joinDeployment();
      } catch (Exception e) {
        logException("deploy", e);
      }

      try {
        String indexName = "index" + (runThroughs - 1);
        LOG.info("undeploying index '" + indexName + "'");
        deployClient.removeIndex(indexName);
      } catch (Exception e) {
        logException("undeploy", e);
      }

      try {
View Full Code Here

  }

  @Test
  public void testAddRemoveIndices() throws Exception {
    ILuceneClient client = new LuceneClient(_protocol);
    IDeployClient deployClient = new DeployClient(_protocol);

    int listenerCountBeforeDeploys = _protocol.getRegisteredListenerCount();
    deployClient.addIndex("newIndex1", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex("newIndex2", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex("newIndex3", INDEX_FILE.getAbsolutePath(), 1).joinDeployment();
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse("content: the");
    client.search(query, new String[] { "newIndex1" }, 10);

    deployClient.removeIndex("newIndex1");
    deployClient.removeIndex("newIndex2");
    deployClient.removeIndex("newIndex3");
    Thread.sleep(2000);
    assertEquals(listenerCountBeforeDeploys, _protocol.getRegisteredListenerCount());
  }
View Full Code Here

    document.add(new Field(binaryFieldName, bytesFieldContent, Store.YES));
    document.add(new Field(textFieldName, textFieldContent, Store.NO, Index.ANALYZED));
    indexWriter.addDocument(document);
    indexWriter.optimize();
    indexWriter.close();
    DeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    IndexState indexState = deployClient.addIndex(index.getName(), index.getParentFile().getAbsolutePath(), 1)
            .joinDeployment();
    assertEquals(IndexState.DEPLOYED, indexState);

    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(textFieldName + ": "
View Full Code Here

    document.add(new Field("text", "abc2", Field.Store.YES, Index.NOT_ANALYZED));
    document.add(new NumericField("timesort", Field.Store.YES, false).setLongValue(1234567890123l));
    indexWriter2.addDocument(document);
    indexWriter2.close();

    DeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    String indexName = "sortIndex";
    IndexState indexState = deployClient.addIndex(indexName, sortIndex1.getParentFile().getAbsolutePath(), 1)
            .joinDeployment();
    assertEquals(IndexState.DEPLOYED, indexState);

    // query and compare results
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
View Full Code Here

      document.add(new Field(textFieldName, textField, Store.NO, Index.ANALYZED));
      indexWriter.addDocument(document);
    }
    indexWriter.optimize();
    indexWriter.close();
    DeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    IndexState indexState = deployClient.addIndex(sortIndex.getName(), sortIndex.getParentFile().getAbsolutePath(), 1)
            .joinDeployment();
    assertEquals(IndexState.DEPLOYED, indexState);

    // query and compare results
    ILuceneClient client = new LuceneClient(_miniCluster.getZkConfiguration());
View Full Code Here

  private void writeToLog(Hit hit) {
    LOG.info(hit.getNode() + " -- " + hit.getShard() + " -- " + hit.getScore() + " -- " + hit.getDocId());
  }

  private void deploy3Indices() throws Exception {
    DeployClient deployClient = new DeployClient(_miniCluster.getProtocol());
    deployClient.addIndex(INDEX1, TestResources.INDEX1.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex(INDEX2, TestResources.INDEX1.getAbsolutePath(), 1).joinDeployment();
    deployClient.addIndex(INDEX3, TestResources.INDEX1.getAbsolutePath(), 1).joinDeployment();
  }
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.