@@ -16,9 +16,6 @@ import spock.lang.Shared
1616import spock.lang.Specification
1717
1818class GridFSBlobStoreSpec extends Specification {
19- private static final HOST = " localhost"
20- private static final PORT = 27017
21- private static final CONNECTION_STRING = " gridfs://${ HOST} :${ PORT} "
2219 private static final DB_NAME = this . simpleName
2320 private static final BUCKET = " bk1"
2421 private static final CONTAINER = " ${ DB_NAME} /${ BUCKET} "
@@ -35,25 +32,27 @@ class GridFSBlobStoreSpec extends Specification {
3532 private BlobStore blobStore
3633
3734 def setupSpec () {
38- mongo = new MongoClient (HOST , PORT )
35+ String host = " localhost"
36+ int port = 27017
37+ mongo = new MongoClient (host, port)
3938 mongo. getDB(DB_NAME ). dropDatabase()
4039 // TODO: use embedded mongo
4140 def overrides = new Properties ()
42- overrides. setProperty(Constants . PROPERTY_ENDPOINT , CONNECTION_STRING )
41+ overrides. setProperty(Constants . PROPERTY_ENDPOINT , " mongodb:// ${ host } : ${ port } " );
4342 context = ContextBuilder . newBuilder(" gridfs" )
44- .overrides(overrides)
45- .buildView(BlobStoreContext )
43+ .overrides(overrides)
44+ .buildView(BlobStoreContext )
4645 blobStore = context. getBlobStore()
4746 }
4847
4948 def cleanupSpec () {
49+ if (context) {
50+ context. close()
51+ }
5052 if (mongo) {
5153 mongo. getDB(DB_NAME ). dropDatabase()
5254 mongo. close()
5355 }
54- if (context) {
55- context. close()
56- }
5756 }
5857
5958 def " can create and delete containers without create container options" () {
0 commit comments