in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/resourceresolver/ResourceResolverGeneralTest.java [2354:2402]
public void test_resolve_selectors_extension() throws Exception {
final String selExt = ".sel1.sel2.html";
Node child = rootNode.addNode("child");
session.save();
try {
// expect kind due to alias and no parent due to mapping
// the rootPath onto root
String path = "/child" + selExt;
String mapped = resResolver.map(child.getPath() + selExt);
assertEquals(path, mapped);
Resource res = resResolver.resolve(null, path);
assertNotNull(res);
assertEquals(
rootNode.getPath() + "/child", res.getResourceMetadata().getResolutionPath());
assertEquals(selExt, res.getResourceMetadata().getResolutionPathInfo());
Node resNode = res.adaptTo(Node.class);
assertNotNull(resNode);
assertEquals(child.getPath(), resNode.getPath());
// second level alias
Node grandchild = child.addNode("grandchild");
session.save();
// expect kind/enkel due to alias and no parent due to mapping
// the rootPath onto root
String pathEnkel = "/child/grandchild" + selExt;
String mappedEnkel = resResolver.map(grandchild.getPath() + selExt);
assertEquals(pathEnkel, mappedEnkel);
Resource resEnkel = resResolver.resolve(null, pathEnkel);
assertNotNull(resEnkel);
assertEquals(
rootNode.getPath() + "/child/grandchild",
resEnkel.getResourceMetadata().getResolutionPath());
assertEquals(selExt, resEnkel.getResourceMetadata().getResolutionPathInfo());
Node resNodeEnkel = resEnkel.adaptTo(Node.class);
assertNotNull(resNodeEnkel);
assertEquals(grandchild.getPath(), resNodeEnkel.getPath());
} finally {
child.remove();
session.save();
}
}