Hi Rick,

admittedly I'm relatively new to Spring (and the whole Java thing) so 
there may well be better ways to do this. Anyway, the main reason for me 
to use Spring is the Dependency Injection / Inversion of Control. 
Unfortunately, this is keeping me from stopping, clearing and restarting 
Neo4j for each test as Spring is starting it up.

Now of course I could set it all up manually for the tests but I like 
the convenience that DI offers. Also, I can use the same configuration I 
use in my actual application while only having to overwrite a few beans 
with mocks and stubs.

Worth it?

Best regards,
Georg

On 12.07.2010 15:41, Rick Bullotta wrote:
> Sounds like another good reason not to use Spring. ;-)
>
> In your case, Georg, it certainly sounds like it would be best to delete and
> recreate.  In essence, that's what you're doing anyway.
>
> Can you help us understand what value you get from Spring in this scenario
> versus your own Neo lifecycle management code?
>
> Rick
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Georg M. Sorst
> Sent: Monday, July 12, 2010 7:43 AM
> To: Neo4j user discussions
> Subject: Re: [Neo4j] Cleaning the DB programmatically
>
> Hi Peter,
>
> thanks for the reply. I can't say that it's not ok for me, can I? :)
>
> In my previous mail I mentioned errors such as "Node[xyz] has been
> deleted in this TX". Turns out I had forgotten to clean all indices
> (because there does not seem to be a way to find out which indices exist
> currently). Anyway, the errors are gone so I'm fine for now.
>
> Just for reference, what I'm doing is:
>
>     - graph.getAllNodes()
>     - iterate over all the nodes
>     - for each node delete all its relationships
>     - delete the node
>     - after deleting all nodes delete the indices
>
> Guess I didn't have to tell you that :)
>
> Still, thanks for picking up that item for your to-do.
>
> Thanks and best regards,
> Georg
>
> On 12.07.2010 09:30, Peter Neubauer wrote:
>> Georg,
>> normally people shut down Neo4j and delete the db directory in order
>> to get rid of the entire db. However, I see your point in having a
>> fast way to bulk delete the _content_ of the db.
>>
>> It's not totally simple to do that nicely, so Johan just wrote a note
>> to look at this after Neo4j 1.1. It will probably be a helper doing
>> this, but it needs closer examination. Would that be ok for you?
>>
>> Cheers,
>>
>> /peter neubauer
>>
>> COO and Sales, Neo Technology
>>
>> GTalk:      neubauer.peter
>> Skype       peter.neubauer
>> Phone       +46 704 106975
>> LinkedIn   http://www.linkedin.com/in/neubauer
>> Twitter      http://twitter.com/peterneubauer
>>
>> http://www.neo4j.org               - Your high performance graph database.
>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>>
>>
>>
>> On Fri, Jul 9, 2010 at 12:33 AM, Georg M. Sorst<[email protected]>   wrote:
>>> Hi list,
>>>
>>> is there a way to clean the DB and the indices programmatically?
>>>
>>> The reason I'm looking for this is that I'm using (and instantiating)
>>> Neo4j from Spring. This works just great, however in order to run my
>>> tests from a clean state I need a way to clean the DB and indices.
>>> Stopping Neo4j and deleting the store dir is not really a viable option
>>> as I would have to recreate the start-up sequence that I have already
>>> defined in my Spring context config.
>>>
>>> What I'm currently doing is iterate over the entire graph and delete all
>>> nodes and relationships. This works fine most of the time but sometimes
>>> gives me unexpected errors like "Node[xyz] has been deleted in this TX".
>>> This seems to be especially true when I run all tests in succession.
>>> Another problem with that approach is that there doesn't seem to be a
>>> way to find out which indices currently exist making it hard to safely
>>> delete them all.
>>>
>>> So, any pointers would be greatly appreciated.
>>>
>>> Thanks and best regards,
>>> Georg
>>> _______________________________________________
>>> Neo4j mailing list
>>> [email protected]
>>> https://lists.neo4j.org/mailman/listinfo/user
>>>
>> _______________________________________________
>> Neo4j mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>

-- 
Georg M. Sorst
Dipl. Inf. (FH)

http://vergiss-blackjack.de

Ignaz-Harrer-Str. 13 / Top 19
5020 Salzburg
Österreich

Tel: +43 (0)650 / 53 47 200
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to