]> git.basschouten.com Git - openhab-addons.git/blob
5b51a4afc1e40e17e3f8d6672b417a09754a79d6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mqtt.homeassistant.internal.handler;
14
15 import static org.openhab.binding.mqtt.homeassistant.generic.internal.MqttBindingConstants.*;
16
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.List;
20 import java.util.Map;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.openhab.core.config.core.Configuration;
24 import org.openhab.core.thing.Channel;
25 import org.openhab.core.thing.ThingUID;
26 import org.openhab.core.thing.type.ChannelTypeUID;
27
28 /**
29  * Static test definitions, like thing, bridge and channel definitions
30  *
31  * @author David Graeff - Initial contribution
32  */
33 @NonNullByDefault
34 public class ThingChannelConstants {
35     // Common ThingUID and ChannelUIDs
36     public static final ThingUID testHomeAssistantThing = new ThingUID(HOMEASSISTANT_MQTT_THING, "device234");
37
38     public static final ChannelTypeUID unknownChannel = new ChannelTypeUID(BINDING_ID, "unknown");
39
40     public static final String jsonPathJSON = "{ \"device\": { \"status\": { \"temperature\": 23.2 }}}";
41     public static final String jsonPathPattern = "$.device.status.temperature";
42
43     public static final List<Channel> thingChannelList = new ArrayList<>();
44     public static final List<Channel> thingChannelListWithJson = new ArrayList<>();
45
46     static Configuration textConfiguration() {
47         Map<String, Object> data = new HashMap<>();
48         data.put("stateTopic", "test/state");
49         data.put("commandTopic", "test/command");
50         return new Configuration(data);
51     }
52
53     static Configuration textConfigurationWithJson() {
54         Map<String, Object> data = new HashMap<>();
55         data.put("stateTopic", "test/state");
56         data.put("commandTopic", "test/command");
57         data.put("transformationPattern", "JSONPATH:" + jsonPathPattern);
58         return new Configuration(data);
59     }
60 }