use of org.apache.jackrabbit.vault.fs.api.PathFilter in project sling by apache.
the class VltUtilsTest method testDeepFilter.
@Test
public void testDeepFilter() throws Exception {
DistributionRequest request = new SimpleDistributionRequest(ADD, true, "/foo");
NavigableMap<String, List<String>> nodeFilters = new TreeMap<String, List<String>>();
nodeFilters.put("/foo", Arrays.asList("/foo/bar", "/foo/bar1"));
NavigableMap<String, List<String>> propFilters = new TreeMap<String, List<String>>();
propFilters.put("/", Arrays.asList("^.*/prop1", "^.*/prop2"));
WorkspaceFilter wsFilter = VltUtils.createFilter(request, nodeFilters, propFilters);
assertNotNull(wsFilter);
assertNotNull(wsFilter.getPropertyFilterSets());
List<PathFilterSet> propFilterSet = wsFilter.getPropertyFilterSets();
assertEquals(1, propFilterSet.size());
PathFilterSet propFilter = propFilterSet.get(0);
assertEquals(2, propFilter.getEntries().size());
PathFilter filter = propFilter.getEntries().get(0).getFilter();
assertTrue(filter.matches("/foo/bar/prop1"));
assertTrue(filter.matches("/foo/prop1"));
}
Aggregations