Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
assert configuring multiple links works (#4378)
Browse files Browse the repository at this point in the history
see #4323
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
  • Loading branch information
Simon Kaufmann authored and kaikreuzer committed Oct 5, 2017
1 parent 918eddf commit e4bcb6b
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,37 @@ public void testLinkConfiguration() {

}

@Test
public void testMultiLinkConfiguration() {
Collection<Thing> things = thingRegistry.getAll();
assertThat(things.size(), is(0));

String thingsModel = "Bridge hue:bridge:huebridge [ ipAddress = \"192.168.3.84\", userName = \"19fc3fa6fc870a4280a55f21315631f\" ] {"
+ "LCT001 bulb2 [ lightId = \"2\" ]" //
+ "LCT001 bulb3 [ lightId = \"3\" ]" //
+ "LCT001 bulb4 [ lightId = \"4\" ]" //
+ "}";
modelRepository.addOrRefreshModel(THINGS_TESTMODEL_NAME, new ByteArrayInputStream(thingsModel.getBytes()));

String itemsModel = "Color Light3Color \"Light3 Color\" { " + //
"channel=\"hue:LCT001:huebridge:bulb2:color,hue:LCT001:huebridge:bulb3:color\" [ value=1 ]," + //
"channel=\"hue:LCT001:huebridge:bulb4:color\" [ value=2 ]" + //
"}";
modelRepository.addOrRefreshModel(ITEMS_TESTMODEL_NAME, new ByteArrayInputStream(itemsModel.getBytes()));

waitForAssert(() -> {
assertThat(thingRegistry.getAll().size(), is(4));
assertThat(itemRegistry.getItems().size(), is(1));
assertThat(itemChannelLinkRegistry.getAll().size(), is(3));
});

assertEquals(new BigDecimal(1), itemChannelLinkRegistry.get("Light3Color -> hue:LCT001:huebridge:bulb2:color")
.getConfiguration().get("value"));
assertEquals(new BigDecimal(1), itemChannelLinkRegistry.get("Light3Color -> hue:LCT001:huebridge:bulb3:color")
.getConfiguration().get("value"));
assertEquals(new BigDecimal(2), itemChannelLinkRegistry.get("Light3Color -> hue:LCT001:huebridge:bulb4:color")
.getConfiguration().get("value"));

}

}

0 comments on commit e4bcb6b

Please sign in to comment.