How to read jcr:created when using AEM mocks | Community
Skip to main content
August 13, 2020
Solved

How to read jcr:created when using AEM mocks

  • August 13, 2020
  • 1 reply
  • 1782 views

In the application code, I am reading jcr:created using ValueMap API but when I load content JSON file to the AemContext object I don't see the property(only jcr:created) and getting "null" when I try to read. I am currently using RESOURCERESOLVER_MOCK and I also tried with JCR_MOCK. 

 

When I searched for this issue I have seen a thread but it doesn't really have an answer on how to solve this problem.

https://groups.google.com/g/wcm-io-dev/c/1IVwFxtCWOY/m/SyYMd2EzDAAJ

 

AEM mocks version: 3.0.2

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

 

This problem is more related to sling-mock of the Apache Sling project than to wcm.io itself, because it affects the ContentLoader from sling-mock. the ContentLoader [1] has a default list of properties that is ignored when loading content, and "jcr:created" is one of them.

[1] https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java

 

I would suggest for now, you can ignore test cases for jcr:created date.

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
August 13, 2020

Hi,

 

This problem is more related to sling-mock of the Apache Sling project than to wcm.io itself, because it affects the ContentLoader from sling-mock. the ContentLoader [1] has a default list of properties that is ignored when loading content, and "jcr:created" is one of them.

[1] https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java

 

I would suggest for now, you can ignore test cases for jcr:created date.

Arun Patidar
Level 2
October 9, 2023

Hi Team , Is there any update on this thing, or still we are ignoring the test cases related to "jcr:created" property