use of com.canoo.dp.impl.client.legacy.ClientAttribute in project dolphin-platform by canoo.
the class ClientConnectorTests method testValueChange_withQualifier.
@Test
public void testValueChange_withQualifier() {
syncDone = new CountDownLatch(1);
ClientAttribute attribute = new ClientAttribute("attr", "initialValue", "qualifier");
clientModelStore.registerAttribute(attribute);
attributeChangeListener.propertyChange(new PropertyChangeEvent(attribute, Attribute.VALUE_NAME, attribute.getValue(), "newValue"));
syncAndWaitUntilDone();
assertCommandsTransmitted(3);
Assert.assertEquals("newValue", attribute.getValue());
boolean valueChangedCommandFound = false;
for (Command c : clientConnector.getTransmittedCommands()) {
if (c instanceof ValueChangedCommand) {
}
valueChangedCommandFound = true;
}
Assert.assertTrue(valueChangedCommandFound);
}
use of com.canoo.dp.impl.client.legacy.ClientAttribute in project dolphin-platform by canoo.
the class TestDolphinCommandHandler method testInvocation.
@Test
public void testInvocation() throws Exception {
// Given:
final DolphinTestConfiguration configuration = createDolphinTestConfiguration();
final ServerModelStore serverModelStore = configuration.getServerModelStore();
final ClientModelStore clientModelStore = configuration.getClientModelStore();
final DolphinCommandHandler dolphinCommandHandler = new DolphinCommandHandler(configuration.getClientConnector());
final String modelId = UUID.randomUUID().toString();
clientModelStore.createModel(modelId, null, new ClientAttribute("myAttribute", "UNKNOWN"));
configuration.getServerConnector().register(new DolphinServerAction() {
@Override
public void registerIn(ActionRegistry registry) {
registry.register(TestChangeCommand.class, new CommandHandler() {
@Override
public void handleCommand(Command command, List response) {
serverModelStore.findPresentationModelById(modelId).getAttribute("myAttribute").setValue("Hello World");
}
});
}
});
// When:
dolphinCommandHandler.invokeDolphinCommand(new TestChangeCommand()).get();
// Then:
assertEquals(clientModelStore.findPresentationModelById(modelId).getAttribute("myAttribute").getValue(), "Hello World");
}
Aggregations