use of com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand in project dolphin-platform by canoo.
the class TestOptimizedJsonCodec method shouldDecodeValueChangedCommandWithUuid.
@Test
public void shouldDecodeValueChangedCommandWithUuid() {
final List<Command> commands = OptimizedJsonCodec.getInstance().decode("[{\"a_id\":\"3357S\",\"v\":\"{4b9e93fd-3738-4fe6-b2a4-1fea8d2e0dc4}\",\"id\":\"ValueChanged\"}]");
final ValueChangedCommand command = (ValueChangedCommand) commands.get(0);
assertThat(command.getAttributeId(), is("3357S"));
assertThat(command.getNewValue().toString(), is("{4b9e93fd-3738-4fe6-b2a4-1fea8d2e0dc4}"));
}
use of com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand in project dolphin-platform by canoo.
the class TestOptimizedJsonCodec method shouldEncodeValueChangedCommandWithNulls.
@Test
public void shouldEncodeValueChangedCommandWithNulls() {
final ValueChangedCommand command = new ValueChangedCommand();
command.setNewValue(null);
command.setAttributeId("3357S");
final String actual = OptimizedJsonCodec.getInstance().encode(Collections.<Command>singletonList(command));
assertThat(actual, is("[{\"a_id\":\"3357S\",\"id\":\"ValueChanged\"}]"));
}
use of com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand in project dolphin-platform by canoo.
the class TestOptimizedJsonCodec method shouldDecodeValueChangedCommandWithIntegers.
@Test
public void shouldDecodeValueChangedCommandWithIntegers() {
final List<Command> commands = OptimizedJsonCodec.getInstance().decode("[{\"a_id\":\"3357S\",\"v\":42,\"id\":\"ValueChanged\"}]");
final ValueChangedCommand command = (ValueChangedCommand) commands.get(0);
assertThat(command.getAttributeId(), is("3357S"));
assertThat(((Number) command.getNewValue()).intValue(), is(42));
}
use of com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand in project dolphin-platform by canoo.
the class TestOptimizedJsonCodec method shouldEncodeValueChangedCommandWithLong.
@Test
public void shouldEncodeValueChangedCommandWithLong() {
final ValueChangedCommand command = new ValueChangedCommand();
command.setNewValue(987654321234567890L);
command.setAttributeId("3357S");
final String actual = OptimizedJsonCodec.getInstance().encode(Collections.<Command>singletonList(command));
assertThat(actual, is("[{\"a_id\":\"3357S\",\"v\":987654321234567890,\"id\":\"ValueChanged\"}]"));
}
use of com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand in project dolphin-platform by canoo.
the class TestOptimizedJsonCodec method shouldDecodeValueChangedCommandWithBigInteger.
@Test
public void shouldDecodeValueChangedCommandWithBigInteger() {
final List<Command> commands = OptimizedJsonCodec.getInstance().decode("[{\"a_id\":\"3357S\",\"v\":987654321234567890,\"id\":\"ValueChanged\"}]");
final ValueChangedCommand command = (ValueChangedCommand) commands.get(0);
assertThat(command.getAttributeId(), is("3357S"));
assertThat(((Number) command.getNewValue()).longValue(), is(987654321234567890L));
}
Aggregations