use of org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn in project accumulo by apache.
the class AccumuloReplicaSystemTest method dontSendEmptyDataToPeer.
@Test
public void dontSendEmptyDataToPeer() throws Exception {
Client replClient = createMock(Client.class);
AccumuloReplicaSystem ars = createMock(AccumuloReplicaSystem.class);
WalEdits edits = new WalEdits(Collections.emptyList());
WalReplication walReplication = new WalReplication(edits, 0, 0, 0);
ReplicationTarget target = new ReplicationTarget("peer", "2", Table.ID.of("1"));
DataInputStream input = null;
Path p = new Path("/accumulo/wals/tserver+port/" + UUID.randomUUID().toString());
Status status = null;
long sizeLimit = Long.MAX_VALUE;
String remoteTableId = target.getRemoteIdentifier();
TCredentials tcreds = null;
Set<Integer> tids = new HashSet<>();
WalClientExecReturn walClientExec = ars.new WalClientExecReturn(target, input, p, status, sizeLimit, remoteTableId, tcreds, tids);
expect(ars.getWalEdits(target, input, p, status, sizeLimit, tids)).andReturn(walReplication);
replay(replClient, ars);
ReplicationStats stats = walClientExec.execute(replClient);
verify(replClient, ars);
Assert.assertEquals(new ReplicationStats(0l, 0l, 0l), stats);
}
use of org.apache.accumulo.tserver.replication.AccumuloReplicaSystem.WalClientExecReturn in project accumulo by apache.
the class AccumuloReplicaSystemTest method consumedButNotSentDataShouldBeRecorded.
@Test
public void consumedButNotSentDataShouldBeRecorded() throws Exception {
Client replClient = createMock(Client.class);
AccumuloReplicaSystem ars = createMock(AccumuloReplicaSystem.class);
WalEdits edits = new WalEdits(Collections.emptyList());
WalReplication walReplication = new WalReplication(edits, 0, 5, 0);
ReplicationTarget target = new ReplicationTarget("peer", "2", Table.ID.of("1"));
DataInputStream input = null;
Path p = new Path("/accumulo/wals/tserver+port/" + UUID.randomUUID().toString());
Status status = null;
long sizeLimit = Long.MAX_VALUE;
String remoteTableId = target.getRemoteIdentifier();
TCredentials tcreds = null;
Set<Integer> tids = new HashSet<>();
WalClientExecReturn walClientExec = ars.new WalClientExecReturn(target, input, p, status, sizeLimit, remoteTableId, tcreds, tids);
expect(ars.getWalEdits(target, input, p, status, sizeLimit, tids)).andReturn(walReplication);
replay(replClient, ars);
ReplicationStats stats = walClientExec.execute(replClient);
verify(replClient, ars);
Assert.assertEquals(new ReplicationStats(0l, 0l, 5l), stats);
}
Aggregations