Repository: mesos Updated Branches: refs/heads/master f6b018502 -> b75aa8ada
Redefined helper macros with existing 'create' functions. Review: https://reviews.apache.org/r/53077 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b75aa8ad Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b75aa8ad Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b75aa8ad Branch: refs/heads/master Commit: b75aa8ada2d8ce5ff98fa8d99f04e45527b5953e Parents: 7e93d9d Author: Joris Van Remoortere <joris.van.remoort...@gmail.com> Authored: Thu Oct 20 13:37:00 2016 -0700 Committer: Joris Van Remoortere <joris.van.remoort...@gmail.com> Committed: Fri Oct 21 09:42:32 2016 -0700 ---------------------------------------------------------------------- src/tests/mesos.hpp | 56 ++++++++++++------------------------------------ 1 file changed, 14 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/b75aa8ad/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 08bfedb..45dba23 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -384,18 +384,6 @@ using mesos::v1::WeightInfo; } // namespace v1 { namespace common { -template <typename TExecutorInfo> -struct DefaultExecutorInfo -{ - static TExecutorInfo create() - { - TExecutorInfo executor; - executor.mutable_executor_id()->set_value("default"); - executor.mutable_command()->set_value("exit 1"); - return executor; - } -}; - template <typename TCredential> struct DefaultCredential @@ -439,56 +427,26 @@ struct DefaultFrameworkInfo } }; - -template <typename TExecutorInfo, typename TExecutorID> -struct DefaultExecutorID -{ - static TExecutorID create() - { - return DefaultExecutorInfo<TExecutorInfo>::create().executor_id(); - } -}; - } // namespace common { // TODO(jmlvanre): Remove `inline` once we have adjusted all tests to // distinguish between `internal` and `v1`. inline namespace internal { -using DefaultExecutorInfo = common::DefaultExecutorInfo<ExecutorInfo>; using DefaultCredential = common::DefaultCredential<Credential>; using DefaultCredential2 = common::DefaultCredential2<Credential>; using DefaultFrameworkInfo = common::DefaultFrameworkInfo<FrameworkInfo, Credential>; -using DefaultExecutorID = common::DefaultExecutorID<ExecutorInfo, ExecutorID>; } // namespace internal { namespace v1 { -using DefaultExecutorInfo = - common::DefaultExecutorInfo<mesos::v1::ExecutorInfo>; using DefaultCredential = common::DefaultCredential<mesos::v1::Credential>; using DefaultCredential2 = common::DefaultCredential2<mesos::v1::Credential>; using DefaultFrameworkInfo = common::DefaultFrameworkInfo<mesos::v1::FrameworkInfo, mesos::v1::Credential>; -using DefaultExecutorID = - common::DefaultExecutorID<mesos::v1::ExecutorInfo, mesos::v1::ExecutorID>; } // namespace v1 { -// Macros to get/create (default) ExecutorInfos and FrameworkInfos. -#define DEFAULT_EXECUTOR_INFO DefaultExecutorInfo::create() - - -#define DEFAULT_CREDENTIAL DefaultCredential::create() -#define DEFAULT_CREDENTIAL_2 DefaultCredential2::create() - - -#define DEFAULT_FRAMEWORK_INFO DefaultFrameworkInfo::create() - - -#define DEFAULT_EXECUTOR_ID DefaultExecutorID::create() - - // We factor out all common behavior and templatize it so that we can // can call it from both `v1::` and `internal::`. namespace common { @@ -1446,6 +1404,20 @@ inline mesos::Environment createEnvironment( } +// Macros to get/create (default) ExecutorInfos and FrameworkInfos. +#define DEFAULT_EXECUTOR_INFO createExecutorInfo("default", "exit 1") + + +#define DEFAULT_CREDENTIAL DefaultCredential::create() +#define DEFAULT_CREDENTIAL_2 DefaultCredential2::create() + + +#define DEFAULT_FRAMEWORK_INFO DefaultFrameworkInfo::create() + + +#define DEFAULT_EXECUTOR_ID DEFAULT_EXECUTOR_INFO.executor_id() + + // Definition of a mock Scheduler to be used in tests with gmock. class MockScheduler : public Scheduler {