sergehuber commented on code in PR #626:
URL: https://github.com/apache/unomi/pull/626#discussion_r1193788932


##########
itests/src/test/java/org/apache/unomi/itests/SegmentIT.java:
##########
@@ -547,41 +544,47 @@ public void testScoringRecalculation() throws Exception {
         scoringElements.add(scoringElement);
         scoring.setElements(scoringElements);
         segmentService.setScoringDefinition(scoring);
-        refreshPersistence(Scoring.class, Profile.class);
+        refreshPersistence(Segment.class);
 
         // Send 2 events that match the scoring plan.
         profile = profileService.load("test_profile_id");
         Event testEvent = new Event("test-event-type", null, profile, null, 
null, profile, timestampEventInRange);
         testEvent.setPersistent(true);
         eventService.send(testEvent);
-        persistenceService.refreshIndex(Event.class, timestampEventInRange);
+        refreshPersistence(Event.class);
         // 2nd event
         testEvent = new Event("test-event-type", null, testEvent.getProfile(), 
null, null, testEvent.getProfile(), timestampEventInRange);
         eventService.send(testEvent);
-        persistenceService.refreshIndex(Event.class, timestampEventInRange);
+        refreshPersistence(Event.class, Profile.class);
 
         // insure the profile is engaged;
-        Assert.assertTrue("Profile should have 2 events in the scoring",  
(Long) ((Map) 
testEvent.getProfile().getSystemProperties().get("pastEvents")).get(pastEventCondition.getParameterValues().get("generatedPropertyKey"))
 == 2);
-        Assert.assertTrue("Profile is engaged",  
testEvent.getProfile().getScores().containsKey("past-event-scoring-test") && 
testEvent.getProfile().getScores().get("past-event-scoring-test") == 50);
+        try {
+            Assert.assertTrue("Profile should have 2 events in the scoring",
+                    (Long) ((Map) 
testEvent.getProfile().getSystemProperties().get("pastEvents"))
+                            
.get(pastEventCondition.getParameterValues().get("generatedPropertyKey")) == 2);
+            Assert.assertTrue("Profile is engaged", 
testEvent.getProfile().getScores().containsKey("past-event-scoring-test")
+                    && 
testEvent.getProfile().getScores().get("past-event-scoring-test") == 50);
+        } catch (Exception e) {
+            Assert.fail("Unable to read past event because " + e.getMessage());
+        }
         profileService.save(testEvent.getProfile());
         refreshPersistence(Profile.class);
         // recalculate event conditions
         segmentService.recalculatePastEventConditions();
         // insure the profile is still engaged after recalculate;
-        keepTrying("Profile should have 2 events in the scoring",
-                () -> profileService.load("test_profile_id"),
-                updatedProfile -> {
-                    try {
-                        boolean eventCounted = (Integer) ((Map) 
updatedProfile.getSystemProperties().get("pastEvents")).get(pastEventCondition.getParameterValues().get("generatedPropertyKey"))
 == 2;
-                        boolean profileEngaged = 
updatedProfile.getScores().containsKey("past-event-scoring-test") && 
updatedProfile.getScores().get("past-event-scoring-test") == 50;
-                        return eventCounted && profileEngaged;
-                    } catch (Exception e) {
-                        // Do nothing, unable to read value
-                    };
-                    return false;
-                },
-                1000, 20);
-
+        keepTrying("Profile should have 2 events in the scoring", () -> 
profileService.load("test_profile_id"), updatedProfile -> {
+            try {
+                boolean eventCounted = (Integer) ((Map) 
updatedProfile.getSystemProperties().get("pastEvents"))
+                        
.get(pastEventCondition.getParameterValues().get("generatedPropertyKey")) == 2;
+                boolean profileEngaged = 
updatedProfile.getScores().containsKey("past-event-scoring-test")
+                        && 
updatedProfile.getScores().get("past-event-scoring-test") == 50;
+                return eventCounted && profileEngaged;
+            } catch (Exception e) {
+                // Do nothing, unable to read value
+            }
+            ;

Review Comment:
   Don't think we need this one do we ?



##########
itests/src/test/java/org/apache/unomi/itests/SegmentIT.java:
##########
@@ -531,8 +527,9 @@ public void testScoringRecalculation() throws Exception {
         pastEventCondition.setParameter("minimumEventCount", 1);
         pastEventCondition.setParameter("maximumEventCount", 2);
 
-        pastEventCondition.setParameter("fromDate","2000-07-15T07:00:00Z");
-        pastEventCondition.setParameter("toDate","2001-01-15T07:00:00Z");;
+        pastEventCondition.setParameter("fromDate", "2000-07-15T07:00:00Z");
+        pastEventCondition.setParameter("toDate", "2001-01-15T07:00:00Z");
+        ;

Review Comment:
   Small typo



##########
itests/src/test/java/org/apache/unomi/itests/SegmentIT.java:
##########
@@ -531,8 +527,9 @@ public void testScoringRecalculation() throws Exception {
         pastEventCondition.setParameter("minimumEventCount", 1);
         pastEventCondition.setParameter("maximumEventCount", 2);
 
-        pastEventCondition.setParameter("fromDate","2000-07-15T07:00:00Z");
-        pastEventCondition.setParameter("toDate","2001-01-15T07:00:00Z");;
+        pastEventCondition.setParameter("fromDate", "2000-07-15T07:00:00Z");
+        pastEventCondition.setParameter("toDate", "2001-01-15T07:00:00Z");
+        ;

Review Comment:
   We should just remove the ;



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to