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