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;
}
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);
}
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);
}
Aggregations