Search in sources :

Example 6 with CommandAndHandler

use of com.canoo.dp.impl.client.legacy.communication.CommandAndHandler in project dolphin-platform by canoo.

the class StandardCommandBatcherTest method testOne.

@Test
public void testOne() {
    CommandAndHandler cah = new CommandAndHandler(null);
    batcher.batch(cah);
    try {
        Assert.assertEquals(Collections.singletonList(cah), batcher.getWaitingBatches().getVal());
    } catch (InterruptedException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
}
Also used : CommandAndHandler(com.canoo.dp.impl.client.legacy.communication.CommandAndHandler) Test(org.testng.annotations.Test)

Example 7 with CommandAndHandler

use of com.canoo.dp.impl.client.legacy.communication.CommandAndHandler in project dolphin-platform by canoo.

the class StandardCommandBatcherTest method testMultipleDoesNotBatch.

@Test
public void testMultipleDoesNotBatch() {
    List<CommandAndHandler> list = Arrays.asList(new CommandAndHandler(null), new CommandAndHandler(null), new CommandAndHandler(null));
    for (CommandAndHandler cwh : list) {
        batcher.batch(cwh);
    }
    try {
        Assert.assertEquals(Collections.singletonList(list.get(0)), batcher.getWaitingBatches().getVal());
        Assert.assertEquals(Collections.singletonList(list.get(1)), batcher.getWaitingBatches().getVal());
        Assert.assertEquals(Collections.singletonList(list.get(2)), batcher.getWaitingBatches().getVal());
    } catch (InterruptedException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
}
Also used : CommandAndHandler(com.canoo.dp.impl.client.legacy.communication.CommandAndHandler) Test(org.testng.annotations.Test)

Example 8 with CommandAndHandler

use of com.canoo.dp.impl.client.legacy.communication.CommandAndHandler in project dolphin-platform by canoo.

the class DolphinTestClientConnector method send.

@Override
public void send(Command command, OnFinishedHandler callback) {
    List<Command> answer = transmit(new ArrayList<>(Arrays.asList(command)));
    CommandAndHandler handler = new CommandAndHandler(command, callback);
    processResults(answer, new ArrayList<>(Arrays.asList(handler)));
}
Also used : StartLongPollCommand(com.canoo.dp.impl.remoting.legacy.commands.StartLongPollCommand) Command(com.canoo.dp.impl.remoting.legacy.communication.Command) CommandAndHandler(com.canoo.dp.impl.client.legacy.communication.CommandAndHandler)

Aggregations

CommandAndHandler (com.canoo.dp.impl.client.legacy.communication.CommandAndHandler)8 ArrayList (java.util.ArrayList)4 Test (org.testng.annotations.Test)4 ValueChangedCommand (com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand)2 OnFinishedHandler (com.canoo.dp.impl.client.legacy.communication.OnFinishedHandler)1 StartLongPollCommand (com.canoo.dp.impl.remoting.legacy.commands.StartLongPollCommand)1 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)1 CreatePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand)1