diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-28 14:12:40 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-06-28 14:12:40 -0400 |
commit | e1f5a39b1b625d04752be13f39c774e579b64cd8 (patch) | |
tree | b0211887cf6ff4628c7b783a989dae341caa5d01 /src/mongo/dbtests/directclienttests.cpp | |
parent | 89fcbab94c7103105e8c72f654a5774a066bdb90 (diff) | |
download | mongo-e1f5a39b1b625d04752be13f39c774e579b64cd8.tar.gz |
SERVER-13961 Add OperationContext argument to Client::Context
Time tracking and database access in Client::Context require access to the
OperationContext. Adding it as argument.
This is in preparation for removing LockState from Client.
Diffstat (limited to 'src/mongo/dbtests/directclienttests.cpp')
-rw-r--r-- | src/mongo/dbtests/directclienttests.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp index 0bea6ea2399..9c96dc331fd 100644 --- a/src/mongo/dbtests/directclienttests.cpp +++ b/src/mongo/dbtests/directclienttests.cpp @@ -35,6 +35,7 @@ #include "mongo/db/instance.h" #include "mongo/db/json.h" #include "mongo/db/lasterror.h" +#include "mongo/db/operation_context_impl.h" #include "mongo/dbtests/dbtests.h" #include "mongo/util/timer.h" @@ -52,7 +53,8 @@ namespace DirectClientTests { class Capped : public ClientBase { public: virtual void run() { - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); for( int pass=0; pass < 3; pass++ ) { client.createCollection(ns, 1024 * 1024, true, 999); for( int j =0; j < pass*3; j++ ) @@ -76,7 +78,9 @@ namespace DirectClientTests { class InsertMany : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + vector<BSONObj> objs; objs.push_back(BSON("_id" << 1)); objs.push_back(BSON("_id" << 1)); @@ -99,7 +103,9 @@ namespace DirectClientTests { class BadNSCmd : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + BSONObj result; BSONObj cmdObj = BSON( "count" << "" ); ASSERT_THROWS( client.runCommand( "", cmdObj, result ), UserException ); @@ -109,7 +115,9 @@ namespace DirectClientTests { class BadNSQuery : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + auto_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 ); ASSERT(cursor->more()); BSONObj result = cursor->next().getOwned(); @@ -121,7 +129,9 @@ namespace DirectClientTests { class BadNSGetMore : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + auto_ptr<DBClientCursor> cursor = client.getMore("", 1, 1); ASSERT(cursor->more()); BSONObj result = cursor->next().getOwned(); @@ -133,7 +143,9 @@ namespace DirectClientTests { class BadNSInsert : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + client.insert( "", BSONObj(), 0 ); ASSERT( !client.getLastError().empty() ); } @@ -142,7 +154,9 @@ namespace DirectClientTests { class BadNSUpdate : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + client.update( "", Query(), BSON( "$set" << BSON( "x" << 1 )) ); ASSERT( !client.getLastError().empty() ); } @@ -151,7 +165,9 @@ namespace DirectClientTests { class BadNSRemove : ClientBase { public: virtual void run(){ - DBDirectClient client; + OperationContextImpl txn; + DBDirectClient client(&txn); + client.remove( "", Query() ); ASSERT( !client.getLastError().empty() ); } |