Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
If I set multiple filter roots in my configuration, properties will not be handled correctly.
Tested with 3.1.28 and trunk (about 3.1.40)
Example of failing configuration:
<?xml version="1.0" encoding="UTF-8"?> <workspaceFilter version="1.0"> <filter root="/foor"/> <filter root="/bar"> <exclude pattern=".*/jcr:lastModified" matchProperties="true"/> <exclude pattern=".*/jcr:lastModifiedBy" matchProperties="true"/> </filter> </workspaceFilter>
Reproducing tests:
(I copied the algorithm for simplicity. It would be easier to test if the function is moved to WorkspaceFilter)
package org.apache.jackrabbit.vault.fs.impl; import org.apache.jackrabbit.vault.fs.api.PathFilterSet; import org.apache.jackrabbit.vault.fs.api.WorkspaceFilter; import org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter; import org.apache.jackrabbit.vault.fs.filter.DefaultPathFilter; import org.junit.Assert; import org.junit.Test; public class AggregateImplTest { // Copied from AggregateImpl private boolean includesProperty(String propertyPath, WorkspaceFilter workspaceFilter) { for (PathFilterSet filterSet : workspaceFilter.getPropertyFilterSets()) { if (!filterSet.contains(propertyPath)) { return false; } } return true; } @Test public void testIncludesPropertyExpected() { DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter(); PathFilterSet set1 = new PathFilterSet("/foo"); set1.seal(); workspaceFilter.addPropertyFilterSet(set1); PathFilterSet set2 = new PathFilterSet("/bar"); set2.addExclude(new DefaultPathFilter(".*/jcr:mixinTypes")); set2.seal(); workspaceFilter.addPropertyFilterSet(set2); Assert.assertTrue(includesProperty("/foo/node/jcr:primaryType", workspaceFilter)); Assert.assertTrue(includesProperty("/foo/node/jcr:mixinTypes", workspaceFilter)); Assert.assertTrue(includesProperty("/bar/node/jcr:primaryType", workspaceFilter)); Assert.assertFalse(includesProperty("/bar/node/jcr:mixinTypes", workspaceFilter)); } @Test public void testIncludesPropertyCurrentlyWorking1() { DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter(); PathFilterSet set1 = new PathFilterSet("/foo"); set1.seal(); workspaceFilter.addPropertyFilterSet(set1); Assert.assertTrue(includesProperty("/foo/node/jcr:primaryType", workspaceFilter)); Assert.assertTrue(includesProperty("/foo/node/jcr:mixinTypes", workspaceFilter)); } @Test public void testIncludesPropertyCurrentlyWorking2() { DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter(); PathFilterSet set2 = new PathFilterSet("/bar"); set2.addExclude(new DefaultPathFilter(".*/jcr:mixinTypes")); set2.seal(); workspaceFilter.addPropertyFilterSet(set2); Assert.assertTrue(includesProperty("/bar/node/jcr:primaryType", workspaceFilter)); Assert.assertFalse(includesProperty("/bar/node/jcr:mixinTypes", workspaceFilter)); } }
Attachments
Issue Links
- is related to
-
SLING-7501 FilveVault 3.1.38 breaks the Sling IDE Tools "Import from server..."
- Closed