jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tobias Bocanegra (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (JCRVLT-197) AggregateImpl.includesProperty fails with multiple filter roots
Date Wed, 08 Nov 2017 04:03:00 GMT

     [ https://issues.apache.org/jira/browse/JCRVLT-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tobias Bocanegra resolved JCRVLT-197.
-------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.1.42

thanks for the patch [~volune]. I slightly modified it, since I didn't want to modify the
public api too much. I also added tests for the generate source roundtrip.

please test if this solves you problems.

fixed in r1814551

> 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
>             Fix For: 3.1.42
>
>
> 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