2
* Copyright (C) 2012 10gen Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Affero General Public License, version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Affero General Public License for more details.
13
* You should have received a copy of the GNU Affero General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "mongo/db/jsobj.h"
21
#include "mongo/s/chunk_diff.h"
22
#include "mongo/unittest/unittest.h"
27
using mongo::ConfigDiffTracker;
33
// We'd move ChunkDiffUnitTest here
34
// We can check the queries it generates.
35
// We can check if is populating the attaching structures properly
38
// The default pass-through adapter for using config diffs.
39
class DefaultDiffAdapter : public ConfigDiffTracker<BSONObj,string> {
42
DefaultDiffAdapter() {}
43
virtual ~DefaultDiffAdapter() {}
45
virtual bool isTracked(const BSONObj& chunkDoc) const { return true; }
46
virtual BSONObj maxFrom(const BSONObj& max) const { return max; }
48
virtual pair<BSONObj,BSONObj> rangeFor(const BSONObj& chunkDoc,
50
const BSONObj& max) const {
51
return make_pair(min, max);
54
virtual string shardFor(const string& name) const { return name; }
55
virtual string nameFrom(const string& shard) const { return shard; }
58
TEST(Basics, Simple) {
59
DefaultDiffAdapter differ;
63
} // unnamed namespace