@@ -36,6 +36,8 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
3636 protected MongoCollection<Document > filesCollection;
3737 protected MongoCollection<Document > chunksCollection;
3838 protected GridFSBucket gridFSBucket;
39+ def singleChunkString = ' GridFS'
40+ def multiChunkString = singleChunkString. padLeft(1024 * 255 * 5 )
3941
4042 def setup () {
4143 mongoDatabase = getMongoClient(). getDatabase(getDefaultDatabaseName())
@@ -56,6 +58,7 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
5658 @Unroll
5759 def ' should round trip a #description' () {
5860 given :
61+ def content = multiChunk ? multiChunkString : singleChunkString
5962 def contentBytes = content as byte []
6063 def expectedLength = contentBytes. length as Long
6164 def expectedMD5 = MessageDigest . getInstance(' MD5' ). digest(contentBytes). encodeHex(). toString()
@@ -100,16 +103,16 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
100103 gridFSContentBytes == contentBytes
101104
102105 where :
103- description | content | chunkCount | direct
104- ' a small file directly' | ' Hello GridFS ' | 1 | true
105- ' a small file to stream' | ' Hello GridFS ' | 1 | false
106- ' a large file directly' | ' qwerty ' * 1024 | 25 | true
107- ' a large file to stream' | ' qwerty ' * 1024 | 25 | false
106+ description | multiChunk | chunkCount | direct
107+ ' a small file directly' | false | 1 | true
108+ ' a small file to stream' | false | 1 | false
109+ ' a large file directly' | true | 5 | true
110+ ' a large file to stream' | true | 5 | false
108111 }
109112
110113 def ' should round trip with a batchSize of 1' () {
111114 given :
112- def content = ' qwerty ' * 1024
115+ def content = multiChunkString
113116 def contentBytes = content as byte []
114117 def expectedLength = contentBytes. length as Long
115118 def expectedMD5 = MessageDigest . getInstance(' MD5' ). digest(contentBytes). encodeHex(). toString()
@@ -121,7 +124,7 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
121124
122125 then :
123126 filesCollection. count() == 1
124- chunksCollection. count() == 25
127+ chunksCollection. count() == 5
125128
126129 when :
127130 def file = filesCollection. find(). first()
0 commit comments