Search in sources :

Example 1 with ThingDescriptionReader

use of org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionReader in project smarthome by eclipse.

the class Example method test.

@SuppressWarnings("unchecked")
@Test
public void test() throws Exception {
    File file = new File("./example/example.xml");
    URL channelsURL = file.toURI().toURL();
    ThingDescriptionReader reader = new ThingDescriptionReader();
    ThingDescriptionList thingList = (ThingDescriptionList) reader.readFromXML(channelsURL);
    thingList.stream().forEach(it -> {
        if (it instanceof ChannelTypeXmlResult) {
            ChannelType channelType = ((ChannelTypeXmlResult) it).toChannelType();
        }
    });
}
Also used : ThingDescriptionReader(org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionReader) ChannelTypeXmlResult(org.eclipse.smarthome.core.thing.xml.internal.ChannelTypeXmlResult) ThingDescriptionList(org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionList) File(java.io.File) ChannelType(org.eclipse.smarthome.core.thing.type.ChannelType) URL(java.net.URL) Test(org.junit.Test)

Aggregations

File (java.io.File)1 URL (java.net.URL)1 ChannelType (org.eclipse.smarthome.core.thing.type.ChannelType)1 ChannelTypeXmlResult (org.eclipse.smarthome.core.thing.xml.internal.ChannelTypeXmlResult)1 ThingDescriptionList (org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionList)1 ThingDescriptionReader (org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionReader)1 Test (org.junit.Test)1