summaryrefslogtreecommitdiff
path: root/client/dbclientmockcursor.h
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-11-23 11:56:51 -0500
committerAlberto Lerner <alerner@10gen.com>2010-11-23 11:56:51 -0500
commit6905714a1509af0bed788e0adc0a0c6cd4aee773 (patch)
tree5318924c9d88bb1b24176c477678883b89e9f7ec /client/dbclientmockcursor.h
parentdce215638af6d10c0cec032d9e3f3612e09fd546 (diff)
downloadmongo-6905714a1509af0bed788e0adc0a0c6cd4aee773.tar.gz
mock DBClientCursor for dbtests/ use
Diffstat (limited to 'client/dbclientmockcursor.h')
-rw-r--r--client/dbclientmockcursor.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/client/dbclientmockcursor.h b/client/dbclientmockcursor.h
new file mode 100644
index 00000000000..0f6dba96458
--- /dev/null
+++ b/client/dbclientmockcursor.h
@@ -0,0 +1,40 @@
+//@file dbclientmockcursor.h
+
+/* Copyright 2010 10gen Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "dbclientcursor.h"
+
+namespace mongo {
+
+ class DBClientMockCursor : public DBClientCursorInterface {
+ public:
+ DBClientMockCursor( const BSONArray& mockCollection ) : _iter( mockCollection ) {}
+ virtual ~DBClientMockCursor() {}
+
+ bool more() { return _iter.more(); }
+ BSONObj next() { return _iter.next().Obj(); }
+
+ private:
+ BSONObjIterator _iter;
+
+ // non-copyable , non-assignable
+ DBClientMockCursor( const DBClientMockCursor& );
+ DBClientMockCursor& operator=( const DBClientMockCursor& );
+ };
+
+} // namespace mongo