You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by jk...@apache.org on 2022/05/21 15:22:23 UTC

[unomi] branch json-schema-extensions updated: try to Fix tests

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

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


The following commit(s) were added to refs/heads/json-schema-extensions by this push:
     new f1535722b try to Fix tests
f1535722b is described below

commit f1535722b33c106c739a8488c9d1c933e563c0d1
Author: Kevan <ke...@jahia.com>
AuthorDate: Sat May 21 17:22:12 2022 +0200

    try to Fix tests
---
 .../main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java  | 6 +++++-
 itests/src/test/java/org/apache/unomi/itests/BaseIT.java           | 5 -----
 itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java | 5 +++++
 .../src/test/java/org/apache/unomi/itests/InputValidationIT.java   | 7 +++++++
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
index bc3da0227..cdbbc6dab 100644
--- a/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
+++ b/extensions/json-schema/services/src/main/java/org/apache/unomi/schema/impl/SchemaServiceImpl.java
@@ -281,7 +281,11 @@ public class SchemaServiceImpl implements SchemaService {
         TimerTask task = new TimerTask() {
             @Override
             public void run() {
-                refreshJSONSchemas();
+                try {
+                    refreshJSONSchemas();
+                } catch (Exception e) {
+                    logger.error("Error while refreshing JSON Schemas", e);
+                }
             }
         };
         scheduledFuture = schedulerService.getScheduleExecutorService()
diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
index ba2558524..6a2591c40 100644
--- a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
@@ -129,10 +129,6 @@ public abstract class BaseIT {
     @Filter(timeout = 600000)
     protected RulesService rulesService;
 
-    @Inject
-    @Filter(timeout = 600000)
-    protected SchemaService schemaService;
-
     @Inject
     @Filter(timeout = 600000)
     protected DefinitionsService definitionsService;
@@ -380,7 +376,6 @@ public abstract class BaseIT {
         persistenceService = getService(PersistenceService.class);
         definitionsService = getService(DefinitionsService.class);
         rulesService = getService(RulesService.class);
-        schemaService = getService(SchemaService.class);
     }
 
     public void updateConfiguration(String serviceName, String configPid, String propName, Object propValue) throws InterruptedException, IOException {
diff --git a/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java b/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
index a540124e8..ace2f6e06 100644
--- a/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/ContextServletIT.java
@@ -36,6 +36,7 @@ import org.apache.unomi.api.services.ProfileService;
 import org.apache.unomi.api.services.SegmentService;
 import org.apache.unomi.persistence.spi.CustomObjectMapper;
 import org.apache.unomi.persistence.spi.PersistenceService;
+import org.apache.unomi.schema.api.SchemaService;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -111,6 +112,10 @@ public class ContextServletIT extends BaseIT {
     @Filter(timeout = 600000)
     protected SegmentService segmentService;
 
+    @Inject
+    @Filter(timeout = 600000)
+    protected SchemaService schemaService;
+
     private Profile profile;
 
     @Before
diff --git a/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java b/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
index 1978e8bbe..bd6f4f869 100644
--- a/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/InputValidationIT.java
@@ -26,12 +26,15 @@ import org.apache.http.util.EntityUtils;
 import org.apache.unomi.api.Event;
 import org.apache.unomi.itests.tools.httpclient.HttpClientThatWaitsForUnomi;
 import org.apache.unomi.schema.api.JsonSchemaWrapper;
+import org.apache.unomi.schema.api.SchemaService;
 import org.junit.*;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerSuite;
+import org.ops4j.pax.exam.util.Filter;
 
+import javax.inject.Inject;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
@@ -52,6 +55,10 @@ public class InputValidationIT extends BaseIT {
     private final static String ERROR_MESSAGE_REQUEST_SIZE_LIMIT_EXCEEDED = "Request rejected by the server because: Request size exceed the limit";
     private final static String ERROR_MESSAGE_INVALID_DATA_RECEIVED = "Request rejected by the server because: Invalid received data";
 
+    @Inject
+    @Filter(timeout = 600000)
+    protected SchemaService schemaService;
+
     @Test
     public void test_param_EventsCollectorRequestNotNull() throws IOException {
         doPOSTRequestTest(EVENT_COLLECTOR_URL, null, null, 400, ERROR_MESSAGE_INVALID_DATA_RECEIVED);