When inside a Launch Page.getAbsoluteParent() behavior does not match actual AEM behavior.

Description

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.

Status

Assignee

Unassigned

Reporter

EdwardM

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure