use of org.eclipse.smarthome.binding.dmx.internal.multiverse.BaseDmxChannel in project smarthome by eclipse.
the class DmxBridgeHandlerTest method assertRetrievingOfChannels.
@Test
public void assertRetrievingOfChannels() {
BaseDmxChannel channel = new BaseDmxChannel(TEST_UNIVERSE, TEST_CHANNEL);
BaseDmxChannel returnedChannel = bridgeHandler.getDmxChannel(channel, ThingBuilder.create(THING_TYPE_DIMMER, "testthing").build());
Integer channelId = returnedChannel.getChannelId();
assertThat(channelId, is(TEST_CHANNEL));
}
use of org.eclipse.smarthome.binding.dmx.internal.multiverse.BaseDmxChannel in project smarthome by eclipse.
the class BaseChannelTest method stringConversion.
@Test
public void stringConversion() {
// to string
BaseDmxChannel baseChannel = new BaseDmxChannel(5, 100);
assertThat(baseChannel.toString(), is(equalTo("5:100")));
// single channel from string with universe
String parseString = new String("2:100");
List<BaseDmxChannel> channelList = BaseDmxChannel.fromString(parseString, 0);
assertThat(channelList.size(), is(1));
assertThat(channelList.get(0).toString(), is(equalTo("2:100")));
// single channel from string without universe
parseString = new String("100");
channelList = BaseDmxChannel.fromString(parseString, 2);
assertThat(channelList.size(), is(1));
assertThat(channelList.get(0).toString(), is(equalTo("2:100")));
// two channels with channel width
parseString = new String("100/2");
channelList = BaseDmxChannel.fromString(parseString, 2);
assertThat(channelList.size(), is(2));
assertThat(channelList.get(0).toString(), is(equalTo("2:100")));
assertThat(channelList.get(1).toString(), is(equalTo("2:101")));
// to channels with comma
parseString = new String("100,102");
channelList = BaseDmxChannel.fromString(parseString, 2);
assertThat(channelList.size(), is(2));
assertThat(channelList.get(0).toString(), is(equalTo("2:100")));
assertThat(channelList.get(1).toString(), is(equalTo("2:102")));
// complex string
parseString = new String("257,100/3,426");
channelList = BaseDmxChannel.fromString(parseString, 2);
assertThat(channelList.size(), is(5));
assertThat(channelList.get(0).toString(), is(equalTo("2:257")));
assertThat(channelList.get(1).toString(), is(equalTo("2:100")));
assertThat(channelList.get(2).toString(), is(equalTo("2:101")));
assertThat(channelList.get(3).toString(), is(equalTo("2:102")));
assertThat(channelList.get(4).toString(), is(equalTo("2:426")));
}
use of org.eclipse.smarthome.binding.dmx.internal.multiverse.BaseDmxChannel in project smarthome by eclipse.
the class BaseChannelTest method creatingBaseChannelfromBaseChannel.
@Test
public void creatingBaseChannelfromBaseChannel() {
BaseDmxChannel baseChannel = new BaseDmxChannel(5, 100);
BaseDmxChannel copyChannel = new BaseDmxChannel(baseChannel);
assertThat(copyChannel.getChannelId(), is(100));
assertThat(copyChannel.getUniverseId(), is(5));
}
use of org.eclipse.smarthome.binding.dmx.internal.multiverse.BaseDmxChannel in project smarthome by eclipse.
the class BaseChannelTest method comparingChannels.
@Test
public void comparingChannels() {
BaseDmxChannel channel1 = new BaseDmxChannel(5, 100);
BaseDmxChannel channel2 = new BaseDmxChannel(7, 140);
assertThat(channel1.compareTo(channel2), is(-1));
assertThat(channel2.compareTo(channel1), is(1));
assertThat(channel1.compareTo(channel1), is(0));
}
Aggregations