Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
jruby_version: jruby-10.0.2.0
openhab_version: 5.1.3
- java_version: 21
jruby_version: jruby-10.0.5.0
jruby_version: jruby-10.0.6.0
openhab_version: 5.2.0-SNAPSHOT
steps:
- uses: actions/checkout@v6
Expand Down
7 changes: 7 additions & 0 deletions lib/openhab/rspec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ def launch_karaf(include_bindings: true,
rs.register_tracker(org.openhab.core.service.ReadyService::ReadyTracker.impl { continue.call }, filter)
end

# openHAB 5.2.0.M5+ can leave RuleEngineImpl.started false in the rspec
# harness even after the rule-engine startlevel marker is reached.
# Force it on so RuleEngineImpl.runRule won't drop triggered events.
rule_manager = OSGi.service("org.openhab.core.automation.RuleManager")
rule_manager.class.field_accessor :started
rule_manager.started = true unless rule_manager.started

begin
# load storage based type providers
ast = org.openhab.core.thing.binding.AbstractStorageBasedTypeProvider
Expand Down
13 changes: 8 additions & 5 deletions lib/openhab/rspec/mocks/synchronous_executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ def initialize
end

def submit(runnable)
return super unless Thread.current == main_thread

runnable.respond_to?(:run) ? runnable.run : runnable.call
if OpenHAB::Core.version < "5.1.0" # @deprecated OH5.1 remove the version guard
return super unless Thread.current == main_thread # rubocop:disable Style/SoleNestedConditional
end

java.util.concurrent.CompletableFuture.completed_future(nil)
value = runnable.respond_to?(:run) ? runnable.run : runnable.call
java.util.concurrent.CompletableFuture.completed_future(value)
end

def execute(runnable)
return super unless Thread.current == main_thread
if OpenHAB::Core.version < "5.1.0" # @deprecated OH5.1 remove the version guard
return super unless Thread.current == main_thread # rubocop:disable Style/SoleNestedConditional
end

runnable.run
end
Expand Down