@@ -7,6 +7,7 @@ import com.mongodb.OperationFunctionalSpecification
7
7
import com.mongodb.ServerCursor
8
8
import com.mongodb.binding.ConnectionSource
9
9
import com.mongodb.client.model.CreateCollectionOptions
10
+ import com.mongodb.connection.Connection
10
11
import com.mongodb.connection.QueryResult
11
12
import org.bson.BsonDocument
12
13
import org.bson.BsonTimestamp
@@ -241,18 +242,15 @@ class QueryBatchCursorSpecification extends OperationFunctionalSpecification {
241
242
242
243
// 2.2 does not properly detect cursor not found, so ignoring
243
244
@IgnoreIf ({ isSharded() && !serverVersionAtLeast([2 , 4 , 0 ]) })
244
- @Category (Slow )
245
245
def ' should kill cursor if limit is reached on initial query' () throws InterruptedException {
246
246
given :
247
247
def firstBatch = executeQuery(5 )
248
248
def connection = connectionSource. getConnection()
249
249
250
250
cursor = new QueryBatchCursor<Document > (firstBatch, 5 , 0 , new DocumentCodec (), connectionSource, connection)
251
251
252
- Thread . sleep(1000 ) // Note: waiting for some time for killCursor operation to be performed on a server.
253
-
254
252
when :
255
- makeAdditionalGetMoreCall(firstBatch. cursor)
253
+ makeAdditionalGetMoreCall(firstBatch. cursor, connection )
256
254
257
255
then :
258
256
thrown(MongoCursorNotFoundException )
@@ -429,9 +427,13 @@ class QueryBatchCursorSpecification extends OperationFunctionalSpecification {
429
427
private void makeAdditionalGetMoreCall (ServerCursor serverCursor ) {
430
428
def connection = connectionSource. getConnection()
431
429
try {
432
- connection . getMore(getNamespace(), serverCursor. getId(), 1 , new DocumentCodec () )
430
+ makeAdditionalGetMoreCall( serverCursor, connection )
433
431
} finally {
434
432
connection. release()
435
433
}
436
434
}
435
+
436
+ private void makeAdditionalGetMoreCall (ServerCursor serverCursor , Connection connection ) {
437
+ connection. getMore(getNamespace(), serverCursor. getId(), 1 , new DocumentCodec ())
438
+ }
437
439
}
0 commit comments