Search in sources :

Example 1 with ExecBindingConfig

use of org.openhab.binding.exec.internal.ExecGenericBindingProvider.ExecBindingConfig in project openhab1-addons by openhab.

the class ExecGenericBindingProviderTest method testParseBindingConfig.

@Test
public void testParseBindingConfig() throws BindingConfigParseException {
    ExecBindingConfig config = new ExecGenericBindingProvider.ExecBindingConfig();
    String bindingConfig = "ON:some command to execute, OFF: 'other command with comma\\, and \\'quotes\\' and slashes \\\\ ', *:and a fallback";
    SwitchItem item = new SwitchItem("");
    provider.parseLegacyOutBindingConfig(item, bindingConfig, config);
    Assert.assertEquals(3, config.size());
    Assert.assertEquals("some command to execute", config.get(OnOffType.ON).commandLine);
    Assert.assertEquals("other command with comma, and 'quotes' and slashes \\ ", config.get(OnOffType.OFF).commandLine);
    Assert.assertEquals("and a fallback", config.get(StringType.valueOf("*")).commandLine);
}
Also used : ExecBindingConfig(org.openhab.binding.exec.internal.ExecGenericBindingProvider.ExecBindingConfig) SwitchItem(org.openhab.core.library.items.SwitchItem) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 ExecBindingConfig (org.openhab.binding.exec.internal.ExecGenericBindingProvider.ExecBindingConfig)1 SwitchItem (org.openhab.core.library.items.SwitchItem)1