@@ -169,18 +169,19 @@ class GridFSDownloadStreamSpecification extends Specification {
169
169
170
170
def ' should skip to the correct point' () {
171
171
given :
172
- def fileInfo = new GridFSFile (new BsonObjectId (new ObjectId ()), ' filename' , 60L , 25 , new Date (), ' abc' , new Document ())
172
+ def fileInfo = new GridFSFile (new BsonObjectId (new ObjectId ()), ' filename' , 4194297L , 32 ,
173
+ new Date (), ' abc' , new Document ())
173
174
174
- def firstChunkBytes = 1 .. 25 as byte []
175
- def thirdChunkBytes = 51 .. 60 as byte []
175
+ def firstChunkBytes = 1 .. 32 as byte []
176
+ def lastChunkBytes = 33 .. 57 as byte []
176
177
177
178
def sort = new Document (' n' , 1 )
178
179
179
180
def findQueries = [new Document (' files_id' , fileInfo. getId()). append(' n' , new Document (' $gte' , 0 )),
180
- new Document (' files_id' , fileInfo. getId()). append(' n' , new Document (' $gte' , 2 ))]
181
+ new Document (' files_id' , fileInfo. getId()). append(' n' , new Document (' $gte' , 131071 ))]
181
182
def chunkDocuments =
182
183
[new Document (' files_id' , fileInfo. getId()). append(' n' , 0 ). append(' data' , new Binary (firstChunkBytes)),
183
- new Document (' files_id' , fileInfo. getId()). append(' n' , 2 ). append(' data' , new Binary (thirdChunkBytes ))]
184
+ new Document (' files_id' , fileInfo. getId()). append(' n' , 131071 ). append(' data' , new Binary (lastChunkBytes ))]
184
185
185
186
def mongoCursor = Mock (MongoCursor )
186
187
def findIterable = Mock (FindIterable )
@@ -210,10 +211,10 @@ class GridFSDownloadStreamSpecification extends Specification {
210
211
readByte == [16 , 17 , 18 , 19 , 20 ] as byte []
211
212
212
213
when :
213
- skipResult = downloadStream. skip(35 )
214
+ skipResult = downloadStream. skip(4194272 )
214
215
215
216
then :
216
- skipResult == 35L
217
+ skipResult == 4194272L
217
218
0 * chunksCollection. find(_)
218
219
219
220
when :
@@ -228,7 +229,7 @@ class GridFSDownloadStreamSpecification extends Specification {
228
229
1 * mongoCursor. next() >> chunkDocuments[1 ]
229
230
230
231
then :
231
- readByte == [56 , 57 , 58 , 59 , 60 ] as byte []
232
+ readByte == [53 , 54 , 55 , 56 , 57 ] as byte []
232
233
233
234
when :
234
235
skipResult = downloadStream. skip(1 )
0 commit comments