Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networkless version of the server (or MongoDatabase) #58

Closed
asereda-gs opened this issue Mar 23, 2019 · 7 comments
Closed

networkless version of the server (or MongoDatabase) #58

asereda-gs opened this issue Mar 23, 2019 · 7 comments
Labels

Comments

@asereda-gs
Copy link

Hello,

We're using mongo java server for many in-memory tests (with MemoryBackend). For each test there is a new TCP connection created and closed which uses unnecessary system resources.

The reason it is happening for each test is because we prefer @Rule over @ClassRule to avoid static fields in JUnit.

Are there any plans to create lightweight version of the server (or MongoDatabase) without networking ?

Regards.

@bwaldvogel
Copy link
Owner

There are no such plans. The focus of this project is to provide a Java implementation that speaks the wire protocol.

What’s the problem with having a @ClassRule?

@asereda-gs
Copy link
Author

asereda-gs commented Mar 24, 2019

The focus of this project is to provide a Java implementation that speaks the wire protocol.

This requirement is not contradictory to the original aim of the project. You can still have network layer on the top of existing "backend". Sometimes it is easier to use lightweight / embedded version of the product without connection protocol (eg. h2).

What’s the problem with having a @ClassRule?

That means you have to have static variable and manually manage the state (eg. drop database before/after test). Plus one can't run tests in parallel.

@bwaldvogel
Copy link
Owner

This requirement is not contradictory to the original aim of the project. You can still have network layer on the top of existing "backend".

Feel free to submit a PR if you have an idea how to achieve it.

@asereda-gs
Copy link
Author

Is it acceptable if core module depends on mongo java driver ?

@bwaldvogel
Copy link
Owner

Unfortunately it’s not an option. Users of mongo-java-server would get a transitive dependency on mongo-java-driver in probably a different version.

@markbigler
Copy link
Contributor

Is it acceptable if core module depends on mongo java driver ?

I'm not sure if this is a good idea. Once you have a dependency on the mongo java driver, you will run into the same problems as Fongo (https://github.com/fakemongo/fongo/). You may have to make adjustments for each new version of mongo java driver and support the old versions as well.

I think that for this reason Fongo is no longer maintained and many people use mongo-java-server instead.

@asereda-gs
Copy link
Author

Yes, that's a valid point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants