Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
compae committed Jan 26, 2016
1 parent 35e92b8 commit 064919d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ object MongodbClientFactory {
mongoConnectionsActor ! SetFreeConnectionByKey(clientKey, extendedTime)
}

def getSize: Int = {
def getClientPoolSize: Int = {
val futureResult = mongoConnectionsActor ? GetSize
Await.result(futureResult, timeout.duration) match {
case size: Int => size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,49 +69,49 @@ with BeforeAndAfterAll {
it should "Valid clients size when getting the same client " in {
val sameHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

val otherHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (2)
MongodbClientFactory.getClientPoolSize should be (2)

MongodbClientFactory.closeAll(notGracefully)
}

it should "Valid clients size when getting the same client and set free " in {
val sameHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.setFreeConnectionByClient(sameHostClient)

val otherHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.closeAll(notGracefully)
}

it should "Valid clients size when closing one client gracefully " in {
val sameHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.closeByClient(sameHostClient)

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.closeAll(notGracefully)
}

it should "Valid clients size when closing one client not gracefully " in {
val sameHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.closeByClient(sameHostClient, notGracefully)

MongodbClientFactory.getSize should be (0)
MongodbClientFactory.getClientPoolSize should be (0)

MongodbClientFactory.closeAll(notGracefully)
}
Expand All @@ -120,17 +120,17 @@ with BeforeAndAfterAll {
val sameHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection
val otherHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection

MongodbClientFactory.getSize should be (2)
MongodbClientFactory.getClientPoolSize should be (2)

MongodbClientFactory.closeAll(gracefully, 1)

MongodbClientFactory.getSize should be (2)
MongodbClientFactory.getClientPoolSize should be (2)

MongodbClientFactory.setFreeConnectionByClient(sameHostClient)

MongodbClientFactory.closeAll(gracefully, 1)

MongodbClientFactory.getSize should be (1)
MongodbClientFactory.getClientPoolSize should be (1)

MongodbClientFactory.closeAll(notGracefully)
}
Expand All @@ -140,11 +140,11 @@ with BeforeAndAfterAll {
val otherHostClient = MongodbClientFactory.getClient("127.0.0.1").clientConnection
val gracefully = false

MongodbClientFactory.getSize should be (2)
MongodbClientFactory.getClientPoolSize should be (2)

MongodbClientFactory.closeAll(notGracefully)

MongodbClientFactory.getSize should be (0)
MongodbClientFactory.getClientPoolSize should be (0)

MongodbClientFactory.closeAll(notGracefully)
}
Expand Down

0 comments on commit 064919d

Please sign in to comment.