This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch unomi-1.5.x
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit a07779e07ff8e99e21d0fbbbbd05d3acce246d8c
Author: kevan Jahanshahi <[email protected]>
AuthorDate: Wed Feb 24 15:15:21 2021 +0100

    UNOMI-419: fix SegmentsIT test to wait on full startup (#256)
---
 .../src/test/java/org/apache/unomi/itests/SegmentIT.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java 
b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
index b0b8dd7..2b63ed8 100644
--- a/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
@@ -22,7 +22,9 @@ import org.apache.unomi.api.conditions.Condition;
 import org.apache.unomi.api.segments.Segment;
 import org.apache.unomi.api.services.SegmentService;
 import org.apache.unomi.api.exceptions.BadSegmentConditionException;
+import org.apache.unomi.lifecycle.BundleWatcher;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.junit.PaxExam;
@@ -45,6 +47,19 @@ public class SegmentIT extends BaseIT {
     @Filter(timeout = 600000)
     protected SegmentService segmentService;
 
+
+    @Inject @Filter(timeout = 600000)
+    protected BundleWatcher bundleWatcher;
+
+    @Before
+    public void setUp() throws InterruptedException {
+        while (!bundleWatcher.isStartupComplete()) {
+            LOGGER.info("Waiting for startup to complete...");
+            Thread.sleep(1000);
+        }
+        removeItems(Segment.class);
+    }
+
     @Test
     public void testSegments() {
         Assert.assertNotNull("Segment service should be available", 
segmentService);

Reply via email to