void Context::setUser(const String & name, const String & password, const Poco::Net::IPAddress & address, const String & quota_key) { auto lock = getLock(); const User & user_props = shared->users.get(name, password, address); setSetting("profile", user_props.profile); setQuota(user_props.quota, quota_key, name, address); user = name; ip_address = address; }
// Actual allocation is done by an instance of real allocator, // which is specified by the template parameter. TestAllocator() : real(createAllocator<T>()) { // We use 'ON_CALL' and 'WillByDefault' here to specify the // default actions (call in to the real allocator). This allows // the tests to leverage the 'DoDefault' action. // However, 'ON_CALL' results in a "Uninteresting mock function // call" warning unless each test puts expectations in place. // As a result, we also use 'EXPECT_CALL' and 'WillRepeatedly' // to get the best of both worlds: the ability to use 'DoDefault' // and no warnings when expectations are not explicit. ON_CALL(*this, initialize(_, _, _)) .WillByDefault(InvokeInitialize(this)); EXPECT_CALL(*this, initialize(_, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, recover(_, _)) .WillByDefault(InvokeRecover(this)); EXPECT_CALL(*this, recover(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, addFramework(_, _, _, _, _)) .WillByDefault(InvokeAddFramework(this)); EXPECT_CALL(*this, addFramework(_, _, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, removeFramework(_)) .WillByDefault(InvokeRemoveFramework(this)); EXPECT_CALL(*this, removeFramework(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, activateFramework(_)) .WillByDefault(InvokeActivateFramework(this)); EXPECT_CALL(*this, activateFramework(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, deactivateFramework(_)) .WillByDefault(InvokeDeactivateFramework(this)); EXPECT_CALL(*this, deactivateFramework(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateFramework(_, _, _)) .WillByDefault(InvokeUpdateFramework(this)); EXPECT_CALL(*this, updateFramework(_, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, addSlave(_, _, _, _, _, _)) .WillByDefault(InvokeAddSlave(this)); EXPECT_CALL(*this, addSlave(_, _, _, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, removeSlave(_)) .WillByDefault(InvokeRemoveSlave(this)); EXPECT_CALL(*this, removeSlave(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateSlave(_, _, _, _)) .WillByDefault(InvokeUpdateSlave(this)); EXPECT_CALL(*this, updateSlave(_, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, addResourceProvider(_, _, _)) .WillByDefault(InvokeAddResourceProvider(this)); EXPECT_CALL(*this, addResourceProvider(_, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, activateSlave(_)) .WillByDefault(InvokeActivateSlave(this)); EXPECT_CALL(*this, activateSlave(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, deactivateSlave(_)) .WillByDefault(InvokeDeactivateSlave(this)); EXPECT_CALL(*this, deactivateSlave(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateWhitelist(_)) .WillByDefault(InvokeUpdateWhitelist(this)); EXPECT_CALL(*this, updateWhitelist(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, requestResources(_, _)) .WillByDefault(InvokeRequestResources(this)); EXPECT_CALL(*this, requestResources(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateAllocation(_, _, _, _)) .WillByDefault(InvokeUpdateAllocation(this)); EXPECT_CALL(*this, updateAllocation(_, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateAvailable(_, _)) .WillByDefault(InvokeUpdateAvailable(this)); EXPECT_CALL(*this, updateAvailable(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateUnavailability(_, _)) .WillByDefault(InvokeUpdateUnavailability(this)); EXPECT_CALL(*this, updateUnavailability(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateInverseOffer(_, _, _, _, _)) .WillByDefault(InvokeUpdateInverseOffer(this)); EXPECT_CALL(*this, updateInverseOffer(_, _, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, getInverseOfferStatuses()) .WillByDefault(InvokeGetInverseOfferStatuses(this)); EXPECT_CALL(*this, getInverseOfferStatuses()) .WillRepeatedly(DoDefault()); ON_CALL(*this, recoverResources(_, _, _, _)) .WillByDefault(InvokeRecoverResources(this)); EXPECT_CALL(*this, recoverResources(_, _, _, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, suppressOffers(_, _)) .WillByDefault(InvokeSuppressOffers(this)); EXPECT_CALL(*this, suppressOffers(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, reviveOffers(_, _)) .WillByDefault(InvokeReviveOffers(this)); EXPECT_CALL(*this, reviveOffers(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, setQuota(_, _)) .WillByDefault(InvokeSetQuota(this)); EXPECT_CALL(*this, setQuota(_, _)) .WillRepeatedly(DoDefault()); ON_CALL(*this, removeQuota(_)) .WillByDefault(InvokeRemoveQuota(this)); EXPECT_CALL(*this, removeQuota(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, updateWeights(_)) .WillByDefault(InvokeUpdateWeights(this)); EXPECT_CALL(*this, updateWeights(_)) .WillRepeatedly(DoDefault()); ON_CALL(*this, pause()) .WillByDefault(InvokePause(this)); EXPECT_CALL(*this, pause()) .WillRepeatedly(DoDefault()); ON_CALL(*this, resume()) .WillByDefault(InvokeResume(this)); EXPECT_CALL(*this, resume()) .WillRepeatedly(DoDefault()); }