@@ -36,6 +36,8 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
36
36
protected MongoCollection<Document > filesCollection;
37
37
protected MongoCollection<Document > chunksCollection;
38
38
protected GridFSBucket gridFSBucket;
39
+ def singleChunkString = ' GridFS'
40
+ def multiChunkString = singleChunkString. padLeft(1024 * 255 * 5 )
39
41
40
42
def setup () {
41
43
mongoDatabase = getMongoClient(). getDatabase(getDefaultDatabaseName())
@@ -56,6 +58,7 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
56
58
@Unroll
57
59
def ' should round trip a #description' () {
58
60
given :
61
+ def content = multiChunk ? multiChunkString : singleChunkString
59
62
def contentBytes = content as byte []
60
63
def expectedLength = contentBytes. length as Long
61
64
def expectedMD5 = MessageDigest . getInstance(' MD5' ). digest(contentBytes). encodeHex(). toString()
@@ -100,16 +103,16 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
100
103
gridFSContentBytes == contentBytes
101
104
102
105
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
108
111
}
109
112
110
113
def ' should round trip with a batchSize of 1' () {
111
114
given :
112
- def content = ' qwerty ' * 1024
115
+ def content = multiChunkString
113
116
def contentBytes = content as byte []
114
117
def expectedLength = contentBytes. length as Long
115
118
def expectedMD5 = MessageDigest . getInstance(' MD5' ). digest(contentBytes). encodeHex(). toString()
@@ -121,7 +124,7 @@ class GridFSBucketSmokeTestSpecification extends FunctionalSpecification {
121
124
122
125
then :
123
126
filesCollection. count() == 1
124
- chunksCollection. count() == 25
127
+ chunksCollection. count() == 5
125
128
126
129
when :
127
130
def file = filesCollection. find(). first()
0 commit comments