Examples of ReplicationClient


Examples of org.apache.lucene.replicator.ReplicationClient

 
  @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));
  }
View Full Code Here

Examples of org.apache.lucene.replicator.ReplicationClient

 
  @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();
  }
View Full Code Here

Examples of org.apache.lucene.replicator.ReplicationClient

  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);
    }
  }
View Full Code Here

Examples of org.apache.lucene.replicator.ReplicationClient

 
  @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));
  }
View Full Code Here

Examples of org.tarantool.snapshot.ReplicationClient

import org.tarantool.snapshot.XLogReader.XLogEntry;

public class TestReplication {
  // @Test
  public void testReplication() throws IOException {
    ReplicationClient client = new ReplicationClient(SocketChannel.open(new InetSocketAddress("localhost", 33316)), 1L);
    for (int i = 0; i < 10; i++) {
      XLogEntry r = client.nextEntry();
    }
    client.close();
  }
View Full Code Here

Examples of org.tarantool.snapshot.ReplicationClient

        }
      }
    }));

    final ByteBuffer rowStartMarker = ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putInt(Const.ROW_START_MARKER);
    client = new ReplicationClient(SocketChannel.open(new InetSocketAddress("127.0.0.1", 33016)), lsn + 1L) {

      @Override
      protected ByteBuffer readBody(Header header) throws IOException {
        if (Backup.this.xlogChannel == null) {
          Backup.this.xlogChannel = nextFile(folder);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.