How can I create an programatically Event for UnitTests in AEM 6.4 after EventPropertiesMap
has been removed?
List<EventPropertiesMap> fakeModifications = new ArrayList<>();
fakeModifications.add(PageModification.deleted(pagePath,
StringUtils.EMPTY).getEventProperties());
Map eventProps = new HashMap();
eventProps.put("modifications", fakeModifications);
return new Event("com/day/cq/wcm/core/page", eventProps);
I came up with this solution hoping to share the pain of an upgrade with others :-) If you got a better solution I'm more than welcome!
List<Map<String, ?>> fakesList = new ArrayList<Map<String, ?>>();
Map<String, ?> fakeModifications = PageModification.deleted(pagePath, StringUtils.EMPTY).getEventProperties();
fakesList.add(fakeModifications);
Map<String, List<Map<String, ?>>> eventProps = new HashMap<String, List<Map<String, ?>>>();
eventProps.put("modifications", fakesList);
return new Event("com/day/cq/wcm/core/page", eventProps);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.