This is an automated email from the ASF dual-hosted git repository. jsinovassinnaik pushed a commit to branch UNOMI-817 in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/UNOMI-817 by this push: new 4d23c7002 add test 4d23c7002 is described below commit 4d23c7002b84fa48cc24d57f3698e616981fc5bf Author: jsinovassin <jsinovassinn...@jahia.com> AuthorDate: Mon May 6 08:32:54 2024 +0300 add test --- .../unomi/itests/migration/Migrate16xTo220IT.java | 14 ++++++++++++++ .../resources/migration/snapshots_repository.zip | Bin 3908941 -> 7807889 bytes 2 files changed, 14 insertions(+) diff --git a/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo220IT.java b/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo220IT.java index cddb44f49..725f0fa4c 100644 --- a/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo220IT.java +++ b/itests/src/test/java/org/apache/unomi/itests/migration/Migrate16xTo220IT.java @@ -99,6 +99,7 @@ public class Migrate16xTo220IT extends BaseIT { checkEventSessionRollover2_2_0(); checkIndexReductions2_2_0(); checkPagePathForEventView(); + checkPastEvents(); } /** @@ -342,4 +343,17 @@ public class Migrate16xTo220IT extends BaseIT { Assert.assertEquals(2, persistenceService.query("target.properties.pageInfo.pagePath", "/path/to/migrate/to/pageInfo", null, Event.class).size()); Assert.assertEquals(0, persistenceService.query("properties.path", "/path/to/migrate/to/pageInfo", null, Event.class).size()); } + + + /** + * Data set contains a profile (id: 164adad8-6885-45b6-8e9d-512bf4a7d10d) with a system property pastEvents that contains 5 events with key eventTriggeredabcdefgh + * This test ensures that the pastEvents have been migrated to the new data structure + */ + private void checkPastEvents() { + Profile profile = persistenceService.load("164adad8-6885-45b6-8e9d-512bf4a7d10d", Profile.class); + List<Map<String, Object>> pastEvents = ((List<Map<String, Object>>)profile.getSystemProperties().get("pastEvents")); + Assert.assertEquals(1, pastEvents.size()); + Assert.assertEquals("eventTriggeredabcdefgh", pastEvents.get(0).get("key")); + Assert.assertEquals(5, (int) pastEvents.get(0).get("count")); + } } diff --git a/itests/src/test/resources/migration/snapshots_repository.zip b/itests/src/test/resources/migration/snapshots_repository.zip index 705a6241f..675e710cc 100644 Binary files a/itests/src/test/resources/migration/snapshots_repository.zip and b/itests/src/test/resources/migration/snapshots_repository.zip differ