Improve AutomationIntegrationJsonTest (#3760)

Signed-off-by: Jan N. Klug <github@klug.nrw>
pull/3766/head
J-N-K 2023-08-19 10:16:22 +02:00 committed by GitHub
parent 04eb32185c
commit a2401059e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -275,7 +275,8 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
} }
@Test @Test
public void assertThatARuleFromJsonFileIsAddedAutomaticallyAndTheRuntimeRuleHasResolvedModuleReferences() { public void assertThatARuleFromJsonFileIsAddedAutomaticallyAndTheRuntimeRuleHasResolvedModuleReferences()
throws InterruptedException {
logger.info( logger.info(
"assert that a rule from json file is added automatically and the runtime rule has resolved module references"); "assert that a rule from json file is added automatically and the runtime rule has resolved module references");
@ -333,6 +334,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
}; };
registerService(itemEventHandler); registerService(itemEventHandler);
Thread.sleep(1000);
eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem", OnOffType.ON)); eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem", OnOffType.ON));
waitForAssert(() -> { waitForAssert(() -> {
assertThat(itemEvent, is(notNullValue())); assertThat(itemEvent, is(notNullValue()));
@ -342,7 +344,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
} }
@Test @Test
public void assertThatARuleFromJsonFileIsExecutedCorrectly() throws ItemNotFoundException { public void assertThatARuleFromJsonFileIsExecutedCorrectly() throws ItemNotFoundException, InterruptedException {
logger.info("assert that rule added by json is executed correctly"); logger.info("assert that rule added by json is executed correctly");
waitForAssert(() -> { waitForAssert(() -> {
assertThat(ruleRegistry.getAll().isEmpty(), is(false)); assertThat(ruleRegistry.getAll().isEmpty(), is(false));
@ -378,6 +380,7 @@ public class AutomationIntegrationJsonTest extends JavaOSGiTest {
}; };
registerService(eventHandler); registerService(eventHandler);
Thread.sleep(1000);
eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem", OnOffType.ON)); eventPublisher.post(ItemEventFactory.createStateEvent("myMotionItem", OnOffType.ON));
waitForAssert(() -> { waitForAssert(() -> {
assertThat(itemEvent, is(notNullValue())); assertThat(itemEvent, is(notNullValue()));