summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/clienttests.cpp
diff options
context:
space:
mode:
authorTyler Brock <tyler.brock@gmail.com>2014-06-30 15:08:13 -0400
committerTyler Brock <tyler.brock@gmail.com>2014-06-30 15:08:13 -0400
commita353e16805d573af3d5ab4d32fbda87ec98d5c40 (patch)
treeb380194417fd18d7ac24a138cf8a3f14f2535e0c /src/mongo/dbtests/clienttests.cpp
parente9a6e9365cf4d6d13b4a3f94aec1f433dab9f704 (diff)
downloadmongo-a353e16805d573af3d5ab4d32fbda87ec98d5c40.tar.gz
Revert "SERVER-13961 Add OperationContext argument to Client::Context"
This reverts commit e1f5a39b1b625d04752be13f39c774e579b64cd8.
Diffstat (limited to 'src/mongo/dbtests/clienttests.cpp')
-rw-r--r--src/mongo/dbtests/clienttests.cpp47
1 files changed, 10 insertions, 37 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp
index 1ba539f0266..527f52f2554 100644
--- a/src/mongo/dbtests/clienttests.cpp
+++ b/src/mongo/dbtests/clienttests.cpp
@@ -40,23 +40,19 @@ namespace ClientTests {
class Base {
public:
- Base( string coll ) : _ns("test." + coll) {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
+ Base( string coll ) {
db.dropDatabase("test");
+ _ns = (string)"test." + coll;
}
virtual ~Base() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
db.dropCollection( _ns );
}
const char * ns() { return _ns.c_str(); }
- const string _ns;
+ string _ns;
+ DBDirectClient db;
};
@@ -64,9 +60,6 @@ namespace ClientTests {
public:
DropIndex() : Base( "dropindex" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
db.insert( ns() , BSON( "x" << 2 ) );
ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() );
@@ -88,8 +81,6 @@ namespace ClientTests {
public:
ReIndex() : Base( "reindex" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
db.insert( ns() , BSON( "x" << 2 ) );
ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() );
@@ -107,8 +98,6 @@ namespace ClientTests {
public:
ReIndex2() : Base( "reindex2" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
db.insert( ns() , BSON( "x" << 2 ) );
ASSERT_EQUALS( 1 , db.getIndexes( ns() )->itcount() );
@@ -134,9 +123,7 @@ namespace ClientTests {
BuildIndex() : Base("buildIndex") {}
void run() {
OperationContextImpl txn;
-
Client::WriteContext ctx(&txn, ns());
- DBDirectClient db(&txn);
db.insert(ns(), BSON("x" << 1 << "y" << 2));
db.insert(ns(), BSON("x" << 2 << "y" << 2));
@@ -171,14 +158,9 @@ namespace ClientTests {
public:
CS_10() : Base( "CS_10" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
- const string longs( 770, 'c' );
- for (int i = 0; i < 1111; ++i) {
- db.insert(ns(), BSON("a" << i << "b" << longs));
- }
-
+ string longs( 770, 'c' );
+ for( int i = 0; i < 1111; ++i )
+ db.insert( ns(), BSON( "a" << i << "b" << longs ) );
db.ensureIndex( ns(), BSON( "a" << 1 << "b" << 1 ) );
auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) );
@@ -190,13 +172,8 @@ namespace ClientTests {
public:
PushBack() : Base( "PushBack" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
- for (int i = 0; i < 10; ++i) {
- db.insert(ns(), BSON("i" << i));
- }
-
+ for( int i = 0; i < 10; ++i )
+ db.insert( ns(), BSON( "i" << i ) );
auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) );
BSONObj o = c->next();
@@ -235,10 +212,7 @@ namespace ClientTests {
public:
Create() : Base( "Create" ) {}
void run() {
- OperationContextImpl txn;
- DBDirectClient db(&txn);
-
- db.createCollection("unittests.clienttests.create", 4096, true);
+ db.createCollection( "unittests.clienttests.create", 4096, true );
BSONObj info;
ASSERT( db.runCommand( "unittests", BSON( "collstats" << "clienttests.create" ), info ) );
}
@@ -263,7 +237,6 @@ namespace ClientTests {
class All : public Suite {
public:
All() : Suite( "client" ) {
-
}
void setupTests() {