summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-04-06 09:10:57 -0400
committerEric Milkie <milkie@10gen.com>2015-04-07 16:25:34 -0400
commit0f58d1037bcbfbf932e73e623772c4f815c361ad (patch)
treeae7ea2cf29830f0dc39e326142ddc1b6bc468804 /src/mongo/dbtests
parent72543912dca4117e1deb45a56c599657a1bf747c (diff)
downloadmongo-0f58d1037bcbfbf932e73e623772c4f815c361ad.tar.gz
SERVER-17880 Rename OpTime to Timestamp
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/documentsourcetests.cpp1
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp4
-rw-r--r--src/mongo/dbtests/jsontests.cpp14
-rw-r--r--src/mongo/dbtests/jstests.cpp18
-rw-r--r--src/mongo/dbtests/mock/mock_remote_db_server.h3
-rw-r--r--src/mongo/dbtests/pdfiletests.cpp12
-rw-r--r--src/mongo/dbtests/perftests.cpp1
-rw-r--r--src/mongo/dbtests/querytests.cpp10
-rw-r--r--src/mongo/dbtests/repltests.cpp42
9 files changed, 53 insertions, 52 deletions
diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp
index b0790d2e6fc..8785cb312cb 100644
--- a/src/mongo/dbtests/documentsourcetests.cpp
+++ b/src/mongo/dbtests/documentsourcetests.cpp
@@ -32,6 +32,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/condition.hpp>
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index ff99677170a..62a69fc6ded 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -1503,8 +1503,8 @@ namespace JsobjTests {
ASSERT_EQUALS(objTypeOf(1), NumberInt);
ASSERT_EQUALS(arrTypeOf(1), NumberInt);
- ASSERT_EQUALS(objTypeOf(OpTime()), Timestamp);
- ASSERT_EQUALS(arrTypeOf(OpTime()), Timestamp);
+ ASSERT_EQUALS(objTypeOf(Timestamp()), bsonTimestamp);
+ ASSERT_EQUALS(arrTypeOf(Timestamp()), bsonTimestamp);
ASSERT_EQUALS(objTypeOf(1LL), NumberLong);
ASSERT_EQUALS(arrTypeOf(1LL), NumberLong);
diff --git a/src/mongo/dbtests/jsontests.cpp b/src/mongo/dbtests/jsontests.cpp
index eadcec07af8..828e35c20e3 100644
--- a/src/mongo/dbtests/jsontests.cpp
+++ b/src/mongo/dbtests/jsontests.cpp
@@ -529,7 +529,7 @@ namespace JsonTests {
public:
void run() {
BSONObjBuilder b;
- b.append( "x" , OpTime(4, 10) );
+ b.append( "x" , Timestamp(4, 10) );
BSONObj o = b.obj();
ASSERT_EQUALS( "{ \"x\" : { \"$timestamp\" : { \"t\" : 4, \"i\" : 10 } } }",
o.jsonString( Strict ) );
@@ -1772,10 +1772,10 @@ namespace JsonTests {
}
};
- class Timestamp : public Base {
+ class JSTimestamp : public Base {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.append( "a", OpTime(20, 5) );
+ b.append( "a", Timestamp(20, 5) );
return b.obj();
}
virtual string json() const {
@@ -1792,7 +1792,7 @@ namespace JsonTests {
class TimestampZero : public Base {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.append( "a", OpTime() );
+ b.append( "a", Timestamp() );
return b.obj();
}
virtual string json() const {
@@ -1839,7 +1839,7 @@ namespace JsonTests {
class TimestampObject : public Base {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.append( "a", OpTime(20, 5) );
+ b.append( "a", Timestamp(20, 5) );
return b.obj();
}
virtual string json() const {
@@ -1880,7 +1880,7 @@ namespace JsonTests {
class TimestampObjectZero : public Base {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.append( "a", OpTime() );
+ b.append( "a", Timestamp() );
return b.obj();
}
virtual string json() const {
@@ -2836,7 +2836,7 @@ namespace JsonTests {
add< FromJsonTests::NumberIntNeg >();
add< FromJsonTests::NumberLongBad >();
add< FromJsonTests::NumberIntBad >();
- add< FromJsonTests::Timestamp >();
+ add< FromJsonTests::JSTimestamp >();
add< FromJsonTests::TimestampNoIncrement >();
add< FromJsonTests::TimestampZero >();
add< FromJsonTests::TimestampNoArgs >();
diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp
index 9389be5d4d0..a83e153185d 100644
--- a/src/mongo/dbtests/jstests.cpp
+++ b/src/mongo/dbtests/jstests.cpp
@@ -525,7 +525,7 @@ namespace JSTests {
b.appendTimestamp( "a" , 123456789 );
b.appendMinKey( "b" );
b.appendMaxKey( "c" );
- b.append( "d" , OpTime(1234, 9876) );
+ b.append( "d" , Timestamp(1234, 9876) );
{
@@ -539,10 +539,10 @@ namespace JSTests {
ASSERT( s->invoke( "y = { a : z.a , b : z.b , c : z.c , d: z.d }" , 0, 0 ) == 0 );
BSONObj out = s->getObject( "y" );
- ASSERT_EQUALS( Timestamp , out["a"].type() );
+ ASSERT_EQUALS( bsonTimestamp , out["a"].type() );
ASSERT_EQUALS( MinKey , out["b"].type() );
ASSERT_EQUALS( MaxKey , out["c"].type() );
- ASSERT_EQUALS( Timestamp , out["d"].type() );
+ ASSERT_EQUALS( bsonTimestamp , out["d"].type() );
ASSERT_EQUALS( 9876U , out["d"].timestampInc() );
ASSERT_EQUALS( 1234000U , out["d"].timestampTime() );
@@ -794,7 +794,7 @@ namespace JSTests {
BSONObj in;
{
BSONObjBuilder b;
- b.bb().appendNum( static_cast<char>(Timestamp) );
+ b.bb().appendNum( static_cast<char>(bsonTimestamp) );
b.bb().appendStr( "a" );
b.bb().appendNum( std::numeric_limits<unsigned long long>::max() );
@@ -1647,10 +1647,10 @@ namespace JSTests {
}
};
- class Timestamp : public TestRoundTrip {
+ class JSTimestamp : public TestRoundTrip {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.append( "a", OpTime(20, 5) );
+ b.append( "a", Timestamp(20, 5) );
return b.obj();
}
virtual string json() const {
@@ -1661,12 +1661,12 @@ namespace JSTests {
class TimestampMax : public TestRoundTrip {
virtual BSONObj bson() const {
BSONObjBuilder b;
- b.appendMaxForType( "a", mongo::Timestamp );
+ b.appendMaxForType( "a", mongo::bsonTimestamp );
BSONObj o = b.obj();
return o;
}
virtual string json() const {
- OpTime opTime = OpTime::max();
+ Timestamp opTime = Timestamp::max();
stringstream ss;
ss << "{ \"a\" : Timestamp( " << opTime.getSecs() << ", " << opTime.getInc()
<< " ) }";
@@ -2154,7 +2154,7 @@ namespace JSTests {
add< RoundTripTests::Date >();
add< RoundTripTests::DateNonzero >();
add< RoundTripTests::DateNegative >();
- add< RoundTripTests::Timestamp >();
+ add< RoundTripTests::JSTimestamp >();
add< RoundTripTests::TimestampMax >();
add< RoundTripTests::Regex >();
add< RoundTripTests::RegexWithQuotes >();
diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.h b/src/mongo/dbtests/mock/mock_remote_db_server.h
index 61074e4c857..aded4542d31 100644
--- a/src/mongo/dbtests/mock/mock_remote_db_server.h
+++ b/src/mongo/dbtests/mock/mock_remote_db_server.h
@@ -31,9 +31,8 @@
#include <string>
#include <vector>
-#include "mongo/bson/bson_field.h"
-#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/client/dbclientinterface.h"
+#include "mongo/db/jsobj.h"
#include "mongo/platform/unordered_map.h"
#include "mongo/util/concurrency/spin_lock.h"
diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp
index 28f777063ed..97eccd6cb25 100644
--- a/src/mongo/dbtests/pdfiletests.cpp
+++ b/src/mongo/dbtests/pdfiletests.cpp
@@ -106,9 +106,9 @@ namespace PdfileTests {
ASSERT( fixed.firstElement().number() == 1 );
BSONElement a = fixed["a"];
- ASSERT( o["a"].type() == Timestamp );
+ ASSERT( o["a"].type() == bsonTimestamp );
ASSERT( o["a"].timestampValue() == 0 );
- ASSERT( a.type() == Timestamp );
+ ASSERT( a.type() == bsonTimestamp );
ASSERT( a.timestampValue() > 0 );
}
};
@@ -131,15 +131,15 @@ namespace PdfileTests {
ASSERT( fixed.firstElement().number() == 1 );
BSONElement a = fixed["a"];
- ASSERT( o["a"].type() == Timestamp );
+ ASSERT( o["a"].type() == bsonTimestamp );
ASSERT( o["a"].timestampValue() == 0 );
- ASSERT( a.type() == Timestamp );
+ ASSERT( a.type() == bsonTimestamp );
ASSERT( a.timestampValue() > 0 );
BSONElement b = fixed["b"];
- ASSERT( o["b"].type() == Timestamp );
+ ASSERT( o["b"].type() == bsonTimestamp );
ASSERT( o["b"].timestampValue() == 0 );
- ASSERT( b.type() == Timestamp );
+ ASSERT( b.type() == bsonTimestamp );
ASSERT( b.timestampValue() > 0 );
}
};
diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp
index 22a59967385..1da93f0e3d3 100644
--- a/src/mongo/dbtests/perftests.cpp
+++ b/src/mongo/dbtests/perftests.cpp
@@ -41,6 +41,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/condition.hpp>
#include <boost/version.hpp>
#include <iomanip>
#include <iostream>
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index eb5cf7402f9..5b9b84be5ba 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/service_context_d.h"
#include "mongo/db/service_context.h"
-#include "mongo/db/global_optime.h"
+#include "mongo/db/global_timestamp.h"
#include "mongo/db/json.h"
#include "mongo/db/lasterror.h"
#include "mongo/db/operation_context_impl.h"
@@ -665,9 +665,9 @@ namespace QueryTests {
"capped" << true << "size" << 8192 ),
info );
- Date_t one = getNextGlobalOptime().asDate();
- Date_t two = getNextGlobalOptime().asDate();
- Date_t three = getNextGlobalOptime().asDate();
+ Date_t one = getNextGlobalTimestamp().asULL();
+ Date_t two = getNextGlobalTimestamp().asULL();
+ Date_t three = getNextGlobalTimestamp().asULL();
insert( ns, BSON( "ts" << one ) );
insert( ns, BSON( "ts" << two ) );
insert( ns, BSON( "ts" << three ) );
@@ -680,7 +680,7 @@ namespace QueryTests {
ClientCursorPin clientCursor( ctx.db()->getCollection( ns )->getCursorManager(),
cursorId );
- ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asDate() );
+ ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asULL() );
}
};
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 8b85906cf18..d768302d02d 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -1366,15 +1366,15 @@ namespace ReplTests {
public:
void run() {
DatabaseIgnorer d;
- ASSERT( !d.ignoreAt( "a", OpTime( 4, 0 ) ) );
- d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) );
- ASSERT( d.ignoreAt( "a", OpTime( 4, 0 ) ) );
- ASSERT( !d.ignoreAt( "b", OpTime( 4, 0 ) ) );
- ASSERT( d.ignoreAt( "a", OpTime( 4, 10 ) ) );
- ASSERT( d.ignoreAt( "a", OpTime( 5, 0 ) ) );
- ASSERT( !d.ignoreAt( "a", OpTime( 5, 1 ) ) );
+ ASSERT( !d.ignoreAt( "a", Timestamp( 4, 0 ) ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 5, 0 ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 4, 0 ) ) );
+ ASSERT( !d.ignoreAt( "b", Timestamp( 4, 0 ) ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 4, 10 ) ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 5, 0 ) ) );
+ ASSERT( !d.ignoreAt( "a", Timestamp( 5, 1 ) ) );
// Ignore state is expired.
- ASSERT( !d.ignoreAt( "a", OpTime( 4, 0 ) ) );
+ ASSERT( !d.ignoreAt( "a", Timestamp( 4, 0 ) ) );
}
};
@@ -1382,19 +1382,19 @@ namespace ReplTests {
public:
void run() {
DatabaseIgnorer d;
- d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) );
- d.doIgnoreUntilAfter( "a", OpTime( 6, 0 ) );
- ASSERT( d.ignoreAt( "a", OpTime( 5, 5 ) ) );
- ASSERT( d.ignoreAt( "a", OpTime( 6, 0 ) ) );
- ASSERT( !d.ignoreAt( "a", OpTime( 6, 1 ) ) );
-
- d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) );
- d.doIgnoreUntilAfter( "a", OpTime( 6, 0 ) );
- d.doIgnoreUntilAfter( "a", OpTime( 6, 0 ) );
- d.doIgnoreUntilAfter( "a", OpTime( 5, 0 ) );
- ASSERT( d.ignoreAt( "a", OpTime( 5, 5 ) ) );
- ASSERT( d.ignoreAt( "a", OpTime( 6, 0 ) ) );
- ASSERT( !d.ignoreAt( "a", OpTime( 6, 1 ) ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 5, 0 ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 6, 0 ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 5, 5 ) ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 6, 0 ) ) );
+ ASSERT( !d.ignoreAt( "a", Timestamp( 6, 1 ) ) );
+
+ d.doIgnoreUntilAfter( "a", Timestamp( 5, 0 ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 6, 0 ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 6, 0 ) );
+ d.doIgnoreUntilAfter( "a", Timestamp( 5, 0 ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 5, 5 ) ) );
+ ASSERT( d.ignoreAt( "a", Timestamp( 6, 0 ) ) );
+ ASSERT( !d.ignoreAt( "a", Timestamp( 6, 1 ) ) );
}
};