You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/03/16 14:17:01 UTC

[06/15] mesos git commit: Fixed formatting issues in `src/tests/mesos.{hpp, cpp}`.

Fixed formatting issues in `src/tests/mesos.{hpp,cpp}`.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/75ca1e6c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/75ca1e6c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/75ca1e6c

Branch: refs/heads/master
Commit: 75ca1e6c9fde655c41fdf835aa20c47570d21f10
Parents: b377557
Author: Michael Park <mp...@apache.org>
Authored: Wed Mar 16 08:14:58 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Wed Mar 16 08:19:10 2016 -0400

----------------------------------------------------------------------
 src/tests/mesos.cpp | 74 ++++++++++++++++++++++++------------------------
 src/tests/mesos.hpp | 67 ++++++++++++++++++++++---------------------
 2 files changed, 71 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/75ca1e6c/src/tests/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.cpp b/src/tests/mesos.cpp
index 4be1248..90aef6b 100644
--- a/src/tests/mesos.cpp
+++ b/src/tests/mesos.cpp
@@ -92,7 +92,7 @@ master::Flags MesosTest::CreateMasterFlags()
   flags.authenticate_slaves = true;
 
   // Create a default credentials file.
-  const string& path =  path::join(os::getcwd(), "credentials");
+  const string& path = path::join(os::getcwd(), "credentials");
 
   Try<int> fd = os::open(
       path,
@@ -113,7 +113,7 @@ master::Flags MesosTest::CreateMasterFlags()
   credential->set_secret(DEFAULT_CREDENTIAL_2.secret());
 
   CHECK_SOME(os::write(fd.get(), stringify(JSON::protobuf(credentials))))
-     << "Failed to write credentials to '" << path << "'";
+    << "Failed to write credentials to '" << path << "'";
   CHECK_SOME(os::close(fd.get()));
 
   flags.credentials = path;
@@ -162,7 +162,7 @@ slave::Flags MesosTest::CreateSlaveFlags()
   credential.set_secret(DEFAULT_CREDENTIAL.secret());
 
   CHECK_SOME(os::write(fd.get(), stringify(JSON::protobuf(credential))))
-     << "Failed to write slave credential to '" << path << "'";
+    << "Failed to write slave credential to '" << path << "'";
 
   CHECK_SOME(os::close(fd.get()));
 
@@ -415,20 +415,21 @@ MockQoSController::MockQoSController()
 MockQoSController::~MockQoSController() {}
 
 
-MockSlave::MockSlave(const slave::Flags& flags,
-                     MasterDetector* detector,
-                     slave::Containerizer* containerizer,
-                     const Option<mesos::slave::QoSController*>& _qosController)
+MockSlave::MockSlave(
+    const slave::Flags& flags,
+    MasterDetector* detector,
+    slave::Containerizer* containerizer,
+    const Option<mesos::slave::QoSController*>& _qosController)
   : slave::Slave(
-      process::ID::generate("slave"),
-      flags,
-      detector,
-      containerizer,
-      &files,
-      &gc,
-      statusUpdateManager = new slave::StatusUpdateManager(flags),
-      &resourceEstimator,
-      _qosController.isSome() ? _qosController.get() : &qosController)
+        process::ID::generate("slave"),
+        flags,
+        detector,
+        containerizer,
+        &files,
+        &gc,
+        statusUpdateManager = new slave::StatusUpdateManager(flags),
+        &resourceEstimator,
+        _qosController.isSome() ? _qosController.get() : &qosController)
 {
   // Set up default behaviors, calling the original methods.
   EXPECT_CALL(*this, runTask(_, _, _, _, _))
@@ -464,18 +465,18 @@ void MockSlave::unmocked_runTask(
 
 
 void MockSlave::unmocked__runTask(
-      const Future<bool>& future,
-      const FrameworkInfo& frameworkInfo,
-      const TaskInfo& task)
+    const Future<bool>& future,
+    const FrameworkInfo& frameworkInfo,
+    const TaskInfo& task)
 {
   slave::Slave::_runTask(future, frameworkInfo, task);
 }
 
 
 void MockSlave::unmocked_killTask(
-      const UPID& from,
-      const FrameworkID& frameworkId,
-      const TaskID& taskId)
+    const UPID& from,
+    const FrameworkID& frameworkId,
+    const TaskID& taskId)
 {
   slave::Slave::killTask(from, frameworkId, taskId);
 }
@@ -502,11 +503,10 @@ void MockSlave::unmocked_qosCorrections()
 MockFetcherProcess::MockFetcherProcess()
 {
   // Set up default behaviors, calling the original methods.
-  EXPECT_CALL(*this, _fetch(_, _, _, _, _, _)).
-    WillRepeatedly(
-        Invoke(this, &MockFetcherProcess::unmocked__fetch));
-  EXPECT_CALL(*this, run(_, _, _, _, _)).
-    WillRepeatedly(Invoke(this, &MockFetcherProcess::unmocked_run));
+  EXPECT_CALL(*this, _fetch(_, _, _, _, _, _))
+    .WillRepeatedly(Invoke(this, &MockFetcherProcess::unmocked__fetch));
+  EXPECT_CALL(*this, run(_, _, _, _, _))
+    .WillRepeatedly(Invoke(this, &MockFetcherProcess::unmocked_run));
 }
 
 
@@ -532,7 +532,7 @@ MockContainerLogger::~MockContainerLogger() {}
 
 MockDocker::MockDocker(
     const string& path,
-    const string &socket)
+    const string& socket)
   : Docker(path, socket)
 {
   EXPECT_CALL(*this, ps(_, _))
@@ -609,13 +609,13 @@ MockAuthorizer::~MockAuthorizer() {}
 
 
 process::Future<Nothing> MockFetcherProcess::unmocked__fetch(
-  const hashmap<CommandInfo::URI, Option<Future<shared_ptr<Cache::Entry>>>>&
-    entries,
-  const ContainerID& containerId,
-  const string& sandboxDirectory,
-  const string& cacheDirectory,
-  const Option<string>& user,
-  const slave::Flags& flags)
+    const hashmap<CommandInfo::URI, Option<Future<shared_ptr<Cache::Entry>>>>&
+      entries,
+    const ContainerID& containerId,
+    const string& sandboxDirectory,
+    const string& cacheDirectory,
+    const Option<string>& user,
+    const slave::Flags& flags)
 {
   return slave::FetcherProcess::_fetch(
       entries,
@@ -798,8 +798,8 @@ void ContainerizerTest<slave::MesosContainerizer>::SetUp()
           << "hierarchies, or disable this test case\n"
           << "(i.e., --gtest_filter=-"
           << ::testing::UnitTest::GetInstance()
-              ->current_test_info()
-              ->test_case_name() << ".*).\n"
+               ->current_test_info()
+               ->test_case_name() << ".*).\n"
           << "-------------------------------------------------------------";
       } else {
         // If the subsystem is already mounted in the hierarchy make

http://git-wip-us.apache.org/repos/asf/mesos/blob/75ca1e6c/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index fc6011e..93b9340 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -882,7 +882,7 @@ public:
 
   void event(Mesos* mesos, const Event& event)
   {
-    switch(event.type()) {
+    switch (event.type()) {
       case Event::SUBSCRIBED:
         subscribed(mesos, event.subscribed());
         break;
@@ -924,20 +924,20 @@ public:
       const std::shared_ptr<MockHTTPScheduler<Mesos, Event>>& _scheduler,
       const Option<std::shared_ptr<MasterDetector>>& detector = None())
     : Mesos(
-        master,
-        contentType,
-        // We don't pass the `_scheduler` shared pointer as the library
-        // interface expects a `std::function` object.
-        lambda::bind(&MockHTTPScheduler<Mesos, Event>::connected,
-                     _scheduler.get(),
-                     this),
-        lambda::bind(&MockHTTPScheduler<Mesos, Event>::disconnected,
-                     _scheduler.get(),
-                     this),
-        lambda::bind(&TestMesos<Mesos, Event>::events,
-                     this,
-                     lambda::_1),
-        detector),
+          master,
+          contentType,
+          // We don't pass the `_scheduler` shared pointer as the library
+          // interface expects a `std::function` object.
+          lambda::bind(&MockHTTPScheduler<Mesos, Event>::connected,
+                       _scheduler.get(),
+                       this),
+          lambda::bind(&MockHTTPScheduler<Mesos, Event>::disconnected,
+                       _scheduler.get(),
+                       this),
+          lambda::bind(&TestMesos<Mesos, Event>::events,
+                       this,
+                       lambda::_1),
+          detector),
       scheduler(_scheduler) {}
 
   virtual ~TestMesos()
@@ -965,7 +965,7 @@ public:
 protected:
   void events(std::queue<Event> events)
   {
-    while(!events.empty()) {
+    while (!events.empty()) {
       Event event = std::move(events.front());
       events.pop();
       scheduler->event(this, event);
@@ -1008,7 +1008,7 @@ public:
 
   void event(Mesos* mesos, const Event& event)
   {
-    switch(event.type()) {
+    switch (event.type()) {
       case Event::SUBSCRIBED:
         subscribed(mesos, event.subscribed());
         break;
@@ -1045,22 +1045,22 @@ public:
       ContentType contentType,
       const std::shared_ptr<MockHTTPExecutor<Mesos, Event>>& _executor)
     : Mesos(
-        contentType,
-        lambda::bind(&MockHTTPExecutor<Mesos, Event>::connected,
-                     _executor,
-                     this),
-        lambda::bind(&MockHTTPExecutor<Mesos, Event>::disconnected,
-                     _executor,
-                     this),
-        lambda::bind(&TestMesos<Mesos, Event>::events,
-                     this,
-                     lambda::_1)),
+          contentType,
+          lambda::bind(&MockHTTPExecutor<Mesos, Event>::connected,
+                       _executor,
+                       this),
+          lambda::bind(&MockHTTPExecutor<Mesos, Event>::disconnected,
+                       _executor,
+                       this),
+          lambda::bind(&TestMesos<Mesos, Event>::events,
+                       this,
+                       lambda::_1)),
       executor(_executor) {}
 
 protected:
   void events(std::queue<Event> events)
   {
-    while(!events.empty()) {
+    while (!events.empty()) {
       Event event = std::move(events.front());
       events.pop();
       executor->event(this, event);
@@ -1595,14 +1595,15 @@ public:
 
 
 class OfferEqMatcher
-  : public ::testing::MatcherInterface<const std::vector<Offer>& >
+  : public ::testing::MatcherInterface<const std::vector<Offer>&>
 {
 public:
   OfferEqMatcher(int _cpus, int _mem)
     : cpus(_cpus), mem(_mem) {}
 
-  virtual bool MatchAndExplain(const std::vector<Offer>& offers,
-                               ::testing::MatchResultListener* listener) const
+  virtual bool MatchAndExplain(
+      const std::vector<Offer>& offers,
+      ::testing::MatchResultListener* listener) const
   {
     double totalCpus = 0;
     double totalMem = 0;
@@ -1642,8 +1643,8 @@ private:
 };
 
 
-inline
-const ::testing::Matcher<const std::vector<Offer>& > OfferEq(int cpus, int mem)
+inline const ::testing::Matcher<const std::vector<Offer>&> OfferEq(
+    int cpus, int mem)
 {
   return MakeMatcher(new OfferEqMatcher(cpus, mem));
 }