use of org.apache.sling.api.resource.path.Path in project sling by apache.
the class BasicObservationReporterTest method testSpecificPathProvider.
@Test
public void testSpecificPathProvider() {
ResourceChangeListenerInfo allPathListener = resourceChangeListenerInfo("/");
ResourceChangeListenerInfo appsPathListener = resourceChangeListenerInfo("/apps");
ResourceChangeListenerInfo appsApp2PathListener = resourceChangeListenerInfo("/apps/app2");
ResourceChangeListenerInfo globListener = resourceChangeListenerInfo("glob:/apps/**/*.html");
BasicObservationReporter underTest = new BasicObservationReporter(SEARCH_PATHS, ImmutableList.of(allPathListener, appsPathListener, appsApp2PathListener, globListener), new Path("/apps/app1"), PathSet.EMPTY_SET);
underTest.reportChanges(changes("/apps/app1/path1.html"), false);
assertListener(allPathListener, "/apps/app1/path1.html");
assertListener(appsPathListener, "/apps/app1/path1.html");
assertListener(appsApp2PathListener);
assertListener(globListener, "/apps/app1/path1.html");
}
use of org.apache.sling.api.resource.path.Path in project sling by apache.
the class JspRuntimeContext method handleModification.
/**
* Handle jsp modifications
*/
public boolean handleModification(final String scriptName, final boolean isRemove) {
if (log.isDebugEnabled()) {
log.debug("Handling modification " + scriptName);
}
final JspServletWrapper wrapper = jsps.remove(scriptName);
if (wrapper == null && isRemove) {
boolean removed = false;
final Path path = new Path(scriptName);
final Iterator<Map.Entry<String, JspServletWrapper>> iter = jsps.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<String, JspServletWrapper> entry = iter.next();
if (path.matches(entry.getKey())) {
iter.remove();
removed |= handleModification(entry.getKey(), entry.getValue());
}
}
return removed;
} else {
return handleModification(scriptName, wrapper);
}
}
use of org.apache.sling.api.resource.path.Path in project sling by apache.
the class BasicObservationReporterTest method testRootProvider.
@Test
public void testRootProvider() {
ResourceChangeListenerInfo allPathListener = resourceChangeListenerInfo("/");
ResourceChangeListenerInfo appsPathListener = resourceChangeListenerInfo("/apps");
ResourceChangeListenerInfo appsApp2PathListener = resourceChangeListenerInfo("/apps/app2");
ResourceChangeListenerInfo globListener = resourceChangeListenerInfo("glob:/apps/**/*.html");
BasicObservationReporter underTest = new BasicObservationReporter(SEARCH_PATHS, ImmutableList.of(allPathListener, appsPathListener, appsApp2PathListener, globListener), new Path("/"), PathSet.EMPTY_SET);
underTest.reportChanges(changes("/apps/app1/path1.html"), false);
underTest.reportChanges(changes("/content/path2/jcr:content"), false);
assertListener(allPathListener, "/apps/app1/path1.html", "/content/path2/jcr:content");
assertListener(appsPathListener, "/apps/app1/path1.html");
assertListener(appsApp2PathListener);
assertListener(globListener, "/apps/app1/path1.html");
}
Aggregations