diff options
author | Shaun Verch <shaun.verch@10gen.com> | 2013-10-21 02:02:26 -0400 |
---|---|---|
committer | Shaun Verch <shaun.verch@10gen.com> | 2013-10-23 19:41:30 -0400 |
commit | 22f5a8622731353890352dbaccdebdc937ae8508 (patch) | |
tree | cdce2b2de98c0d5b23aa67a1548fe9c865f4eb50 /src/mongo/tools/mongobridge_options_init.cpp | |
parent | 89218f62b7ad5114df7e956bec47b4c1f96f1fed (diff) | |
download | mongo-22f5a8622731353890352dbaccdebdc937ae8508.tar.gz |
SERVER-11144 Create unit tests for registration in all option files
Diffstat (limited to 'src/mongo/tools/mongobridge_options_init.cpp')
-rw-r--r-- | src/mongo/tools/mongobridge_options_init.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/mongo/tools/mongobridge_options_init.cpp b/src/mongo/tools/mongobridge_options_init.cpp new file mode 100644 index 00000000000..d966a27d7f5 --- /dev/null +++ b/src/mongo/tools/mongobridge_options_init.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2013 10gen Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mongo/tools/mongobridge_options.h" + +#include "mongo/util/options_parser/startup_option_init.h" +#include "mongo/util/options_parser/startup_options.h" + +namespace mongo { + MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(MongoBridgeOptions)(InitializerContext* context) { + return addMongoBridgeOptions(&moe::startupOptions); + } + + MONGO_STARTUP_OPTIONS_VALIDATE(MongoBridgeOptions)(InitializerContext* context) { + if (handlePreValidationMongoBridgeOptions(moe::startupOptionsParsed)) { + ::_exit(EXIT_SUCCESS); + } + Status ret = moe::startupOptionsParsed.validate(); + if (!ret.isOK()) { + return ret; + } + return Status::OK(); + } + + MONGO_STARTUP_OPTIONS_STORE(MongoBridgeOptions)(InitializerContext* context) { + Status ret = storeMongoBridgeOptions(moe::startupOptionsParsed, context->args()); + if (!ret.isOK()) { + std::cerr << ret.toString() << std::endl; + std::cerr << "try '" << context->args()[0] << " --help' for more information" + << std::endl; + ::_exit(EXIT_BADOPTIONS); + } + return Status::OK(); + } +} + |