Use "openhab" event topic prefix (#1587)
Signed-off-by: Wouter Born <github@maindrain.net>pull/1591/head
parent
86b02c26be
commit
7300734585
|
@ -43,13 +43,13 @@ public class RuleEventFactory extends AbstractEventFactory {
|
|||
|
||||
private final Logger logger = LoggerFactory.getLogger(RuleEventFactory.class);
|
||||
|
||||
private static final String RULE_STATE_EVENT_TOPIC = "smarthome/rules/{ruleID}/state";
|
||||
private static final String RULE_STATE_EVENT_TOPIC = "openhab/rules/{ruleID}/state";
|
||||
|
||||
private static final String RULE_ADDED_EVENT_TOPIC = "smarthome/rules/{ruleID}/added";
|
||||
private static final String RULE_ADDED_EVENT_TOPIC = "openhab/rules/{ruleID}/added";
|
||||
|
||||
private static final String RULE_REMOVED_EVENT_TOPIC = "smarthome/rules/{ruleID}/removed";
|
||||
private static final String RULE_REMOVED_EVENT_TOPIC = "openhab/rules/{ruleID}/removed";
|
||||
|
||||
private static final String RULE_UPDATED_EVENT_TOPIC = "smarthome/rules/{ruleID}/updated";
|
||||
private static final String RULE_UPDATED_EVENT_TOPIC = "openhab/rules/{ruleID}/updated";
|
||||
|
||||
private static final Set<String> SUPPORTED_TYPES = new HashSet<>();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ChannelEventTriggerHandler extends BaseTriggerModuleHandler impleme
|
|||
|
||||
public static final String CFG_CHANNEL_EVENT = "event";
|
||||
public static final String CFG_CHANNEL = "channelUID";
|
||||
public static final String TOPIC = "smarthome/channels/*/triggered";
|
||||
public static final String TOPIC = "openhab/channels/*/triggered";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ChannelEventTriggerHandler.class);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public class GroupCommandTriggerHandler extends BaseTriggerModuleHandler impleme
|
|||
this.types = Collections.singleton(ItemCommandEvent.TYPE);
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
this.topic = "smarthome/items/";
|
||||
this.topic = "openhab/items/";
|
||||
properties.put("event.topics", topic);
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class GroupStateTriggerHandler extends BaseTriggerModuleHandler implement
|
|||
}
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
properties.put("event.topics", "smarthome/items/*");
|
||||
properties.put("event.topics", "openhab/items/*");
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class GroupStateTriggerHandler extends BaseTriggerModuleHandler implement
|
|||
@Override
|
||||
public boolean apply(Event event) {
|
||||
logger.trace("->FILTER: {}:{}", event.getTopic(), groupName);
|
||||
return event.getTopic().startsWith("smarthome/items/");
|
||||
return event.getTopic().startsWith("openhab/items/");
|
||||
}
|
||||
|
||||
public void setItemRegistry(ItemRegistry itemRegistry) {
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ItemCommandTriggerHandler extends BaseTriggerModuleHandler implemen
|
|||
this.types = Collections.singleton(ItemCommandEvent.TYPE);
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
this.topic = "smarthome/items/" + itemName + "/command";
|
||||
this.topic = "openhab/items/" + itemName + "/command";
|
||||
properties.put("event.topics", topic);
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ItemStateTriggerHandler extends BaseTriggerModuleHandler implements
|
|||
}
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
properties.put("event.topics", "smarthome/items/" + itemName + "/*");
|
||||
properties.put("event.topics", "openhab/items/" + itemName + "/*");
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
}
|
||||
|
@ -143,6 +143,6 @@ public class ItemStateTriggerHandler extends BaseTriggerModuleHandler implements
|
|||
@Override
|
||||
public boolean apply(Event event) {
|
||||
logger.trace("->FILTER: {}:{}", event.getTopic(), itemName);
|
||||
return event.getTopic().contains("smarthome/items/" + itemName + "/");
|
||||
return event.getTopic().contains("openhab/items/" + itemName + "/");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class SystemTriggerHandler extends BaseTriggerModuleHandler implements Ev
|
|||
}
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
properties.put("event.topics", "smarthome/system/*");
|
||||
properties.put("event.topics", "openhab/system/*");
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class ThingStatusTriggerHandler extends BaseTriggerModuleHandler implemen
|
|||
}
|
||||
this.bundleContext = bundleContext;
|
||||
Dictionary<String, Object> properties = new Hashtable<>();
|
||||
properties.put("event.topics", "smarthome/things/" + thingUID + "/*");
|
||||
properties.put("event.topics", "openhab/things/" + thingUID + "/*");
|
||||
eventSubscriberRegistration = this.bundleContext.registerService(EventSubscriber.class.getName(), this,
|
||||
properties);
|
||||
}
|
||||
|
@ -144,6 +144,6 @@ public class ThingStatusTriggerHandler extends BaseTriggerModuleHandler implemen
|
|||
@Override
|
||||
public boolean apply(Event event) {
|
||||
logger.trace("->FILTER: {}: {}", event.getTopic(), thingUID);
|
||||
return event.getTopic().contains("smarthome/things/" + thingUID + "/");
|
||||
return event.getTopic().contains("openhab/things/" + thingUID + "/");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
"name": "eventTopic",
|
||||
"type": "TEXT",
|
||||
"label": "Topic",
|
||||
"description": "This is the topic, the trigger will listen to: >>smarthome/*<<",
|
||||
"description": "This is the topic, the trigger will listen to: >>openhab/*<<",
|
||||
"required": true,
|
||||
"default": "smarthome/*"
|
||||
"default": "openhab/*"
|
||||
},
|
||||
{
|
||||
"name": "eventSource",
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.osgi.service.component.annotations.Component;
|
|||
@Component(immediate = true, service = EventFactory.class)
|
||||
public class InboxEventFactory extends AbstractEventFactory {
|
||||
|
||||
static final String INBOX_ADDED_EVENT_TOPIC = "smarthome/inbox/{thingUID}/added";
|
||||
static final String INBOX_ADDED_EVENT_TOPIC = "openhab/inbox/{thingUID}/added";
|
||||
|
||||
static final String INBOX_REMOVED_EVENT_TOPIC = "smarthome/inbox/{thingUID}/removed";
|
||||
static final String INBOX_REMOVED_EVENT_TOPIC = "openhab/inbox/{thingUID}/removed";
|
||||
|
||||
static final String INBOX_UPDATED_EVENT_TOPIC = "smarthome/inbox/{thingUID}/updated";
|
||||
static final String INBOX_UPDATED_EVENT_TOPIC = "openhab/inbox/{thingUID}/updated";
|
||||
|
||||
/**
|
||||
* Constructs a new InboxEventFactory.
|
||||
|
|
|
@ -28,88 +28,87 @@ public class SseUtilTest {
|
|||
@Test
|
||||
public void testValidInvalidFilters() {
|
||||
// invalid
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/.*"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/\\w*/"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/.*"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/\\w*/"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("sm.*/test/"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome.*"), is(false));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab.*"), is(false));
|
||||
|
||||
// valid
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter(""), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter(", smarthome/*"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome,qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome , qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome, qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/test/test/test/test/test"), is(true));
|
||||
assertThat(
|
||||
SseUtil.isValidTopicFilter("smarthome/test/test/test/test/test, smarthome/test/test/test/test/test"),
|
||||
assertThat(SseUtil.isValidTopicFilter(", openhab/*"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab,qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab , qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab, qivicon"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/test/test/test/test/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/test/test/test/test/test, openhab/test/test/test/test/test"),
|
||||
is(true));
|
||||
assertThat(
|
||||
SseUtil.isValidTopicFilter(
|
||||
"smarthome/test/test/test/test/test, smarthome/test/test/test/test/test, smarthome,qivicon"),
|
||||
"openhab/test/test/test/test/test, openhab/test/test/test/test/test, openhab,qivicon"),
|
||||
is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("////////////"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("*/added"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("*added"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/test/test:test:123/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("smarthome/test/test-test-123-test:test:123/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/test/test:test:123/test"), is(true));
|
||||
assertThat(SseUtil.isValidTopicFilter("openhab/test/test-test-123-test:test:123/test"), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterMatchers() {
|
||||
List<String> regexes = SseUtil.convertToRegex(
|
||||
"smarthome/*/test/test/test/test, smarthome/test/*/test/test/test, smarthome,qivicon");
|
||||
List<String> regexes = SseUtil
|
||||
.convertToRegex("openhab/*/test/test/test/test, openhab/test/*/test/test/test, openhab,qivicon");
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(false));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(false));
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(1)), is(true));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(1)), is(false));
|
||||
assertThat("smarthome/asdf/ASDF/test/test/test".matches(regexes.get(1)), is(false));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(1)), is(true));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(1)), is(false));
|
||||
assertThat("openhab/asdf/ASDF/test/test/test".matches(regexes.get(1)), is(false));
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(2)), is(true));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(2)), is(true));
|
||||
assertThat("smarthome/asdf/ASDF/test/test/test".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/asdf/ASDF/test/test/test".matches(regexes.get(2)), is(true));
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(3)), is(false));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(3)), is(false));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(3)), is(false));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(3)), is(false));
|
||||
assertThat("qivicon/asdf/ASDF/test/test/test".matches(regexes.get(3)), is(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMoreFilterMatchers() {
|
||||
List<String> regexes = SseUtil.convertToRegex(", *, smarthome/items/*/added, smarthome/items");
|
||||
List<String> regexes = SseUtil.convertToRegex(", *, openhab/items/*/added, openhab/items");
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(true));
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(1)), is(false));
|
||||
assertThat("smarthome/items/anyitem/added".matches(regexes.get(1)), is(true));
|
||||
assertThat("smarthome/items/anyitem/removed".matches(regexes.get(1)), is(false));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(1)), is(false));
|
||||
assertThat("openhab/items/anyitem/added".matches(regexes.get(1)), is(true));
|
||||
assertThat("openhab/items/anyitem/removed".matches(regexes.get(1)), is(false));
|
||||
|
||||
assertThat("smarthome/items/anyitem/added".matches(regexes.get(2)), is(true));
|
||||
assertThat("smarthome/items/anyitem/removed".matches(regexes.get(2)), is(true));
|
||||
assertThat("smarthome/items/anyitem/updated".matches(regexes.get(2)), is(true));
|
||||
assertThat("smarthome/things/anything/updated".matches(regexes.get(2)), is(false));
|
||||
assertThat("openhab/items/anyitem/added".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/items/anyitem/removed".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/items/anyitem/updated".matches(regexes.get(2)), is(true));
|
||||
assertThat("openhab/things/anything/updated".matches(regexes.get(2)), is(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvenMoreFilterMatchers() {
|
||||
List<String> regexes = SseUtil.convertToRegex("");
|
||||
|
||||
assertThat("smarthome/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/test/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/test/test/test/test".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/asdf/ASDF/test/test/test".matches(regexes.get(0)), is(true));
|
||||
|
||||
regexes = SseUtil.convertToRegex("*/added");
|
||||
assertThat("smarthome/items/anyitem/added".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/items/anyitem/removed".matches(regexes.get(0)), is(false));
|
||||
assertThat("openhab/items/anyitem/added".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/items/anyitem/removed".matches(regexes.get(0)), is(false));
|
||||
|
||||
regexes = SseUtil.convertToRegex("*added");
|
||||
assertThat("smarthome/items/anyitem/added".matches(regexes.get(0)), is(true));
|
||||
assertThat("smarthome/items/anyitem/removed".matches(regexes.get(0)), is(false));
|
||||
assertThat("openhab/items/anyitem/added".matches(regexes.get(0)), is(true));
|
||||
assertThat("openhab/items/anyitem/removed".matches(regexes.get(0)), is(false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.openhab.core.thing.Thing;
|
|||
@NonNullByDefault
|
||||
public final class ThingConfigStatusSource extends ConfigStatusSource {
|
||||
|
||||
private static final String TOPIC = "smarthome/things/{thingUID}/config/status";
|
||||
private static final String TOPIC = "openhab/things/{thingUID}/config/status";
|
||||
|
||||
/**
|
||||
* Creates a new {@link ThingConfigStatusSource} for the given thing UID.
|
||||
|
|
|
@ -37,17 +37,17 @@ import org.osgi.service.component.annotations.Component;
|
|||
*/
|
||||
@Component(immediate = true, service = EventFactory.class)
|
||||
public class ThingEventFactory extends AbstractEventFactory {
|
||||
static final String THING_STATUS_INFO_EVENT_TOPIC = "smarthome/things/{thingUID}/status";
|
||||
static final String THING_STATUS_INFO_EVENT_TOPIC = "openhab/things/{thingUID}/status";
|
||||
|
||||
static final String THING_STATUS_INFO_CHANGED_EVENT_TOPIC = "smarthome/things/{thingUID}/statuschanged";
|
||||
static final String THING_STATUS_INFO_CHANGED_EVENT_TOPIC = "openhab/things/{thingUID}/statuschanged";
|
||||
|
||||
static final String THING_ADDED_EVENT_TOPIC = "smarthome/things/{thingUID}/added";
|
||||
static final String THING_ADDED_EVENT_TOPIC = "openhab/things/{thingUID}/added";
|
||||
|
||||
static final String THING_REMOVED_EVENT_TOPIC = "smarthome/things/{thingUID}/removed";
|
||||
static final String THING_REMOVED_EVENT_TOPIC = "openhab/things/{thingUID}/removed";
|
||||
|
||||
static final String THING_UPDATED_EVENT_TOPIC = "smarthome/things/{thingUID}/updated";
|
||||
static final String THING_UPDATED_EVENT_TOPIC = "openhab/things/{thingUID}/updated";
|
||||
|
||||
static final String CHANNEL_TRIGGERED_EVENT_TOPIC = "smarthome/channels/{channelUID}/triggered";
|
||||
static final String CHANNEL_TRIGGERED_EVENT_TOPIC = "openhab/channels/{channelUID}/triggered";
|
||||
|
||||
/**
|
||||
* Constructs a new ThingEventFactory.
|
||||
|
|
|
@ -37,9 +37,9 @@ public final class FirmwareEventFactory extends AbstractEventFactory {
|
|||
|
||||
static final String THING_UID_TOPIC_KEY = "{thingUID}";
|
||||
|
||||
static final String FIRMWARE_STATUS_TOPIC = "smarthome/things/{thingUID}/firmware/status";
|
||||
static final String FIRMWARE_UPDATE_PROGRESS_TOPIC = "smarthome/things/{thingUID}/firmware/update/progress";
|
||||
static final String FIRMWARE_UPDATE_RESULT_TOPIC = "smarthome/things/{thingUID}/firmware/update/result";
|
||||
static final String FIRMWARE_STATUS_TOPIC = "openhab/things/{thingUID}/firmware/status";
|
||||
static final String FIRMWARE_UPDATE_PROGRESS_TOPIC = "openhab/things/{thingUID}/firmware/update/progress";
|
||||
static final String FIRMWARE_UPDATE_RESULT_TOPIC = "openhab/things/{thingUID}/firmware/update/result";
|
||||
|
||||
/**
|
||||
* Creates a new firmware event factory.
|
||||
|
|
|
@ -35,9 +35,9 @@ import org.osgi.service.component.annotations.Component;
|
|||
@Component(immediate = true, service = EventFactory.class)
|
||||
public class LinkEventFactory extends AbstractEventFactory {
|
||||
|
||||
private static final String LINK_ADDED_EVENT_TOPIC = "smarthome/links/{linkID}/added";
|
||||
private static final String LINK_ADDED_EVENT_TOPIC = "openhab/links/{linkID}/added";
|
||||
|
||||
private static final String LINK_REMOVED_EVENT_TOPIC = "smarthome/links/{linkID}/removed";
|
||||
private static final String LINK_REMOVED_EVENT_TOPIC = "openhab/links/{linkID}/removed";
|
||||
|
||||
/**
|
||||
* Constructs a new LinkEventFactory.
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.osgi.service.component.annotations.Component;
|
|||
@Component(service = EventFactory.class, immediate = true)
|
||||
public class AddonEventFactory extends AbstractEventFactory {
|
||||
|
||||
static final String TOPIC_PREFIX = "smarthome/addons/{id}";
|
||||
static final String TOPIC_PREFIX = "openhab/addons/{id}";
|
||||
|
||||
static final String ADDON_INSTALLED_EVENT_TOPIC_POSTFIX = "/installed";
|
||||
static final String ADDON_UNINSTALLED_EVENT_TOPIC_POSTFIX = "/uninstalled";
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.osgi.service.component.annotations.Component;
|
|||
@NonNullByDefault
|
||||
public class SystemEventFactory extends AbstractEventFactory {
|
||||
|
||||
static final String SYSTEM_STARTLEVEL_TOPIC = "smarthome/system/startlevel";
|
||||
static final String SYSTEM_STARTLEVEL_TOPIC = "openhab/system/startlevel";
|
||||
|
||||
public SystemEventFactory() {
|
||||
super(Stream.of(StartlevelEvent.TYPE).collect(Collectors.toSet()));
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.osgi.service.event.EventHandler;
|
|||
* @author Stefan Bußweiler - Initial contribution
|
||||
* @author Markus Rathgeb - Return on received events as fast as possible (handle event in another thread)
|
||||
*/
|
||||
@Component(immediate = true, property = { "event.topics:String=smarthome" })
|
||||
@Component(immediate = true, property = { "event.topics:String=openhab" })
|
||||
public class OSGiEventManager implements EventHandler {
|
||||
|
||||
/** The event subscribers indexed by the event type. */
|
||||
|
|
|
@ -67,7 +67,7 @@ public class OSGiEventPublisher implements EventPublisher {
|
|||
if (event.getSource() != null) {
|
||||
properties.put("source", event.getSource());
|
||||
}
|
||||
eventAdmin.postEvent(new org.osgi.service.event.Event("smarthome", properties));
|
||||
eventAdmin.postEvent(new org.osgi.service.event.Event("openhab", properties));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -45,21 +45,21 @@ public class ItemEventFactory extends AbstractEventFactory {
|
|||
|
||||
private static final String CORE_LIBRARY_PACKAGE = "org.openhab.core.library.types.";
|
||||
|
||||
private static final String ITEM_COMAND_EVENT_TOPIC = "smarthome/items/{itemName}/command";
|
||||
private static final String ITEM_COMAND_EVENT_TOPIC = "openhab/items/{itemName}/command";
|
||||
|
||||
private static final String ITEM_STATE_EVENT_TOPIC = "smarthome/items/{itemName}/state";
|
||||
private static final String ITEM_STATE_EVENT_TOPIC = "openhab/items/{itemName}/state";
|
||||
|
||||
private static final String ITEM_STATE_PREDICTED_EVENT_TOPIC = "smarthome/items/{itemName}/statepredicted";
|
||||
private static final String ITEM_STATE_PREDICTED_EVENT_TOPIC = "openhab/items/{itemName}/statepredicted";
|
||||
|
||||
private static final String ITEM_STATE_CHANGED_EVENT_TOPIC = "smarthome/items/{itemName}/statechanged";
|
||||
private static final String ITEM_STATE_CHANGED_EVENT_TOPIC = "openhab/items/{itemName}/statechanged";
|
||||
|
||||
private static final String GROUPITEM_STATE_CHANGED_EVENT_TOPIC = "smarthome/items/{itemName}/{memberName}/statechanged";
|
||||
private static final String GROUPITEM_STATE_CHANGED_EVENT_TOPIC = "openhab/items/{itemName}/{memberName}/statechanged";
|
||||
|
||||
private static final String ITEM_ADDED_EVENT_TOPIC = "smarthome/items/{itemName}/added";
|
||||
private static final String ITEM_ADDED_EVENT_TOPIC = "openhab/items/{itemName}/added";
|
||||
|
||||
private static final String ITEM_REMOVED_EVENT_TOPIC = "smarthome/items/{itemName}/removed";
|
||||
private static final String ITEM_REMOVED_EVENT_TOPIC = "openhab/items/{itemName}/removed";
|
||||
|
||||
private static final String ITEM_UPDATED_EVENT_TOPIC = "smarthome/items/{itemName}/updated";
|
||||
private static final String ITEM_UPDATED_EVENT_TOPIC = "openhab/items/{itemName}/updated";
|
||||
|
||||
/**
|
||||
* Constructs a new ItemEventFactory.
|
||||
|
|
|
@ -68,7 +68,7 @@ public class GenericItemTest {
|
|||
ItemStateChangedEvent change = captor.getValue();
|
||||
|
||||
assertEquals(item.getName(), change.getItemName());
|
||||
assertEquals("smarthome/items/member1/statechanged", change.getTopic());
|
||||
assertEquals("openhab/items/member1/statechanged", change.getTopic());
|
||||
assertEquals(oldState, change.getOldItemState());
|
||||
assertEquals(item.getState(), change.getItemState());
|
||||
assertEquals(ItemStateChangedEvent.TYPE, change.getType());
|
||||
|
|
|
@ -27,7 +27,7 @@ public class AbstractEventFactoryTest {
|
|||
|
||||
private static final String SOURCE = "binding:type:id:channel";
|
||||
private static final String EVENT_TYPE = "SOME_EVENT_TYPE";
|
||||
private static final String EVENT_TOPIC = "smarthome/some/topic";
|
||||
private static final String EVENT_TOPIC = "openhab/some/topic";
|
||||
private static final String EVENT_PAYLOAD = "{\"some\":\"payload\"}";
|
||||
|
||||
@Test
|
||||
|
|
|
@ -50,11 +50,11 @@ public class ItemEventFactoryTest {
|
|||
private static final String ITEM_ADDED_EVENT_TYPE = ItemAddedEvent.TYPE;
|
||||
private static final String GROUPITEM_CHANGED_EVENT_TYPE = GroupItemStateChangedEvent.TYPE;
|
||||
|
||||
private static final String ITEM_COMMAND_EVENT_TOPIC = "smarthome/items/" + ITEM_NAME + "/command";
|
||||
private static final String ITEM_STATE_EVENT_TOPIC = "smarthome/items/" + ITEM_NAME + "/state";
|
||||
private static final String ITEM_STATE_PREDICTED_EVENT_TOPIC = "smarthome/items/" + ITEM_NAME + "/statepredicted";
|
||||
private static final String ITEM_ADDED_EVENT_TOPIC = "smarthome/items/" + ITEM_NAME + "/added";
|
||||
private static final String GROUPITEM_STATE_CHANGED_EVENT_TOPIC = "smarthome/items/" + GROUP_NAME + "/" + ITEM_NAME
|
||||
private static final String ITEM_COMMAND_EVENT_TOPIC = "openhab/items/" + ITEM_NAME + "/command";
|
||||
private static final String ITEM_STATE_EVENT_TOPIC = "openhab/items/" + ITEM_NAME + "/state";
|
||||
private static final String ITEM_STATE_PREDICTED_EVENT_TOPIC = "openhab/items/" + ITEM_NAME + "/statepredicted";
|
||||
private static final String ITEM_ADDED_EVENT_TOPIC = "openhab/items/" + ITEM_NAME + "/added";
|
||||
private static final String GROUPITEM_STATE_CHANGED_EVENT_TOPIC = "openhab/items/" + GROUP_NAME + "/" + ITEM_NAME
|
||||
+ "/statechanged";
|
||||
|
||||
private static final Command ITEM_COMMAND = OnOffType.ON;
|
||||
|
|
|
@ -248,7 +248,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
|||
assertThat(trigger.isPresent(), is(true));
|
||||
assertThat(trigger.get().getTypeUID(), is("core.GenericEventTrigger"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventSource"), is("myMotionItem"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("smarthome/items/*"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("openhab/items/*"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTypes"), is("ItemStateEvent"));
|
||||
Optional<? extends Action> action = rule.getActions().stream()
|
||||
.filter(a -> "ItemPostCommandActionID".equals(a.getId())).findFirst();
|
||||
|
@ -287,7 +287,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
|||
.filter(t -> "ItemStateChangeTriggerID".equals(t.getId())).findFirst();
|
||||
assertThat(trigger.isPresent(), is(true));
|
||||
assertThat(trigger.get().getTypeUID(), is("core.GenericEventTrigger"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("smarthome/items/*"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("openhab/items/*"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTypes"), is("ItemStateEvent"));
|
||||
Optional<? extends Action> action = rule.getActions().stream()
|
||||
.filter(a -> "ItemPostCommandActionID".equals(a.getId())).findFirst();
|
||||
|
@ -327,7 +327,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
}, 3000, 100);
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/myLampItem/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
|
|||
@Override
|
||||
public void receive(Event e) {
|
||||
logger.info("Event: {}", e.getTopic());
|
||||
if ("smarthome/items/myLampItem/command".equals(e.getTopic())) {
|
||||
if ("openhab/items/myLampItem/command".equals(e.getTopic())) {
|
||||
itemEvent = e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,11 +252,11 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
logger.info("assert that a rule with connections is executed");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("eventSource", "myMotionItem3");
|
||||
params.put("eventTopic", "smarthome/*");
|
||||
params.put("eventTopic", "openhab/*");
|
||||
params.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(params);
|
||||
params = new HashMap<>();
|
||||
params.put("eventTopic", "smarthome/*");
|
||||
params.put("eventTopic", "openhab/*");
|
||||
Configuration condition1Config = new Configuration(params);
|
||||
params = new HashMap<>();
|
||||
params.put("itemName", "myLampItem3");
|
||||
|
@ -320,11 +320,11 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
"assert that a rule with non existing moduleTypeHandler is added to the ruleRegistry in state UNINITIALIZED");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("eventSource", "myMotionItem");
|
||||
params.put("eventTopic", "smarthome/*");
|
||||
params.put("eventTopic", "openhab/*");
|
||||
params.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(params);
|
||||
params = new HashMap<>();
|
||||
params.put("topic", "smarthome/*");
|
||||
params.put("topic", "openhab/*");
|
||||
Configuration condition1Config = new Configuration(params);
|
||||
params = new HashMap<>();
|
||||
params.put("itemName", "myLampItem3");
|
||||
|
@ -416,7 +416,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
}, 3000, 100);
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/myLampItem3/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem3/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
}, 5000, 100);
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/myLampItem4/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem4/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
// Creation of RULE
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("eventSource", "myMotionItem2");
|
||||
params.put("eventTopic", "smarthome/*");
|
||||
params.put("eventTopic", "openhab/*");
|
||||
params.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(params);
|
||||
params = new HashMap<>();
|
||||
|
@ -738,7 +738,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
});
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/templ_LampItem/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/templ_LampItem/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
|
||||
|
@ -798,7 +798,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
});
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/xtempl_LampItem/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/xtempl_LampItem/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
|
||||
|
@ -905,7 +905,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
configs.put("eventSource", "myMotionItem2");
|
||||
configs.put("eventTopic", "smarthome/*");
|
||||
configs.put("eventTopic", "openhab/*");
|
||||
configs.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(configs);
|
||||
configs = new HashMap<>();
|
||||
|
@ -932,7 +932,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
// Creation of RULE
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
configs.put("eventSource", "myMotionItem5");
|
||||
configs.put("eventTopic", "smarthome/*");
|
||||
configs.put("eventTopic", "openhab/*");
|
||||
configs.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(configs);
|
||||
configs = new HashMap<>();
|
||||
|
@ -1013,7 +1013,7 @@ public class AutomationIntegrationTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertThat(itemEvent, is(notNullValue()));
|
||||
}, 3000, 100);
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/myLampItem5/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem5/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
"type": "core.GenericEventTrigger",
|
||||
"configuration": {
|
||||
"eventSource": "myMotionItem",
|
||||
"eventTopic": "smarthome/items/*",
|
||||
"eventTopic": "openhab/items/*",
|
||||
"eventTypes": "ItemStateEvent"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
"type": "core.GenericEventTrigger",
|
||||
"configuration": {
|
||||
"eventSource": "${onItem}",
|
||||
"eventTopic": "smarthome/items/*",
|
||||
"eventTopic": "openhab/items/*",
|
||||
"eventTypes": "ItemStateEvent"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"type": "core.GenericEventTrigger",
|
||||
"configuration": {
|
||||
"eventSource": "${triggerItem}",
|
||||
"eventTopic": "smarthome/items/*",
|
||||
"eventTopic": "openhab/items/*",
|
||||
"eventTypes": "ItemStateEvent"
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@
|
|||
"id": "ItemStateConditionID",
|
||||
"type": "core.GenericEventCondition",
|
||||
"configuration": {
|
||||
"topic": "smarthome/items/${triggerItem}/state",
|
||||
"topic": "openhab/items/${triggerItem}/state",
|
||||
"payload": ".*ON.*"
|
||||
},
|
||||
"inputs": {
|
||||
|
|
|
@ -112,7 +112,7 @@ public class RunRuleModuleTest extends JavaOSGiTest {
|
|||
|
||||
private Rule createOuterRule() {
|
||||
final Configuration outerRuleTriggerConfig = new Configuration(Collections.unmodifiableMap(Stream
|
||||
.of(new SimpleEntry<>("eventSource", "ruleTrigger"), new SimpleEntry<>("eventTopic", "smarthome/*"),
|
||||
.of(new SimpleEntry<>("eventSource", "ruleTrigger"), new SimpleEntry<>("eventTopic", "openhab/*"),
|
||||
new SimpleEntry<>("eventTypes", "ItemStateEvent"))
|
||||
.collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue()))));
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class RunRuleModuleTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertFalse(events.isEmpty());
|
||||
ItemCommandEvent event = (ItemCommandEvent) events.remove();
|
||||
assertEquals("smarthome/items/switch3/command", event.getTopic());
|
||||
assertEquals("openhab/items/switch3/command", event.getTopic());
|
||||
assertEquals(OnOffType.ON, event.getItemCommand());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class RuntimeRuleTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertFalse(events.isEmpty());
|
||||
ItemCommandEvent event = (ItemCommandEvent) events.remove();
|
||||
assertEquals("smarthome/items/myLampItem/command", event.getTopic());
|
||||
assertEquals("openhab/items/myLampItem/command", event.getTopic());
|
||||
assertEquals(OnOffType.ON, event.getItemCommand());
|
||||
});
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class RuntimeRuleTest extends JavaOSGiTest {
|
|||
@Test
|
||||
public void itemStateUpdatedBySimpleRule() throws ItemNotFoundException, InterruptedException {
|
||||
final Configuration triggerConfig = new Configuration(Stream
|
||||
.of(new SimpleEntry<>("eventSource", "myMotionItem2"), new SimpleEntry<>("eventTopic", "smarthome/*"),
|
||||
.of(new SimpleEntry<>("eventSource", "myMotionItem2"), new SimpleEntry<>("eventTopic", "openhab/*"),
|
||||
new SimpleEntry<>("eventTypes", "ItemStateEvent"))
|
||||
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
|
||||
final Configuration actionConfig = new Configuration(
|
||||
|
@ -190,7 +190,7 @@ public class RuntimeRuleTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> {
|
||||
assertFalse(events.isEmpty());
|
||||
ItemCommandEvent event = (ItemCommandEvent) events.remove();
|
||||
assertEquals("smarthome/items/myLampItem2/command", event.getTopic());
|
||||
assertEquals("openhab/items/myLampItem2/command", event.getTopic());
|
||||
assertEquals(OnOffType.ON, event.getItemCommand());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ public class ScriptRuleOSGiTest extends JavaOSGiTest {
|
|||
assertThat(trigger.isPresent(), is(true));
|
||||
assertThat(trigger.get().getTypeUID(), is("core.GenericEventTrigger"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventSource"), is("MyTrigger"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("smarthome/items/MyTrigger/state"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTopic"), is("openhab/items/MyTrigger/state"));
|
||||
assertThat(trigger.get().getConfiguration().get("eventTypes"), is("ItemStateEvent"));
|
||||
Optional<? extends Condition> condition1 = rule.getConditions().stream()
|
||||
.filter(c -> "condition".equals(c.getId())).findFirst();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"type": "core.GenericEventTrigger",
|
||||
"configuration": {
|
||||
"eventSource": "MyTrigger",
|
||||
"eventTopic": "smarthome/items/MyTrigger/state",
|
||||
"eventTopic": "openhab/items/MyTrigger/state",
|
||||
"eventTypes": "ItemStateEvent"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ public class RuleEventTest extends JavaOSGiTest {
|
|||
// Creation of RULE
|
||||
Map<String, Object> triggerCfgEntries = new HashMap<>();
|
||||
triggerCfgEntries.put("eventSource", "myMotionItem2");
|
||||
triggerCfgEntries.put("eventTopic", "smarthome/*");
|
||||
triggerCfgEntries.put("eventTopic", "openhab/*");
|
||||
triggerCfgEntries.put("eventTypes", "ItemStateEvent");
|
||||
Configuration triggerConfig = new Configuration(triggerCfgEntries);
|
||||
|
||||
|
@ -194,14 +194,14 @@ public class RuleEventTest extends JavaOSGiTest {
|
|||
registerService(itemEventHandler);
|
||||
eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem2", OnOffType.ON));
|
||||
waitForAssert(() -> assertThat(itemEvent, is(notNullValue())));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("smarthome/items/myLampItem2/command")));
|
||||
assertThat(itemEvent.getTopic(), is(equalTo("openhab/items/myLampItem2/command")));
|
||||
assertThat(((ItemCommandEvent) itemEvent).getItemCommand(), is(OnOffType.ON));
|
||||
assertThat(ruleEvents.size(), is(not(0)));
|
||||
assertThat(ruleEvents.stream().filter(e -> "smarthome/rules/myRule21/added".equals(e.getTopic())).findFirst()
|
||||
assertThat(ruleEvents.stream().filter(e -> "openhab/rules/myRule21/added".equals(e.getTopic())).findFirst()
|
||||
.isPresent(), is(true));
|
||||
assertThat(ruleEvents.stream().filter(e -> "smarthome/rules/myRule21/state".equals(e.getTopic())).findFirst()
|
||||
assertThat(ruleEvents.stream().filter(e -> "openhab/rules/myRule21/state".equals(e.getTopic())).findFirst()
|
||||
.isPresent(), is(true));
|
||||
List<Event> stateEvents = ruleEvents.stream().filter(e -> "smarthome/rules/myRule21/state".equals(e.getTopic()))
|
||||
List<Event> stateEvents = ruleEvents.stream().filter(e -> "openhab/rules/myRule21/state".equals(e.getTopic()))
|
||||
.collect(Collectors.toList());
|
||||
assertThat(stateEvents, is(notNullValue()));
|
||||
Optional<Event> runningEvent = stateEvents.stream()
|
||||
|
@ -231,7 +231,7 @@ public class RuleEventTest extends JavaOSGiTest {
|
|||
ruleRegistry.remove("myRule21");
|
||||
waitForAssert(() -> {
|
||||
assertThat(ruleRemovedEvent, is(notNullValue()));
|
||||
assertThat(ruleRemovedEvent.getTopic(), is(equalTo("smarthome/rules/myRule21/removed")));
|
||||
assertThat(ruleRemovedEvent.getTopic(), is(equalTo("openhab/rules/myRule21/removed")));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
|||
private static final String EVENT_TYPE_FACTORY_A_B = "EVENT_TYPE_FACTORY_A_B";
|
||||
private static final String EVENT_TYPE_FACTORY_C = "EVENT_TYPE_FACTORY_C";
|
||||
|
||||
private static final String TOPIC = "smarthome/some/topic";
|
||||
private static final String TOPIC = "openhab/some/topic";
|
||||
|
||||
private static final String TYPE_BASED_SUBSCRIBER_1 = "TYPE_BASED_SUBSCRIBER_1";
|
||||
private static final String TYPE_BASED_SUBSCRIBER_2 = "TYPE_BASED_SUBSCRIBER_2";
|
||||
|
|
|
@ -433,7 +433,7 @@ public class GroupItemOSGiTest extends JavaOSGiTest {
|
|||
@Test
|
||||
public void assertThatGroupItemPostsEventsForChangesCorrectly() {
|
||||
// from ItemEventFactory.GROUPITEM_STATE_CHANGED_EVENT_TOPIC
|
||||
String groupitemStateChangedEventTopic = "smarthome/items/{itemName}/{memberName}/statechanged";
|
||||
String groupitemStateChangedEventTopic = "openhab/items/{itemName}/{memberName}/statechanged";
|
||||
|
||||
events.clear();
|
||||
GroupItem groupItem = new GroupItem("root", new SwitchItem("mySwitch"), new GroupFunction.Equality());
|
||||
|
|
|
@ -144,7 +144,7 @@ public class AbstractItemEventSubscriberOSGiTest extends JavaOSGiTest {
|
|||
|
||||
@Override
|
||||
public String getTopic() {
|
||||
return "smarthome/items";
|
||||
return "openhab/items";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -262,7 +262,7 @@ public class BindingBaseClassesOSGiTest extends JavaOSGiTest {
|
|||
@Override
|
||||
public boolean apply(Event event) {
|
||||
return event.getTopic().equals(
|
||||
"smarthome/things/{thingUID}/config/status".replace("{thingUID}", thingUID.getAsString()));
|
||||
"openhab/things/{thingUID}/config/status".replace("{thingUID}", thingUID.getAsString()));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -877,7 +877,7 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
|
||||
@Override
|
||||
public @Nullable EventFilter getEventFilter() {
|
||||
return new TopicEventFilter("smarthome/items/.*/state");
|
||||
return new TopicEventFilter("openhab/items/.*/state");
|
||||
}
|
||||
};
|
||||
registerService(itemUpdateEventSubscriber);
|
||||
|
@ -887,7 +887,7 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
waitForAssert(() -> assertThat(receivedEvents.size(), is(1)));
|
||||
assertThat(receivedEvents.get(0), is(instanceOf(ItemStateEvent.class)));
|
||||
ItemStateEvent itemUpdateEvent = (ItemStateEvent) receivedEvents.get(0);
|
||||
assertThat(itemUpdateEvent.getTopic(), is("smarthome/items/name/state"));
|
||||
assertThat(itemUpdateEvent.getTopic(), is("openhab/items/name/state"));
|
||||
assertThat(itemUpdateEvent.getItemName(), is(itemName));
|
||||
assertThat(itemUpdateEvent.getSource(), is(CHANNEL_UID.toString()));
|
||||
assertThat(itemUpdateEvent.getItemState(), is(instanceOf(StringType.class)));
|
||||
|
@ -903,7 +903,7 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
|
||||
assertThat(receivedEvents.get(0), is(instanceOf(ItemStateEvent.class)));
|
||||
itemUpdateEvent = (ItemStateEvent) receivedEvents.get(0);
|
||||
assertThat(itemUpdateEvent.getTopic(), is("smarthome/items/name/state"));
|
||||
assertThat(itemUpdateEvent.getTopic(), is("openhab/items/name/state"));
|
||||
assertThat(itemUpdateEvent.getItemName(), is(itemName));
|
||||
assertThat(itemUpdateEvent.getSource(), is(CHANNEL_UID.toString()));
|
||||
assertThat(itemUpdateEvent.getItemState(), is(instanceOf(StringType.class)));
|
||||
|
@ -1257,7 +1257,7 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
|
||||
waitForAssert(() -> assertThat(infoChangedEvents.size(), is(1)));
|
||||
assertThat(infoChangedEvents.get(0).getType(), is(ThingStatusInfoChangedEvent.TYPE));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("openhab/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.INITIALIZING));
|
||||
assertThat(infoChangedEvents.get(0).getOldStatusInfo().getStatus(), is(ThingStatus.UNINITIALIZED));
|
||||
infoChangedEvents.clear();
|
||||
|
@ -1268,7 +1268,7 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
|
||||
waitForAssert(() -> assertThat(infoChangedEvents.size(), is(1)));
|
||||
assertThat(infoChangedEvents.get(0).getType(), is(ThingStatusInfoChangedEvent.TYPE));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("openhab/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.ONLINE));
|
||||
assertThat(infoChangedEvents.get(0).getOldStatusInfo().getStatus(), is(ThingStatus.INITIALIZING));
|
||||
infoChangedEvents.clear();
|
||||
|
@ -1362,13 +1362,13 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
});
|
||||
|
||||
assertThat(infoEvents.get(0).getType(), is(ThingStatusInfoEvent.TYPE));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("openhab/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.INITIALIZING));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getDescription(), is(nullValue()));
|
||||
|
||||
assertThat(infoChangedEvents.get(0).getType(), is(ThingStatusInfoChangedEvent.TYPE));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("openhab/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.INITIALIZING));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getDescription(), is(nullValue()));
|
||||
|
@ -1397,13 +1397,13 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
});
|
||||
|
||||
assertThat(infoEvents.get(0).getType(), is(ThingStatusInfoEvent.TYPE));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("openhab/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.ONLINE));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getDescription(), is("Thing is online."));
|
||||
|
||||
assertThat(infoChangedEvents.get(0).getType(), is(ThingStatusInfoChangedEvent.TYPE));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("openhab/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.ONLINE));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getDescription(), is("Thing is online."));
|
||||
|
@ -1428,13 +1428,13 @@ public class ThingManagerOSGiTest extends JavaOSGiTest {
|
|||
});
|
||||
|
||||
assertThat(infoEvents.get(0).getType(), is(ThingStatusInfoEvent.TYPE));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getTopic(), is("openhab/things/binding:type:id/status"));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.OFFLINE));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoEvents.get(0).getStatusInfo().getDescription(), is("Thing ist offline."));
|
||||
|
||||
assertThat(infoChangedEvents.get(0).getType(), is(ThingStatusInfoChangedEvent.TYPE));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("smarthome/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getTopic(), is("openhab/things/binding:type:id/statuschanged"));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatus(), is(ThingStatus.OFFLINE));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getStatusDetail(), is(ThingStatusDetail.NONE));
|
||||
assertThat(infoChangedEvents.get(0).getStatusInfo().getDescription(), is("Thing ist offline."));
|
||||
|
|
|
@ -82,11 +82,11 @@ public class LinkEventOSGiTest extends JavaOSGiTest {
|
|||
waitFor(() -> eventSubscriber.getLastReceivedEvent() != null);
|
||||
waitForAssert(
|
||||
() -> assertThat(eventSubscriber.getLastReceivedEvent().getType(), is(ItemChannelLinkAddedEvent.TYPE)));
|
||||
assertThat(eventSubscriber.getLastReceivedEvent().getTopic(), is("smarthome/links/item-a:b:c:d/added"));
|
||||
assertThat(eventSubscriber.getLastReceivedEvent().getTopic(), is("openhab/links/item-a:b:c:d/added"));
|
||||
|
||||
itemChannelLinkRegistry.remove(link.getUID());
|
||||
waitForAssert(() -> assertThat(eventSubscriber.getLastReceivedEvent().getType(),
|
||||
is(ItemChannelLinkRemovedEvent.TYPE)));
|
||||
assertThat(eventSubscriber.getLastReceivedEvent().getTopic(), is("smarthome/links/item-a:b:c:d/removed"));
|
||||
assertThat(eventSubscriber.getLastReceivedEvent().getTopic(), is("openhab/links/item-a:b:c:d/removed"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue