Search in sources :

Example 1 with DeletePresentationModelCommand

use of com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand in project dolphin-platform by canoo.

the class ClientConnectorTests method testHandle_DeletePresentationModel.

@Test
public void testHandle_DeletePresentationModel() {
    ClientPresentationModel p1 = clientModelStore.createModel("p1", null);
    p1.setClientSideOnly(true);
    ClientPresentationModel p2 = clientModelStore.createModel("p2", null);
    clientConnector.dispatchHandle(new DeletePresentationModelCommand(null));
    ClientPresentationModel model = new ClientPresentationModel("p3", Collections.<ClientAttribute>emptyList());
    clientConnector.dispatchHandle(new DeletePresentationModelCommand(model.getId()));
    clientConnector.dispatchHandle(new DeletePresentationModelCommand(p1.getId()));
    clientConnector.dispatchHandle(new DeletePresentationModelCommand(p2.getId()));
    Assert.assertNull(clientModelStore.findPresentationModelById(p1.getId()));
    Assert.assertNull(clientModelStore.findPresentationModelById(p2.getId()));
    syncAndWaitUntilDone();
    // 3 commands will have been transferred:
    // 1: delete of p1 (causes no DeletedPresentationModelNotification since client side only)
    // 2: delete of p2
    // 3: DeletedPresentationModelNotification caused by delete of p2
    assertCommandsTransmitted(4);
    int deletedPresentationModelNotificationCount = 0;
    for (Command c : clientConnector.getTransmittedCommands()) {
        if (c instanceof PresentationModelDeletedCommand) {
            deletedPresentationModelNotificationCount = deletedPresentationModelNotificationCount + 1;
        }
    }
    Assert.assertEquals(1, deletedPresentationModelNotificationCount);
}
Also used : PresentationModelDeletedCommand(com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand) InterruptLongPollCommand(com.canoo.dp.impl.remoting.legacy.commands.InterruptLongPollCommand) Command(com.canoo.dp.impl.remoting.legacy.communication.Command) StartLongPollCommand(com.canoo.dp.impl.remoting.legacy.commands.StartLongPollCommand) ValueChangedCommand(com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand) CreatePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand) PresentationModelDeletedCommand(com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand) AttributeMetadataChangedCommand(com.canoo.dp.impl.remoting.legacy.communication.AttributeMetadataChangedCommand) DeletePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand) EmptyCommand(com.canoo.dp.impl.remoting.legacy.communication.EmptyCommand) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ClientPresentationModel(com.canoo.dp.impl.client.legacy.ClientPresentationModel) DeletePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand) Test(org.testng.annotations.Test)

Example 2 with DeletePresentationModelCommand

use of com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand in project dolphin-platform by canoo.

the class DeletePresentationModelCommandEncoder method decode.

@Override
public DeletePresentationModelCommand decode(final JsonObject jsonObject) {
    final DeletePresentationModelCommand command = new DeletePresentationModelCommand();
    command.setPmId(getStringElement(jsonObject, PM_ID));
    return command;
}
Also used : DeletePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand)

Aggregations

DeletePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand)2 ClientPresentationModel (com.canoo.dp.impl.client.legacy.ClientPresentationModel)1 InterruptLongPollCommand (com.canoo.dp.impl.remoting.legacy.commands.InterruptLongPollCommand)1 StartLongPollCommand (com.canoo.dp.impl.remoting.legacy.commands.StartLongPollCommand)1 AttributeMetadataChangedCommand (com.canoo.dp.impl.remoting.legacy.communication.AttributeMetadataChangedCommand)1 ChangeAttributeMetadataCommand (com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)1 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)1 CreatePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand)1 EmptyCommand (com.canoo.dp.impl.remoting.legacy.communication.EmptyCommand)1 PresentationModelDeletedCommand (com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand)1 ValueChangedCommand (com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand)1 Test (org.testng.annotations.Test)1