Hi Thibaut,
I noticed the following snippet in your test case code:
long id = node.getId();
node.setProperty("testProp", "test");
index.add(node, "testProp", "test");
Assert.assertEquals(node.getProperty("testProp"), "test");
// Lookup By id
Assert.assertNotNull(graphDb.getNodeById(id));
// Now via Index
Node found = index.get("id", id).getSingle();
Assert.assertNotNull(found);
Assert.assertEquals(found.getId(), id);
which leads to the first test failure with a null result returned.
Here you are indexing a node with key "testProp" and value "test" but
you go on to ask it from the index with key "id" and value its id.
Since you haven't added that key/value pair in the index, rightfully
you don't get any results - the test fails in my setup even with the
native Neo4j transaction manager.
I changed that to ask the node from the index with the proper
key/value pair and the test passes - the same thing happens a bit
further down where you ask the index for a node with a key/value of
"testProp"/"prop" (instead of "testProp"/"test"). Moreover, it passes
with both the native Transaction Manager and the Atomikos
implementation.
Also, you are not deleting the db for the test - this means that since
you add to the index nodes with the same key/value the test will pass
only on the first run as getSingle() on the index hits will find the
previously added nodes and it will fail.
Could you try that out and see if it solves your issues?
I am glad that this functionality is being used in production - please
provide any feedback on any problems and what you think of this
feature.
hope that helps,
CG
On Thu, Oct 6, 2011 at 7:50 PM, tcolar <[email protected]> wrote:
> I've been trying to make this work for a few days but while it mostly works,
> the Lucene index just won't.
>
> We have a fairly complex setup including neo4j, mysql, mongo and JMS ad
> trying to do transactions accross all that with Atomikos.
>
> Since that is quite complex, I've made a smaller unit test just using
> Atomikos and Neo4j to demonstrate the issue:
>
> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j
>
> The main test is here:
> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/src/test/java/net/colar/atomikosNeo4j/AtomikosNeo4jTest.java
>
> and results:
> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/test.log
>
> I used
> http://digitalstain.blogspot.com/2010/11/using-jotm-as-transactionmanager-in.html
> to get me going.
>
> And my code for that part is here:
> https://bitbucket.org/tcolar/stuff/src/ddd17191e9a4/AtomikosNeo4j/src/main/java/net/colar/atomikosNeo4j
>
> I'm thinking that's probably where I'm doing something wrong maybe ?
>
> I'm probably not doing something right but i can't seem to find what's going
> on with Lucene.
>
> The test works if not using Atomikos but just plain Neo4j Transactions.
>
> Anybody as an idea what is wrong?
>
> Thanks.
>
> --
> View this message in context:
> http://neo4j-community-discussions.438527.n3.nabble.com/Trying-to-use-Neo4J-with-Atomikos-transaction-manager-issues-with-Lucene-index-tp3400319p3400319.html
> Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user