You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Alvaro Gonzalez <ag...@germinus.com> on 2006/03/31 11:40:55 UTC
Jackrabbit 1.0 RC3 and references to versions
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
Re: Jackrabbit 1.0 RC3 and references to versions
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 4/3/06, Alvaro Gonzalez <ag...@germinus.com> wrote:
> I have discovered where is the problem with my configuration. I have read
> in RELEASE-NOTES that a full rebuild of the index is required. But this is
> not enough, a <SearchIndex> element at the end of the repository config file
> is needed too (as stated in Jira issue [JCR-257]). I think this change in
> configuration should be included in the release notes so not all the people
> will read the Jira Issue.
Good point. The SearchIndex element was included already in the
example files in 0.9, but not for example in the First Hops document
when 0.9 was released. I added a note about this to the release notes
as mentioned on the vote thread.
BR,
Jukka Zitting
--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development
Re: Jackrabbit 1.0 RC3 and references to versions
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 3/31/06, Alvaro Gonzalez <ag...@germinus.com> wrote:
> Yes, I'm always deleting the indexes before invoking my tests. I will
> download the new DerefTest and check the differences with my application
> so I could detect what I'm doing wrong.
Please let us know if you still think the problem is in Jackrabbit.
Otherwise I'm planning to tag 1.0 tomorrow and get the release vote
started.
BR,
Jukka Zitting
--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development
Re: Jackrabbit 1.0 RC3 and references to versions
Posted by Alvaro Gonzalez <ag...@germinus.com>.
Yes, I'm always deleting the indexes before invoking my tests. I will
download the new DerefTest and check the differences with my application
so I could detect what I'm doing wrong.
And sure, no problem with reusing my test .
Thanks Marcel.
Alvaro
--
Alvaro Gonzalez de Paz
Germinus XXI
http://www.germinus.com
Avda. de Manoteras, 44. 2ยช planta.
28050 - Madrid (Spain)
Tel (+34) 91 296 12 34
Fax (+34) 91 296 12 30
Marcel Reutegger wrote:
> 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
>>
>
>
>
Re: Jackrabbit 1.0 RC3 and references to versions
Posted by Martin Perez <mp...@gmail.com>.
Yes, it mentioned, I saw it. Maybe it can be the cause.
Martin
On 3/31/06, Marcel Reutegger <ma...@gmx.net> wrote:
>
> 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
> >
>
>
Re: Jackrabbit 1.0 RC3 and references to versions
Posted by Marcel Reutegger <ma...@gmx.net>.
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
>