You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jeremy Judeaux (JIRA)" <ji...@apache.org> on 2017/07/28 08:45:00 UTC
[jira] [Created] (JCRVLT-197) AggregateImpl.includesProperty fails
with multiple filter roots
Jeremy Judeaux created JCRVLT-197:
-------------------------------------
Summary: AggregateImpl.includesProperty fails with multiple filter roots
Key: JCRVLT-197
URL: https://issues.apache.org/jira/browse/JCRVLT-197
Project: Jackrabbit FileVault
Issue Type: Bug
Reporter: Jeremy Judeaux
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:
{code:xml}
<?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>
{code}
Reproducing tests:
(I copied the algorithm for simplicity. It would be easier to test if the function is moved to {{WorkspaceFilter}})
{code:java}
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));
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)