Moved allocator actions before TestAllocator. The allocator actions should be defined before they are used in TestAllocator, despite it compiles now since TestAllocator is a template.
Review: https://reviews.apache.org/r/31262 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c97c93e3 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c97c93e3 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c97c93e3 Branch: refs/heads/master Commit: c97c93e3ee5c6f7286c99b5e623cdcff663fd19b Parents: a5f270f Author: Alexander Rukletsov <[email protected]> Authored: Tue Apr 21 12:11:20 2015 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Tue Apr 21 12:11:21 2015 -0700 ---------------------------------------------------------------------- src/tests/mesos.hpp | 198 +++++++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c97c93e3/src/tests/mesos.hpp ---------------------------------------------------------------------- diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp index 8a53430..bab45ce 100644 --- a/src/tests/mesos.hpp +++ b/src/tests/mesos.hpp @@ -757,6 +757,105 @@ public: }; +// The following actions make up for the fact that DoDefault +// cannot be used inside a DoAll, for example: +// EXPECT_CALL(allocator, addFramework(_, _, _)) +// .WillOnce(DoAll(InvokeAddFramework(&allocator), +// FutureSatisfy(&addFramework))); + +ACTION_P(InvokeInitialize, allocator) +{ + allocator->real.initialize(arg0, arg1, arg2); +} + + +ACTION_P(InvokeAddFramework, allocator) +{ + allocator->real.addFramework(arg0, arg1, arg2); +} + + +ACTION_P(InvokeRemoveFramework, allocator) +{ + allocator->real.removeFramework(arg0); +} + + +ACTION_P(InvokeActivateFramework, allocator) +{ + allocator->real.activateFramework(arg0); +} + + +ACTION_P(InvokeDeactivateFramework, allocator) +{ + allocator->real.deactivateFramework(arg0); +} + + +ACTION_P(InvokeAddSlave, allocator) +{ + allocator->real.addSlave(arg0, arg1, arg2, arg3); +} + + +ACTION_P(InvokeRemoveSlave, allocator) +{ + allocator->real.removeSlave(arg0); +} + + +ACTION_P(InvokeActivateSlave, allocator) +{ + allocator->real.activateSlave(arg0); +} + + +ACTION_P(InvokeDeactivateSlave, allocator) +{ + allocator->real.deactivateSlave(arg0); +} + + +ACTION_P(InvokeUpdateWhitelist, allocator) +{ + allocator->real.updateWhitelist(arg0); +} + + +ACTION_P(InvokeRequestResources, allocator) +{ + allocator->real.requestResources(arg0, arg1); +} + + +ACTION_P(InvokeUpdateAllocation, allocator) +{ + allocator->real.updateAllocation(arg0, arg1, arg2); +} + + +ACTION_P(InvokeRecoverResources, allocator) +{ + allocator->real.recoverResources(arg0, arg1, arg2, arg3); +} + + +ACTION_P2(InvokeRecoverResourcesWithFilters, allocator, timeout) +{ + Filters filters; + filters.set_refuse_seconds(timeout); + + allocator->real.recoverResources(arg0, arg1, arg2, filters); +} + + +ACTION_P(InvokeReviveOffers, allocator) +{ + allocator->real.reviveOffers(arg0); +} + + template <typename T = mesos::master::allocator::Allocator> class TestAllocator : public mesos::master::allocator::Allocator { @@ -905,105 +1004,6 @@ public: }; -// The following actions make up for the fact that DoDefault -// cannot be used inside a DoAll, for example: -// EXPECT_CALL(allocator, addFramework(_, _, _)) -// .WillOnce(DoAll(InvokeAddFramework(&allocator), -// FutureSatisfy(&addFramework))); - -ACTION_P(InvokeInitialize, allocator) -{ - allocator->real.initialize(arg0, arg1, arg2); -} - - -ACTION_P(InvokeAddFramework, allocator) -{ - allocator->real.addFramework(arg0, arg1, arg2); -} - - -ACTION_P(InvokeRemoveFramework, allocator) -{ - allocator->real.removeFramework(arg0); -} - - -ACTION_P(InvokeActivateFramework, allocator) -{ - allocator->real.activateFramework(arg0); -} - - -ACTION_P(InvokeDeactivateFramework, allocator) -{ - allocator->real.deactivateFramework(arg0); -} - - -ACTION_P(InvokeAddSlave, allocator) -{ - allocator->real.addSlave(arg0, arg1, arg2, arg3); -} - - -ACTION_P(InvokeRemoveSlave, allocator) -{ - allocator->real.removeSlave(arg0); -} - - -ACTION_P(InvokeActivateSlave, allocator) -{ - allocator->real.activateSlave(arg0); -} - - -ACTION_P(InvokeDeactivateSlave, allocator) -{ - allocator->real.deactivateSlave(arg0); -} - - -ACTION_P(InvokeUpdateWhitelist, allocator) -{ - allocator->real.updateWhitelist(arg0); -} - - -ACTION_P(InvokeRequestResources, allocator) -{ - allocator->real.requestResources(arg0, arg1); -} - - -ACTION_P(InvokeUpdateAllocation, allocator) -{ - allocator->real.updateAllocation(arg0, arg1, arg2); -} - - -ACTION_P(InvokeRecoverResources, allocator) -{ - allocator->real.recoverResources(arg0, arg1, arg2, arg3); -} - - -ACTION_P2(InvokeRecoverResourcesWithFilters, allocator, timeout) -{ - Filters filters; - filters.set_refuse_seconds(timeout); - - allocator->real.recoverResources(arg0, arg1, arg2, filters); -} - - -ACTION_P(InvokeReviveOffers, allocator) -{ - allocator->real.reviveOffers(arg0); -} - - class OfferEqMatcher : public ::testing::MatcherInterface<const std::vector<Offer>& > {
