in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/EspLoadTest.java [37:75]
public void testNestedInclude() throws Exception {
final Map<String,String> props = new HashMap<String,String>();
props.put("scriptToInclude", "included-a.esp");
props.put(SLING_RESOURCE_TYPE, getClass().getSimpleName());
final TestNode tn = new TestNode(HTTP_BASE_URL + basePath, props);
final String subfolder = tn.scriptPath + "/subfolder";
testClient.mkdirs(WEBDAV_BASE_URL, subfolder);
final String [] toDelete = {
uploadTestScript(tn.scriptPath, "esp-load/main.esp", "html.esp"),
uploadTestScript(tn.scriptPath, "esp-load/included-a.esp", "included-a.esp"),
uploadTestScript(subfolder,
"esp-load/subfolder/included-b.esp", "included-b.esp")
};
try {
final String content = getContent(tn.nodeUrl + ".html", CONTENT_TYPE_HTML);
final String [] expectedStringsInOrder = {
"main.esp before load",
"included-a.esp before load",
"included-b.esp",
"included-a.esp after load",
"main.esp after load",
"Here's more from included-a"
};
int pos = 0;
for(String expected : expectedStringsInOrder) {
final int newPos = content.indexOf(expected);
assertTrue("Content (" + content + ") must contain '" + expected + "'", newPos >= 0);
assertTrue("String '" + expected + "' must come after previous expected string", newPos > pos);
pos = newPos;
}
} finally {
for(String s : toDelete) {
testClient.delete(s);
}
}
}