use of com.canoo.dp.impl.client.legacy.communication.OnFinishedHandler in project dolphin-platform by canoo.
the class ClientConnectorTests method syncAndWaitUntilDone.
private void syncAndWaitUntilDone() {
clientConnector.send(new EmptyCommand(), new OnFinishedHandler() {
public void onFinished() {
syncDone.countDown();
}
});
Assert.assertTrue(waitForLatch());
}
use of com.canoo.dp.impl.client.legacy.communication.OnFinishedHandler in project dolphin-platform by canoo.
the class BlindCommandBatcherTest method doNonBlindForcesBatch.
public void doNonBlindForcesBatch() {
Assert.assertTrue(batcher.isEmpty());
List<CommandAndHandler> list = new ArrayList<CommandAndHandler>();
list.add(new CommandAndHandler(null));
list.add(new CommandAndHandler(null));
list.add(new CommandAndHandler(null));
list.add(new CommandAndHandler(null, new OnFinishedHandler() {
@Override
public void onFinished() {
}
}));
for (CommandAndHandler commandAndHandler : list) {
batcher.batch(commandAndHandler);
}
Assert.assertEquals(4, ((ArrayList<CommandAndHandler>) list).size());
try {
Assert.assertEquals(list.subList(0, 3), batcher.getWaitingBatches().getVal());
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
try {
Assert.assertEquals(Collections.singletonList(list.get(3)), batcher.getWaitingBatches().getVal());
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
use of com.canoo.dp.impl.client.legacy.communication.OnFinishedHandler in project dolphin-platform by canoo.
the class DolphinCommandHandler method invokeDolphinCommand.
public CompletableFuture<Void> invokeDolphinCommand(final Command command) {
Assert.requireNonNull(command, "command");
final CompletableFuture<Void> result = new CompletableFuture<>();
clientConnector.send(command, new OnFinishedHandler() {
@Override
public void onFinished() {
result.complete(null);
}
});
return result;
}
Aggregations