Search in sources :

Example 1 with ReplicaSystemHelper

use of org.apache.accumulo.server.replication.ReplicaSystemHelper in project accumulo by apache.

the class ReplicationProcessorTest method filesWhichMakeNoProgressArentReplicatedAgain.

@Test
public void filesWhichMakeNoProgressArentReplicatedAgain() throws Exception {
    ReplicaSystem replica = EasyMock.createMock(ReplicaSystem.class);
    ReplicaSystemHelper helper = EasyMock.createMock(ReplicaSystemHelper.class);
    ReplicationProcessor proc = EasyMock.createMockBuilder(ReplicationProcessor.class).addMockedMethods("getReplicaSystem", "doesFileExist", "getStatus", "getHelper").createMock();
    ReplicationTarget target = new ReplicationTarget("peer", "1", Table.ID.of("1"));
    Status status = Status.newBuilder().setBegin(0).setEnd(0).setInfiniteEnd(true).setClosed(true).build();
    Path path = new Path("/accumulo");
    String queueKey = DistributedWorkQueueWorkAssignerHelper.getQueueKey(path.toString(), target);
    EasyMock.expect(proc.getReplicaSystem(target)).andReturn(replica);
    EasyMock.expect(proc.getStatus(path.toString(), target)).andReturn(status);
    EasyMock.expect(proc.doesFileExist(path, target)).andReturn(true);
    EasyMock.expect(proc.getHelper()).andReturn(helper);
    EasyMock.expect(replica.replicate(path, status, target, helper)).andReturn(status);
    EasyMock.replay(replica, proc);
    proc.process(queueKey, path.toString().getBytes(UTF_8));
    EasyMock.verify(replica, proc);
}
Also used : Status(org.apache.accumulo.server.replication.proto.Replication.Status) Path(org.apache.hadoop.fs.Path) ReplicationTarget(org.apache.accumulo.core.replication.ReplicationTarget) ReplicaSystemHelper(org.apache.accumulo.server.replication.ReplicaSystemHelper) ReplicaSystem(org.apache.accumulo.server.replication.ReplicaSystem) Test(org.junit.Test)

Aggregations

ReplicationTarget (org.apache.accumulo.core.replication.ReplicationTarget)1 ReplicaSystem (org.apache.accumulo.server.replication.ReplicaSystem)1 ReplicaSystemHelper (org.apache.accumulo.server.replication.ReplicaSystemHelper)1 Status (org.apache.accumulo.server.replication.proto.Replication.Status)1 Path (org.apache.hadoop.fs.Path)1 Test (org.junit.Test)1