When inside a Launch Page.getAbsoluteParent() behavior does not match actual AEM behavior.
Description
Gliffy Diagrams
Activity

EdwardM March 30, 2017 at 1:11 PM
If anyone else stumbles across this. My DayCare support opened an internal defect for the 6.2 version of this issue: CQ-4204396. If there are no updates here, you can use that ID to ask your Adobe rep for further information on the status of the problem. I will still try to update here if a hotfix is made available.

EdwardM March 15, 2017 at 1:24 PM
Wow thanks! Your response has been really great! I appreciate it!
Stefan Seifert March 14, 2017 at 10:52 PM
i implemented a solution which should behave quite similar to the fix in the upcoming AEM version.
https://github.com/wcm-io/wcm-io-testing/commit/9943eb8af6dfbef5f46cc695e6d88941e1d88d02
you may try to ask in the daycare ticket to fix this problem also in the next service pack of AEM 6.2 - then the behavior would be in sync with AEM Mocks 2.x again.

EdwardM March 14, 2017 at 9:11 PM
I agree this is a tough one. I'm honestly not sure what the best approach is. I've run into similar issues with other open source projects that support AEM across multiple versions. Those issues have yet to be resolved.
In the end, I think I would like to see support for the newer fixed behavior, perhaps with a note in the documentation. This won't help me now, but it will definitely be helpful moving forward.
Stefan Seifert March 14, 2017 at 8:56 PM
you're right - i was not aware of this special handling.
the launch content structure seems to have changed with AEM 6.1, and the code in wcm.core Page implementation was not updated.
as far as i know this issue is fixed in the upcoming AEM release.
i'm a bit unsure how to proceed concerning AEM mocks which targets AEM 6.0 ... 6.2 and soon 6.3 - should the mock code reflect the old (broken) behavior, or the new one (when it's fixed). it might even get fixed withing the same AEM version with a service pack sooner or later.
Details
Details
Assignee
Reporter

The actual PageImpl class contains the following before it performs any other calculations:
if (LaunchUtils.isLaunchBasedPath(this.resource.getPath())) {
level += 3;
}
See https://github.com/wcm-io/wcm-io-testing/blob/io.wcm.testing.aem-mock-2.2.0/aem-mock/src/main/java/io/wcm/testing/mock/aem/MockPage.java#L159
To test this, get a page with a path like "/content/launches/2015/09/09/launch1/content/originalPage" and call getAbsoluteParent(4) on it. In AEM you will get
"/content/launches/2015/09/09/launch1/content/originalPage"
in PageMock you will get
"/content/launches/2015/09/09".
Note that both /content/launches/2015/09/09/launch1/content/originalPage and /content/launches/2015/09/09 need to be page resources in order for this test to resolve.
Note that the value returned by AEM is not actually useful without further adjustment (the offset should be 6 not 3 to keep the result predictable regardless of whether content is in a Launch or not. I'll be opening a separate DayCare ticket about that issue. This offset is left over from an earlier Launches implementation which did not use the same path format when creating Launches.