jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Jackrabbit 1.0 RC3 and references to versions
Date Fri, 31 Mar 2006 12:21:01 GMT
Hi Alvaro,

thanks for testing the rc3 release of jackrabbit.

I've slightly rewritten your test case and added it to the 
o.a.j.core.query.DerefTest test class in jackrabbit (I hope you don't 
mind...)

The test runs fine in trunk also against the rc3.

Could you please check that you are working with a clean index. rc3 is 
not 100% compatible with any previous 'release'. You have to delete all 
the indexes and let jackrabbit re-index the workspaces.
If I remember correctly this is also mentioned in the release notes, but 
I'm not sure.

regards
  marcel

Alvaro Gonzalez wrote:
> Hi all,
>  I have downloaded jackrabbit-1.0-rc3 and tested with my application. 
> Almost everything works fine but i have discovered a problem with 
> jcr:deref queries (yes I am "jcr:deref-boy"  :- )).
> In my application there are several nodes that have a reference property 
> to a version of a particular node (actually a reference to 
> jcr:frozenNode). Prior to 1.0-rc3 version works fine, but with the last 
> release a query searching for this nodes returns 0 results.
>  I don't know if it is correct to use references to nodes in the version 
> workspace or it is a problem of the Query Manager.
> 
> I have tested it with version 0.9-rc1-incubating and with some 
> house-made versions and it worked well.
> 
> Here is a a JUnit method that tests this issue:
> 
> 
>    public void testVersionDerefSearch() throws Exception {              
> Session currentSession = JCRUtil.currentSession();
>        Node myRootNode = currentSession.getRootNode().addNode("root");
>        currentSession.save();
>        try {
>            Node referenced = myRootNode.addNode("referenced");           
>            referenced.addMixin("mix:versionable");
>            currentSession.save();
>            Version version = referenced.checkin();
>            Node referencedVersionNode = version.getNode("jcr:frozenNode");
>            Value referenceValue = 
> currentSession.getValueFactory().createValue(referencedVersionNode);
>            Node referencer  = myRootNode.addNode("referencer");
>            referencer.setProperty("aReference",referenceValue);
>            currentSession.save();
>            String 
> query="/"+myRootNode.getPath()+"/*[@aReference]/jcr:deref(@aReference,'*')"; 
> 
>            QueryManager qm = 
> currentSession.getWorkspace().getQueryManager();
>            Query q = qm.createQuery(query, Query.XPATH);
>            QueryResult qr =  q.execute();
>            NodeIterator ni = qr.getNodes();
>            assertEquals("Must find one result in query",1,ni.getSize());
>            while (ni.hasNext()) {
>                Node node = (Node) ni.next();
>                
> assertTrue(node.getProperty("jcr:frozenUuid").getString().equals(referenced.getUUID()));

> 
>            }                  } finally {
>            myRootNode.remove();
>        }
>    }
> 
> 
> Regards,
>  Alvaro
> 


Mime
View raw message