jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Judeaux (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCRVLT-197) AggregateImpl.includesProperty fails with multiple filter roots
Date Mon, 06 Nov 2017 06:22:00 GMT

    [ https://issues.apache.org/jira/browse/JCRVLT-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239966#comment-16239966
] 

Jeremy Judeaux commented on JCRVLT-197:
---------------------------------------

I open a PR on github with code that should fix this issue
https://github.com/apache/jackrabbit-filevault/pull/14

> 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
>            Assignee: Tobias Bocanegra
>
> 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)

Mime
View raw message