-
Notifications
You must be signed in to change notification settings - Fork 20
deps retrieval compile time fix #16
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
Open
mtraina
wants to merge
12
commits into
athieriot:master
Choose a base branch
from
mtraina:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
faf96bd
fix for latest specs2-3.6.2
404efb1
fix for latest specs2-3.6.2
5350b20
cleanup debug
358801b
remove debug
867816d
bump sbt version
c021cc0
deleteme added
mtraina e89cf3e
deps updated
mtraina d433cfd
travis changed version of scala 2.11 and specs2 version changed to 3.8.2
mtraina 665a723
wait for primary removed
mtraina 208e26f
reverted reactive mongo version
mtraina e68319a
reactive mongo version 0.11.8
mtraina 8321dc9
finalization
mtraina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| language: scala | ||
| scala: | ||
| - "2.10.4" | ||
| - "2.11.1" | ||
| - "2.11.7" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| sbt.version=0.13.0 | ||
| sbt.version=0.13.8 |
22 changes: 15 additions & 7 deletions
22
src/main/scala/com/github/athieriot/CleanAfterExample.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,24 @@ | ||
| package com.github.athieriot | ||
|
|
||
| import scala.collection.JavaConversions._ | ||
| import com.mongodb.{ MongoClient, ServerAddress } | ||
| import org.specs2.specification.AfterExample | ||
| import org.specs2.specification.AfterEach | ||
| import reactivemongo.api.MongoDriver | ||
|
|
||
| trait CleanAfterExample extends AfterExample { | ||
| import scala.concurrent.Await | ||
| import scala.concurrent.ExecutionContext.Implicits.global | ||
| import scala.concurrent.duration._ | ||
|
|
||
| trait CleanAfterExample extends AfterEach { | ||
| self: EmbedConnection => | ||
|
|
||
| lazy val mongoClient = new MongoClient(new ServerAddress(network.getServerAddress(), network.getPort())); | ||
| def getConn = { | ||
| val driver = new MongoDriver | ||
| val db = driver.connection(List(s"127.0.0.1:${network.getPort}"))("testdb") | ||
| Await.ready(db.connection.waitForPrimary(10 seconds), 11 seconds) | ||
| db | ||
| } | ||
|
|
||
| def after() { | ||
| mongoClient.getDatabaseNames().map { mongoClient.getDB(_) }.foreach { _.dropDatabase() } | ||
| def after = { | ||
| Await.ready(getConn.drop(), 1 second) | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 23 additions & 14 deletions
37
src/test/scala/com/github/athieriot/CleanAfterExampleSpec.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,45 @@ | ||
| package com.github.athieriot | ||
|
|
||
| import org.junit.runner.RunWith | ||
| import org.specs2.runner.JUnitRunner | ||
| import org.specs2.mutable.Specification | ||
| import reactivemongo.bson.BSONDocument | ||
|
|
||
| @RunWith(classOf[JUnitRunner]) | ||
| class CleanAfterExampleSpec extends Specification with EmbedConnection with CleanAfterExample { | ||
| import scala.concurrent.Await | ||
| import scala.concurrent.ExecutionContext.Implicits.global | ||
| import scala.concurrent.duration._ | ||
|
|
||
| class CleanAfterExampleSpec extends Specification with EmbedConnection with MongoInit with CleanAfterExample { | ||
|
|
||
| sequentialyIsolated | ||
|
|
||
| "Embed database" should { | ||
| "be able to save a Model I" in { | ||
| Model.save(Model(name = "test")) | ||
| Model.count() must be_==(1) | ||
| val coll = getColl | ||
| Await.ready(coll.insert(BSONDocument("hello" -> "World")), 1 second) | ||
| Await.result(coll.count(None), 5 second) must be_==(1) | ||
| } | ||
|
|
||
| "be able to save a Model II" in { | ||
| Model.save(Model(name = "test")) | ||
| Model.count() must be be_== (1) | ||
| val coll = getColl | ||
| Await.ready(coll.insert(BSONDocument("hello" -> "World")), 1 second) | ||
| Await.result(coll.count(None), 5 second) must be_==(1) | ||
| } | ||
|
|
||
| "be able to save a Model III" in { | ||
| Model.save(Model(name = "test")) | ||
| Model.count() must be be_== (1) | ||
| val coll = getColl | ||
| Await.ready(coll.insert(BSONDocument("hello" -> "World")), 1 second) | ||
| Await.result(coll.count(None), 5 second) must be_==(1) | ||
| } | ||
|
|
||
| "be able to save a Model IV" in { | ||
| Model.save(Model(name = "test")) | ||
| Model.count() must be be_== (1) | ||
| val coll = getColl | ||
| Await.ready(coll.insert(BSONDocument("hello" -> "World")), 1 second) | ||
| Await.result(coll.count(None), 5 second) must be_==(1) | ||
| } | ||
|
|
||
| "be able to save a Model V" in { | ||
| Model.save(Model(name = "test")) | ||
| Model.count() must be be_== (1) | ||
| val coll = getColl | ||
| Await.ready(coll.insert(BSONDocument("hello" -> "World")), 1 second) | ||
| Await.result(coll.count(None), 5 second) must be_==(1) | ||
| } | ||
| } | ||
| } |
34 changes: 20 additions & 14 deletions
34
src/test/scala/com/github/athieriot/EmbedConnectionSpec.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.github.athieriot | ||
|
|
||
| import reactivemongo.api.MongoDriver | ||
| import reactivemongo.api.collections.bson.BSONCollection | ||
| import scala.concurrent.Await | ||
| import scala.concurrent.ExecutionContext.Implicits.global | ||
| import scala.concurrent.duration._ | ||
|
|
||
| trait MongoInit { | ||
| def getColl: BSONCollection = { | ||
| val driver = new MongoDriver | ||
| val db = driver.connection(List("localhost:12345"))("testdb") | ||
| Await.ready(db.connection.waitForPrimary(10 seconds), 11 seconds) | ||
| db("testcoll") | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling "apply" is deprecated, better use "database" method.
Hardcoding the name "testdb" is creating a restriction on database name. It seems like there's no way of getting database names in ReactiveMongo, I couldn't find any API through brief googling. Maybe we should use MongoClient here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReactiveMongo gives an opportunity to run a custom command, so there is a way to get a list of all databases. I've made a pull request with an implementation of such a command.