You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2021/07/09 13:04:01 UTC

[unomi] branch master updated: UNOMI-496 Fix NestedNulllException on increment property/interest integration tests. (#317)

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

shuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/master by this push:
     new 27a607b  UNOMI-496 Fix NestedNulllException on increment property/interest integration tests. (#317)
27a607b is described below

commit 27a607b446c3bffb43a49c240eba675b65511b71
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Fri Jul 9 15:03:53 2021 +0200

    UNOMI-496 Fix NestedNulllException on increment property/interest integration tests. (#317)
---
 .../java/org/apache/unomi/itests/IncrementInterestsIT.java  | 11 ++++++++++-
 .../java/org/apache/unomi/itests/IncrementPropertyIT.java   | 13 ++++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/itests/src/test/java/org/apache/unomi/itests/IncrementInterestsIT.java b/itests/src/test/java/org/apache/unomi/itests/IncrementInterestsIT.java
index 9ac2e2d..a0c3e92 100644
--- a/itests/src/test/java/org/apache/unomi/itests/IncrementInterestsIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/IncrementInterestsIT.java
@@ -76,7 +76,7 @@ public class IncrementInterestsIT extends BaseIT {
     public void setup() throws Exception {
         topic = createTopic("topicId");
         profile = createProfile();
-        rule = new Rule();
+        rule = new Rule(new Metadata(null, UUID.randomUUID().toString(), "IncrementInterestRule", "Test rule for IncrementInterestIT automated tests"));
     }
 
     @After
@@ -140,7 +140,16 @@ public class IncrementInterestsIT extends BaseIT {
 
         Map<String, Object> properties = new HashMap<>();
 
+        Map<String,Object> pageInfo = new HashMap<>();
+        pageInfo.put("language", "en");
+        pageInfo.put("destinationURL", "https://www.acme.com/test-page.html");
+        pageInfo.put("referringURL", "https://unomi.apache.org");
+        pageInfo.put("pageID", "ITEM_ID_PAGE");
+        pageInfo.put("pagePath", "/test-page.html");
+        pageInfo.put("pageName", "Test page");
+
         properties.put("interests", interestsAsMap);
+        properties.put("pageInfo", pageInfo);
 
         CustomItem item = new CustomItem("page", ITEM_TYPE_PAGE);
         item.setProperties(properties);
diff --git a/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java b/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
index 4488fb9..35999a0 100644
--- a/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/IncrementPropertyIT.java
@@ -385,7 +385,18 @@ public class IncrementPropertyIT extends BaseIT {
 
         CustomItem target = new CustomItem("ITEM_ID_PAGE", ITEM_TYPE_PAGE);
         target.setScope("acme-space");
-        if (targetProperties != null) target.setProperties(targetProperties);
+        if (targetProperties == null) {
+            targetProperties = new HashMap<>();
+        }
+        Map<String, Object> pageInfo = new HashMap<>();
+        pageInfo.put("language", "en");
+        pageInfo.put("destinationURL", "https://www.acme.com/test-page.html");
+        pageInfo.put("referringURL", "https://unomi.apache.org");
+        pageInfo.put("pageID", "ITEM_ID_PAGE");
+        pageInfo.put("pagePath", "/test-page.html");
+        pageInfo.put("pageName", "Test page");
+        targetProperties.put("pageInfo", pageInfo);
+        target.setProperties(targetProperties);
 
         event = new Event("view", null, profile, null, null, target, new Date());
         event.setPersistent(false);