ignore that, wrong mailing list ;)
On 4/24/07, Michael Neale <michael.neale(a)gmail.com> wrote:
Really truly ;) , try this with junit, and JR 1.2.2 (1.3 also does it):
public void testIt() throws Exception {
Repository repo = new TransientRepository();
Session sess = repo.login(new SimpleCredentials("foo",
"password".toCharArray()));
Node root = sess.getRootNode();
for (int i = 0; i < 10; i++) {
root.addNode( "" + i + System.currentTimeMillis(),
"nt:unstructured" );
sess.save();
}
Query q = sess.getWorkspace().getQueryManager().createQuery(
"select * from nt:unstructured", Query.SQL);
QueryResult qr = q.execute();
NodeIterator ni = qr.getNodes();
//check we get at least something back from the query
assertTrue(ni.hasNext());
assertNotNull(ni.next());
assertNotNull( ni.next());
assertNotNull(ni.next());
}
And start it up, try it about 10 times in a row, at least one time you
will see a failure (ie it won't return anything from the query) - and then a
subsequent time it just wont start, wait a few seconds, and then it will
work again.
Very very wierd, but somewhat relieved its not my own confused code, this
is as simple as I can make it. I can only imagine there is some index sync
issue still at play. Unfortunately, there is no way to wrap this up as a
proper test, as it needs to startup fresh each time to reliably reproduce
this (seperate JVM process each time).
(and this will happen on any OS, I thought it was just linux, but have
tried it on mac, windows etc).