summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/clienttests.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-04-16 12:24:16 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-04-18 23:44:56 -0400
commit0ab34aa7b9c3c48ea6cf17888620fca455284d35 (patch)
tree9d592c0427229b53bdea159617f7de5d3c6ff819 /src/mongo/dbtests/clienttests.cpp
parentbdc06761206ac398af04f0a2eb482c4dca49bad8 (diff)
downloadmongo-0ab34aa7b9c3c48ea6cf17888620fca455284d35.tar.gz
SERVER-23779 Replace direct instantiation of OperationContextImpl with cc().makeOperationContext().
Also, make OperationContextImpl's constructor private so that it can only be constructed via a Client.
Diffstat (limited to 'src/mongo/dbtests/clienttests.cpp')
-rw-r--r--src/mongo/dbtests/clienttests.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp
index 789a995e0eb..7764f5697c1 100644
--- a/src/mongo/dbtests/clienttests.cpp
+++ b/src/mongo/dbtests/clienttests.cpp
@@ -28,12 +28,14 @@
* then also delete it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/client/dbclientcursor.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
+#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/operation_context_impl.h"
#include "mongo/dbtests/dbtests.h"
namespace ClientTests {
@@ -45,14 +47,16 @@ using std::vector;
class Base {
public:
Base(string coll) : _ns("test." + coll) {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
db.dropDatabase("test");
}
virtual ~Base() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
db.dropCollection(_ns);
@@ -70,7 +74,8 @@ class DropIndex : public Base {
public:
DropIndex() : Base("dropindex") {}
void run() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
db.insert(ns(), BSON("x" << 2));
@@ -99,7 +104,8 @@ class BuildIndex : public Base {
public:
BuildIndex() : Base("buildIndex") {}
void run() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
OldClientWriteContext ctx(&txn, ns());
DBDirectClient db(&txn);
@@ -132,7 +138,8 @@ class CS_10 : public Base {
public:
CS_10() : Base("CS_10") {}
void run() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
const string longs(770, 'c');
@@ -151,7 +158,8 @@ class PushBack : public Base {
public:
PushBack() : Base("PushBack") {}
void run() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
for (int i = 0; i < 10; ++i) {
@@ -196,7 +204,8 @@ class Create : public Base {
public:
Create() : Base("Create") {}
void run() {
- OperationContextImpl txn;
+ const ServiceContext::UniqueOperationContext txnPtr = cc().makeOperationContext();
+ OperationContext& txn = *txnPtr;
DBDirectClient db(&txn);
db.createCollection("unittests.clienttests.create", 4096, true);