use of org.apache.accumulo.manager.ManagerClientServiceHandler in project accumulo by apache.
the class ReplicationOperationsImplIT method getReplicationOperations.
/**
* Spoof out the Manager so we can call the implementation without starting a full instance.
*/
private ReplicationOperationsImpl getReplicationOperations() {
Manager manager = EasyMock.createMock(Manager.class);
EasyMock.expect(manager.getContext()).andReturn(context).anyTimes();
EasyMock.replay(manager);
final ManagerClientServiceHandler mcsh = new ManagerClientServiceHandler(manager) {
@Override
protected TableId getTableId(ClientContext context, String tableName) {
try {
return TableId.of(client.tableOperations().tableIdMap().get(tableName));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
ClientContext context = (ClientContext) client;
return new ReplicationOperationsImpl(context) {
@Override
protected boolean getManagerDrain(final TInfo tinfo, final TCredentials rpcCreds, final String tableName, final Set<String> wals) {
try {
return mcsh.drainReplicationTable(tinfo, rpcCreds, tableName, wals);
} catch (TException e) {
throw new RuntimeException(e);
}
}
};
}
Aggregations