Search in sources :

Example 1 with KNXBindingConfig

use of org.openhab.binding.knx.internal.config.KNXGenericBindingProvider.KNXBindingConfig in project openhab1-addons by openhab.

the class KNXGenericBindingProviderTest method testParseBindingConfig.

@Test
public void testParseBindingConfig() throws BindingConfigParseException, KNXFormatException {
    // method under Test
    KNXBindingConfig bindingConfigs = provider.parseBindingConfigString(item1, "<4/2/10+0/2/10, 5.005:4/2/11+0/2/11, +4/2/12, 4/2/13");
    // Assertions
    assertEquals(4, bindingConfigs.size());
    for (KNXBindingConfigItem bindingConfig : bindingConfigs) {
        assertEquals("item1", bindingConfig.itemName);
    }
    assertNotNull(bindingConfigs.get(0).readableDataPoint);
    assertNull(bindingConfigs.get(1).readableDataPoint);
    assertNull(bindingConfigs.get(2).readableDataPoint);
    assertNull(bindingConfigs.get(3).readableDataPoint);
    assertTrue(bindingConfigs.get(0).allDataPoints.contains(new GroupAddress("4/2/10")));
    assertTrue(bindingConfigs.get(0).allDataPoints.contains(new GroupAddress("0/2/10")));
    assertTrue(bindingConfigs.get(1).allDataPoints.contains(new GroupAddress("4/2/11")));
    assertTrue(bindingConfigs.get(1).allDataPoints.contains(new GroupAddress("0/2/11")));
    assertTrue(bindingConfigs.get(2).allDataPoints.contains(new GroupAddress("4/2/12")));
    assertTrue(bindingConfigs.get(3).allDataPoints.contains(new GroupAddress("4/2/13")));
    assertEquals(true, bindingConfigs.get(0).mainDataPoint instanceof CommandDP);
    assertEquals(true, bindingConfigs.get(1).mainDataPoint instanceof CommandDP);
    assertEquals(true, bindingConfigs.get(2).mainDataPoint instanceof StateDP);
    assertEquals(true, bindingConfigs.get(3).mainDataPoint instanceof CommandDP);
}
Also used : KNXBindingConfigItem(org.openhab.binding.knx.internal.config.KNXGenericBindingProvider.KNXBindingConfigItem) KNXBindingConfig(org.openhab.binding.knx.internal.config.KNXGenericBindingProvider.KNXBindingConfig) StateDP(tuwien.auto.calimero.datapoint.StateDP) GroupAddress(tuwien.auto.calimero.GroupAddress) CommandDP(tuwien.auto.calimero.datapoint.CommandDP) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 KNXBindingConfig (org.openhab.binding.knx.internal.config.KNXGenericBindingProvider.KNXBindingConfig)1 KNXBindingConfigItem (org.openhab.binding.knx.internal.config.KNXGenericBindingProvider.KNXBindingConfigItem)1 GroupAddress (tuwien.auto.calimero.GroupAddress)1 CommandDP (tuwien.auto.calimero.datapoint.CommandDP)1 StateDP (tuwien.auto.calimero.datapoint.StateDP)1