Comments (10)
I will try to do today, if I finish one thing :) if not then hope that during this week. Sorry :)
from nosql-unit.
Any updates on this? :(
from nosql-unit.
No idea, why this is happening in this case, notice that for example here https://github.com/lordofthejars/nosql-unit/blob/master/nosqlunit-demo/src/test/java/com/lordofthejars/nosqlunit/demo/mongodb/WhenYouFindAllBooks.java I am using two tests. Can you debug https://github.com/lordofthejars/nosql-unit/blob/master/nosqlunit-mongodb/src/main/java/com/lordofthejars/nosqlunit/mongodb/MongoOperation.java tocheck what is happening to MongoClient
?
from nosql-unit.
The connection to Mongo obtained from Spring, is closed in AbstractNoSqlTestRule#apply()
's finally
block, after the first test method has run. So subsequent attempts to insert data in following tests failed because the connection is closed (in fact, there is a safety assertion: isTrue("open", !isClosed());
in Mongo impl. to ensure that).
In your example, the second test method use the DELETE_ALL
strategy (and not a CLEAN_INSERT
or INSERT
as in my use case): so there is no 2nd attempt to insert data in the db, just a deletion.
Besides, your are using a newMongoDbRule().defaultEmbeddedMongoDb()
to get the MongoDbRule
, which internally used a inMemoryMongoDb Fongo implementation (not a real remote db as in my use case...).
As i have mentioned, the Fongo implementation works great, simply because there is no isTrue("open", !isClosed());
assertion as in the Mongo's.
from nosql-unit.
I see, I think that the problem happens because of Spring integration, because then the Mongo Client is started by Spring but closed by NoSQLUnit. I will need to figure out if there is a way to detect this
from nosql-unit.
Yep. Maybe SpringMongoDbRule
should override close()
to do nothing... and let Spring manage the closing when destroying the context at the end of the tests?
That's the workaround i've implemented for my tests...
from nosql-unit.
Yes I think this is right. Can you provide a PR?
from nosql-unit.
Sure, i will push it tonight
from nosql-unit.
Hello @lordofthejars
when is this fix to be expected to be included into a release?
from nosql-unit.
The change does not exist in the latest release of the maven:
https://mvnrepository.com/artifact/com.lordofthejars/nosqlunit-mongodb/1.0.0-rc.5 and it dates back to more than a year ago.
Is there any more recent repository for maven artifacts ?
from nosql-unit.
Related Issues (20)
- Upgrade Neo4j Libraries to 3.2.x or better to for use with Bolt protocol HOT 1
- NoSQL Unit is not compatible with JUnit 5 HOT 7
- which project supports EmbeddedRedisBuilder? HOT 1
- Can't retrieve info with Spring Data from Fongoed MongoDB HOT 4
- [Feature request] allow specify which collections/keyspaces/nodes... get deleted HOT 3
- Can I use multiple @Rule in single test class ? HOT 3
- Add DynamoDB support
- fix(SpringMongoDbRule): let Spring close the connection to Mongo when⦠#180
- Error when tried HBase unit test code HOT 1
- Support for reactive MongoDB driver HOT 1
- Add support for Elasticsearch 6.x.x HOT 2
- Fix tests and Setup a CI system HOT 10
- Add support for InfluxDB
- MongoFlexibleComparisonStrategy failed on embedded document
- Make static methods in MongoDbAssertion public HOT 1
- Fongo is a dead project HOT 1
- #MongoDB File specified in locations property are not present in classpath HOT 2
- #Redis java.lang.IllegalArgumentException: Windows System is not supported
- #MongoDB how to insert a document with specified _id
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nosql-unit.