当前位置: 首页>>代码示例>>Java>>正文


Java Replicator类代码示例

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


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

示例1: testBasic

import org.apache.lucene.replicator.Replicator; //导入依赖的package包/类
@Test
public void testBasic() throws Exception {
  Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1", 
      getClientConnectionManager());
  ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null), 
      new PerSessionDirectoryFactory(clientWorkDir));
  
  publishRevision(1);
  client.updateNow();
  reopenReader();
  assertEquals(1, Integer.parseInt(reader.getIndexCommit().getUserData().get("ID"), 16));
  
  publishRevision(2);
  client.updateNow();
  reopenReader();
  assertEquals(2, Integer.parseInt(reader.getIndexCommit().getUserData().get("ID"), 16));
  
  client.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:20,代码来源:HttpReplicatorTest.java

示例2: testBasic

import org.apache.lucene.replicator.Replicator; //导入依赖的package包/类
@Test
public void testBasic() throws Exception {
  Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1", 
      getClientConnectionManager());
  ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null), 
      new PerSessionDirectoryFactory(clientWorkDir));
  
  publishRevision(1);
  client.updateNow();
  reopenReader();
  assertEquals(1, Integer.parseInt(reader.getIndexCommit().getUserData().get("ID"), 16));
  
  publishRevision(2);
  client.updateNow();
  reopenReader();
  assertEquals(2, Integer.parseInt(reader.getIndexCommit().getUserData().get("ID"), 16));
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:18,代码来源:HttpReplicatorTest.java

示例3: testServerErrors

import org.apache.lucene.replicator.Replicator; //导入依赖的package包/类
@Test  
public void testServerErrors() throws Exception {
  // tests the behaviour of the client when the server sends an error
  // must use BasicClientConnectionManager to test whether the client is closed correctly
  BasicHttpClientConnectionManager conMgr = new BasicHttpClientConnectionManager();
  Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1", conMgr);
  ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null), 
      new PerSessionDirectoryFactory(clientWorkDir));
  
  try {
    publishRevision(5);
    
    try {
      replicationServlet.setRespondWithError(true);
      client.updateNow();
      fail("expected exception");
    } catch (Throwable t) {
      // expected
    }
    
    replicationServlet.setRespondWithError(false);
    client.updateNow(); // now it should work
    reopenReader();
    assertEquals(5, Integer.parseInt(reader.getIndexCommit().getUserData().get("ID"), 16));
    
    client.close();
  } finally {
    replicationServlet.setRespondWithError(false);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:HttpReplicatorTest.java

示例4: ReplicationService

import org.apache.lucene.replicator.Replicator; //导入依赖的package包/类
public ReplicationService(Map<String,Replicator> replicators) {
  super();
  this.replicators = replicators;
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:ReplicationService.java


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