Skip to content

Commit

Permalink
[mqtt.homie] remove unused constants in tests (openhab#12242)
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Nick Waterton <[email protected]>
  • Loading branch information
ccutrer authored and NickWaterton committed Apr 27, 2022
1 parent ffaa215 commit 889279b
Showing 1 changed file with 0 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,13 @@

import static org.openhab.binding.mqtt.homie.generic.internal.MqttBindingConstants.*;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.openhab.core.config.core.Configuration;
import org.openhab.core.thing.Channel;
import org.openhab.core.thing.ThingUID;
import org.openhab.core.thing.type.ChannelTypeUID;

/**
* Static test definitions, like thing, bridge and channel definitions
*
* @author David Graeff - Initial contribution
*/
public class ThingChannelConstants {
// Common ThingUID and ChannelUIDs
public static final ThingUID TEST_HOMIE_THING = new ThingUID(HOMIE300_MQTT_THING, "device123");

public static final ChannelTypeUID UNKNOWN_CHANNEL = new ChannelTypeUID(BINDING_ID, "unknown");

public static final String JSON_PATH_JSON = "{ \"device\": { \"status\": { \"temperature\": 23.2 }}}";
public static final String JSON_PATH_PATTERN = "$.device.status.temperature";

public static final List<Channel> THING_CHANNEL_LIST = new ArrayList<>();
public static final List<Channel> THING_CHANNEL_LIST_WITH_JSON = new ArrayList<>();

static Configuration textConfiguration() {
Map<String, Object> data = new HashMap<>();
data.put("stateTopic", "test/state");
data.put("commandTopic", "test/command");
return new Configuration(data);
}

static Configuration textConfigurationWithJson() {
Map<String, Object> data = new HashMap<>();
data.put("stateTopic", "test/state");
data.put("commandTopic", "test/command");
data.put("transformationPattern", "JSONPATH:" + JSON_PATH_PATTERN);
return new Configuration(data);
}

private static Configuration numberConfiguration() {
Map<String, Object> data = new HashMap<>();
data.put("stateTopic", "test/state");
data.put("commandTopic", "test/command");
data.put("min", BigDecimal.valueOf(1));
data.put("max", BigDecimal.valueOf(99));
data.put("step", BigDecimal.valueOf(2));
data.put("isDecimal", true);
return new Configuration(data);
}

private static Configuration percentageConfiguration() {
Map<String, Object> data = new HashMap<>();
data.put("stateTopic", "test/state");
data.put("commandTopic", "test/command");
data.put("on", "ON");
data.put("off", "OFF");
return new Configuration(data);
}

private static Configuration onoffConfiguration() {
Map<String, Object> data = new HashMap<>();
data.put("stateTopic", "test/state");
data.put("commandTopic", "test/command");
data.put("on", "ON");
data.put("off", "OFF");
data.put("inverse", true);
return new Configuration(data);
}
}

0 comments on commit 889279b

Please sign in to comment.