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);
}
Aggregations