• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BaseDistributedSearchTestCase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.solr.BaseDistributedSearchTestCase的典型用法代码示例。如果您正苦于以下问题:Java BaseDistributedSearchTestCase类的具体用法?Java BaseDistributedSearchTestCase怎么用?Java BaseDistributedSearchTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BaseDistributedSearchTestCase类属于org.apache.solr包,在下文中一共展示了BaseDistributedSearchTestCase类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: beforeTests

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
public static void beforeTests() throws Exception {
  // to run from IDE:
  // initCore("solr/collection1/conf/solrconfig.xml","solr/collection1/conf/schema.xml");
  
  // to build with maven
  // initCore("solrconfig.xml","schema.xml");

  assertU(adoc("id", "1", "foo", "elvis presley"));
  assertU(adoc("id", "2", "foo", "bob marley"));
  assertU(adoc("id", "3", "foo", "bob dylan"));
  assertU(adoc("id", "4", "foo", "the doors"));
  assertU(adoc("id", "5", "foo", "bob marley & the wailers"));
  assertU(adoc("id", "6", "foo", "bono"));
  assertU(adoc("id", "7", "foo", "bob marley & the wailers 2"));
  assertU(adoc("id", "8", "foo", "bob marley & the wailers 3"));
  assertU(adoc("id", "9", "foo", "bono and bob marley 1"));
  assertU(adoc("id", "10", "foo", "bono and bob marley 2"));
  assertU(adoc("id", "11", "foo", "bono and bob marley 3"));
  assertU(adoc("id", "12", "foo", "elvis"));
  assertU(adoc("id", "13", "foo", "elvis 2"));
  
  assertU("commit", BaseDistributedSearchTestCase.commit());
}
 
开发者ID:sematext,项目名称:solr-researcher,代码行数:24,代码来源:TestDistributedDymReSearcher.java


示例2: testRandom

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
public void testRandom() throws Exception {
  // Random r = random;
  // let's keep it deterministic since just the wrong
  // random stuff could cause failure because of an OOM (too big)

  NamedList nl;
  NamedList res;
  String cmp;

  for (int i=0; i<10000; i++) { // pump up the iterations for good stress testing
    nl = rNamedList(3);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    new JavaBinCodec(null).marshal(nl,baos);
    byte[] arr = baos.toByteArray();
    // System.out.println(arr.length);
    res = (NamedList) new JavaBinCodec().unmarshal(new ByteArrayInputStream(arr));
    cmp = BaseDistributedSearchTestCase.compare(nl, res, 0, null);

    if (cmp != null) {
      System.out.println(nl);
      System.out.println(res);
      fail(cmp);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:TestNamedListCodec.java


示例3: doTestIndexAndConfigReplication

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestIndexAndConfigReplication() throws Exception {
  clearIndexWithReplication();

  nDocs--;
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();

  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, numFound(masterQueryRsp));

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, numFound(slaveQueryRsp));

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);
  
  assertVersions(masterClient, slaveClient);

  //start config files replication test
  masterClient.deleteByQuery("*:*");
  masterClient.commit();

  //change the schema on master
  master.copyConfigFile(CONF_DIR + "schema-replication2.xml", "schema.xml");

  masterJetty.stop();

  masterJetty = createJetty(master);
  masterClient.shutdown();
  masterClient = createNewSolrServer(masterJetty.getLocalPort());

  slave.setTestPort(masterJetty.getLocalPort());
  slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");

  slaveJetty.stop();

  // setup an xslt dir to force subdir file replication
  File masterXsltDir = new File(master.getConfDir() + File.separator + "xslt");
  File masterXsl = new File(masterXsltDir, "dummy.xsl");
  assertTrue("could not make dir " + masterXsltDir, masterXsltDir.mkdirs());
  assertTrue(masterXsl.createNewFile());

  File slaveXsltDir = new File(slave.getConfDir() + File.separator + "xslt");
  File slaveXsl = new File(slaveXsltDir, "dummy.xsl");
  assertFalse(slaveXsltDir.exists());

  slaveJetty = createJetty(slave);
  slaveClient.shutdown();
  slaveClient = createNewSolrServer(slaveJetty.getLocalPort());

  //add a doc with new field and commit on master to trigger snappull from slave.
  index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "newname = " + 2000);
  masterClient.commit();

  assertEquals(1, numFound( rQuery(1, "*:*", masterClient)));
  
  slaveQueryRsp = rQuery(1, "*:*", slaveClient);
  assertVersions(masterClient, slaveClient);
  SolrDocument d = ((SolrDocumentList) slaveQueryRsp.get("response")).get(0);
  assertEquals("newname = 2000", (String) d.getFieldValue("newname"));

  assertTrue(slaveXsltDir.isDirectory());
  assertTrue(slaveXsl.exists());
  
  checkForSingleIndex(masterJetty);
  checkForSingleIndex(slaveJetty);
  
}
 
开发者ID:europeana,项目名称:search,代码行数:76,代码来源:TestReplicationHandler.java


示例4: doTestStopPoll

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestStopPoll() throws Exception {
  clearIndexWithReplication();

  // Test:
  // setup master/slave.
  // stop polling on slave, add a doc to master and verify slave hasn't picked it.
  nDocs--;
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();

  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, numFound(masterQueryRsp));

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, numFound(slaveQueryRsp));

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);

  // start stop polling test
  invokeReplicationCommand(slaveJetty.getLocalPort(), "disablepoll");
  
  index(masterClient, "id", 501, "name", "name = " + 501);
  masterClient.commit();

  //get docs from master and check if number is equal to master
  assertEquals(nDocs+1, numFound(rQuery(nDocs+1, "*:*", masterClient)));
  
  // NOTE: this test is wierd, we want to verify it DOESNT replicate...
  // for now, add a sleep for this.., but the logic is wierd.
  Thread.sleep(3000);
  
  //get docs from slave and check if number is not equal to master; polling is disabled
  assertEquals(nDocs, numFound(rQuery(nDocs, "*:*", slaveClient)));

  // re-enable replication
  invokeReplicationCommand(slaveJetty.getLocalPort(), "enablepoll");

  assertEquals(nDocs+1, numFound(rQuery(nDocs+1, "*:*", slaveClient)));
}
 
开发者ID:europeana,项目名称:search,代码行数:48,代码来源:TestReplicationHandler.java


示例5: doTestReplicateAfterStartup

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestReplicateAfterStartup() throws Exception {
  //stop slave
  slaveJetty.stop();

  nDocs--;
  masterClient.deleteByQuery("*:*");

  masterClient.commit();



  //change solrconfig having 'replicateAfter startup' option on master
  master.copyConfigFile(CONF_DIR + "solrconfig-master2.xml",
                        "solrconfig.xml");

  masterJetty.stop();

  masterJetty = createJetty(master);
  masterClient.shutdown();
  masterClient = createNewSolrServer(masterJetty.getLocalPort());
  
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();
  
  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, masterQueryResult.getNumFound());
  

  slave.setTestPort(masterJetty.getLocalPort());
  slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");

  //start slave
  slaveJetty = createJetty(slave);
  slaveClient.shutdown();
  slaveClient = createNewSolrServer(slaveJetty.getLocalPort());

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, slaveQueryResult.getNumFound());

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);

}
 
开发者ID:europeana,项目名称:search,代码行数:51,代码来源:TestReplicationHandler.java


示例6: doTestReplicateAfterStartupWithNoActivity

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestReplicateAfterStartupWithNoActivity() throws Exception {
  useFactory(null);
  try {
    
    // stop slave
    slaveJetty.stop();
    
    nDocs--;
    masterClient.deleteByQuery("*:*");
    
    masterClient.commit();
    
    // change solrconfig having 'replicateAfter startup' option on master
    master.copyConfigFile(CONF_DIR + "solrconfig-master2.xml",
        "solrconfig.xml");
    
    masterJetty.stop();
    
    masterJetty = createJetty(master);
    masterClient.shutdown();
    masterClient = createNewSolrServer(masterJetty.getLocalPort());
    
    for (int i = 0; i < nDocs; i++)
      index(masterClient, "id", i, "name", "name = " + i);
    
    masterClient.commit();
    
    // now we restart to test what happens with no activity before the slave
    // tries to
    // replicate
    masterJetty.stop();
    masterJetty.start(true);
    
    // masterClient = createNewSolrServer(masterJetty.getLocalPort());
    
    NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
    SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp
        .get("response");
    assertEquals(nDocs, masterQueryResult.getNumFound());
    
    slave.setTestPort(masterJetty.getLocalPort());
    slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
    
    // start slave
    slaveJetty = createJetty(slave);
    slaveClient.shutdown();
    slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
    
    // get docs from slave and check if number is equal to master
    NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
    SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp
        .get("response");
    assertEquals(nDocs, slaveQueryResult.getNumFound());
    
    // compare results
    String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult,
        slaveQueryResult, 0, null);
    assertEquals(null, cmp);
    
  } finally {
    resetFactory();
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:65,代码来源:TestReplicationHandler.java


示例7: doTestIndexAndConfigReplication

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestIndexAndConfigReplication() throws Exception {
  clearIndexWithReplication();

  nDocs--;
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();

  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, masterQueryResult.getNumFound());

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, slaveQueryResult.getNumFound());

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);

  //start config files replication test
  masterClient.deleteByQuery("*:*");
  masterClient.commit();

  //change the schema on master
  master.copyConfigFile(CONF_DIR + "schema-replication2.xml", "schema.xml");

  masterJetty.stop();

  masterJetty = createJetty(master);
  masterClient = createNewSolrServer(masterJetty.getLocalPort());

  slave.setTestPort(masterJetty.getLocalPort());
  slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");

  slaveJetty.stop();

  // setup an xslt dir to force subdir file replication
  File masterXsltDir = new File(master.getConfDir() + File.separator + "xslt");
  File masterXsl = new File(masterXsltDir, "dummy.xsl");
  assertTrue("could not make dir " + masterXsltDir, masterXsltDir.mkdirs());
  assertTrue(masterXsl.createNewFile());

  File slaveXsltDir = new File(slave.getConfDir() + File.separator + "xslt");
  File slaveXsl = new File(slaveXsltDir, "dummy.xsl");
  assertFalse(slaveXsltDir.exists());

  slaveJetty = createJetty(slave);
  slaveClient = createNewSolrServer(slaveJetty.getLocalPort());

  //add a doc with new field and commit on master to trigger snappull from slave.
  index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "newname = " + 2000);
  masterClient.commit();

  NamedList masterQueryRsp2 = rQuery(1, "*:*", masterClient);
  SolrDocumentList masterQueryResult2 = (SolrDocumentList) masterQueryRsp2.get("response");
  assertEquals(1, masterQueryResult2.getNumFound());

  slaveQueryRsp = rQuery(1, "*:*", slaveClient);
  SolrDocument d = ((SolrDocumentList) slaveQueryRsp.get("response")).get(0);
  assertEquals("newname = 2000", (String) d.getFieldValue("newname"));

  assertTrue(slaveXsltDir.isDirectory());
  assertTrue(slaveXsl.exists());
  
  checkForSingleIndex(masterJetty);
  checkForSingleIndex(slaveJetty);
  
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:73,代码来源:TestReplicationHandler.java


示例8: doTestStopPoll

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestStopPoll() throws Exception {
  clearIndexWithReplication();

  // Test:
  // setup master/slave.
  // stop polling on slave, add a doc to master and verify slave hasn't picked it.
  nDocs--;
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();

  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, masterQueryResult.getNumFound());

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, slaveQueryResult.getNumFound());

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);

  // start stop polling test
  invokeReplicationCommand(slaveJetty.getLocalPort(), "disablepoll");
  
  index(masterClient, "id", 501, "name", "name = " + 501);
  masterClient.commit();

  //get docs from master and check if number is equal to master
  masterQueryRsp = rQuery(nDocs+1, "*:*", masterClient);
  masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs+1, masterQueryResult.getNumFound());
  
  // NOTE: this test is wierd, we want to verify it DOESNT replicate...
  // for now, add a sleep for this.., but the logic is wierd.
  Thread.sleep(3000);
  
  //get docs from slave and check if number is not equal to master; polling is disabled
  slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, slaveQueryResult.getNumFound());

  // re-enable replication
  invokeReplicationCommand(slaveJetty.getLocalPort(), "enablepoll");

  slaveQueryRsp = rQuery(nDocs+1, "*:*", slaveClient);
  slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs+1, slaveQueryResult.getNumFound());   
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:54,代码来源:TestReplicationHandler.java


示例9: doTestReplicateAfterStartupWithNoActivity

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestReplicateAfterStartupWithNoActivity() throws Exception {
  useFactory(null);
  try {
    
    // stop slave
    slaveJetty.stop();
    
    nDocs--;
    masterClient.deleteByQuery("*:*");
    
    masterClient.commit();
    
    // change solrconfig having 'replicateAfter startup' option on master
    master.copyConfigFile(CONF_DIR + "solrconfig-master2.xml",
        "solrconfig.xml");
    
    masterJetty.stop();
    
    masterJetty = createJetty(master);
    masterClient = createNewSolrServer(masterJetty.getLocalPort());
    
    for (int i = 0; i < nDocs; i++)
      index(masterClient, "id", i, "name", "name = " + i);
    
    masterClient.commit();
    
    // now we restart to test what happens with no activity before the slave
    // tries to
    // replicate
    masterJetty.stop();
    masterJetty.start(true);
    
    // masterClient = createNewSolrServer(masterJetty.getLocalPort());
    
    NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
    SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp
        .get("response");
    assertEquals(nDocs, masterQueryResult.getNumFound());
    
    slave.setTestPort(masterJetty.getLocalPort());
    slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
    
    // start slave
    slaveJetty = createJetty(slave);
    slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
    
    // get docs from slave and check if number is equal to master
    NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
    SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp
        .get("response");
    assertEquals(nDocs, slaveQueryResult.getNumFound());
    
    // compare results
    String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult,
        slaveQueryResult, 0, null);
    assertEquals(null, cmp);
    
  } finally {
    resetFactory();
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:63,代码来源:TestReplicationHandler.java


示例10: doTestReplicateAfterCoreReload

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestReplicateAfterCoreReload() throws Exception {
  int docs = TEST_NIGHTLY ? 200000 : 0;
  
  //stop slave
  slaveJetty.stop();


  //change solrconfig having 'replicateAfter startup' option on master
  master.copyConfigFile(CONF_DIR + "solrconfig-master3.xml",
                        "solrconfig.xml");

  masterJetty.stop();

  masterJetty = createJetty(master);
  masterClient = createNewSolrServer(masterJetty.getLocalPort());

  masterClient.deleteByQuery("*:*");
  for (int i = 0; i < docs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();

  NamedList masterQueryRsp = rQuery(docs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(docs, masterQueryResult.getNumFound());
  
  slave.setTestPort(masterJetty.getLocalPort());
  slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");

  //start slave
  slaveJetty = createJetty(slave);
  slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
  
  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(docs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(docs, slaveQueryResult.getNumFound());
  
  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);
  
  Object version = getIndexVersion(masterClient).get("indexversion");
  NamedList<Object> commits = getCommits(masterClient);
  
  reloadCore(masterClient, "collection1");
  
  assertEquals(version, getIndexVersion(masterClient).get("indexversion"));
  assertEquals(commits.get("commits"), getCommits(masterClient).get("commits"));
  
  index(masterClient, "id", docs + 10, "name", "name = 1");
  index(masterClient, "id", docs + 20, "name", "name = 2");

  masterClient.commit();
  
  NamedList resp =  rQuery(docs + 2, "*:*", masterClient);
  masterQueryResult = (SolrDocumentList) resp.get("response");
  assertEquals(docs + 2, masterQueryResult.getNumFound());
  
  //get docs from slave and check if number is equal to master
  slaveQueryRsp = rQuery(docs + 2, "*:*", slaveClient);
  slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(docs + 2, slaveQueryResult.getNumFound());
  
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:67,代码来源:TestReplicationHandler.java


示例11: doTestReplicateAfterStartup

import org.apache.solr.BaseDistributedSearchTestCase; //导入依赖的package包/类
@Test
public void doTestReplicateAfterStartup() throws Exception {
  //stop slave
  slaveJetty.stop();

  nDocs--;
  masterClient.deleteByQuery("*:*");

  masterClient.commit();



  //change solrconfig having 'replicateAfter startup' option on master
  master.copyConfigFile(CONF_DIR + "solrconfig-master2.xml",
                        "solrconfig.xml");

  masterJetty.stop();

  masterJetty = createJetty(master);
  masterClient = createNewSolrServer(masterJetty.getLocalPort());
  
  for (int i = 0; i < nDocs; i++)
    index(masterClient, "id", i, "name", "name = " + i);

  masterClient.commit();
  
  NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
  SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
  assertEquals(nDocs, masterQueryResult.getNumFound());
  

  slave.setTestPort(masterJetty.getLocalPort());
  slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");

  //start slave
  slaveJetty = createJetty(slave);
  slaveClient = createNewSolrServer(slaveJetty.getLocalPort());

  //get docs from slave and check if number is equal to master
  NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
  SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
  assertEquals(nDocs, slaveQueryResult.getNumFound());

  //compare results
  String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
  assertEquals(null, cmp);

}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:49,代码来源:TestReplicationHandler.java



注:本文中的org.apache.solr.BaseDistributedSearchTestCase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VectorOptions类代码示例发布时间:2022-05-22
下一篇:
Java NetworkDispatcher类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap