2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mqtt.homeassistant.internal.handler;
15 import static org.openhab.binding.mqtt.homeassistant.generic.internal.MqttBindingConstants.*;
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.List;
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;
29 * Static test definitions, like thing, bridge and channel definitions
31 * @author David Graeff - Initial contribution
34 public class ThingChannelConstants {
35 // Common ThingUID and ChannelUIDs
36 public static final ThingUID testHomeAssistantThing = new ThingUID(HOMEASSISTANT_MQTT_THING, "device234");
38 public static final ChannelTypeUID unknownChannel = new ChannelTypeUID(BINDING_ID, "unknown");
40 public static final String jsonPathJSON = "{ \"device\": { \"status\": { \"temperature\": 23.2 }}}";
41 public static final String jsonPathPattern = "$.device.status.temperature";
43 public static final List<Channel> thingChannelList = new ArrayList<>();
44 public static final List<Channel> thingChannelListWithJson = new ArrayList<>();
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);
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);