Search in sources :

Example 1 with PresentationModelDeletedCommand

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

the class PresentationModelDeletedCommandEncoder method decode.

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

Example 2 with PresentationModelDeletedCommand

use of com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand 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 3 with PresentationModelDeletedCommand

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

the class DefaultModelSynchronizer method onDeleted.

@Override
public void onDeleted(final ClientPresentationModel model) {
    final Command command = new PresentationModelDeletedCommand(model.getId());
    send(command);
}
Also used : PresentationModelDeletedCommand(com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand) Command(com.canoo.dp.impl.remoting.legacy.communication.Command) CreatePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand) PresentationModelDeletedCommand(com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ValueChangedCommand(com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand)

Aggregations

PresentationModelDeletedCommand (com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand)3 ChangeAttributeMetadataCommand (com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)2 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)2 CreatePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand)2 ValueChangedCommand (com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand)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 DeletePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.DeletePresentationModelCommand)1 EmptyCommand (com.canoo.dp.impl.remoting.legacy.communication.EmptyCommand)1 Test (org.testng.annotations.Test)1