在AEM 6.4中创建事件

时间:2018-11-20 07:40:42

标签: java aem

如何删除EventPropertiesMap之后如何在AEM 6.4中为UnitTests以编程方式创建事件?

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);

1 个答案:

答案 0 :(得分:0)

我想出了这个解决方案,希望与其他人分享升级的痛苦:-) 如果您有更好的解决方案,我们将不胜感激!

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);