Apache Mesos
mock_fetcher.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __TESTS_MOCK_FETCHER_HPP__
18 #define __TESTS_MOCK_FETCHER_HPP__
19 
20 #include <memory>
21 #include <string>
22 
23 #include <gmock/gmock.h>
24 
25 #include <mesos/mesos.hpp>
26 
28 
29 #include <process/future.hpp>
30 
31 #include <stout/hashmap.hpp>
32 #include <stout/option.hpp>
33 
34 #include "slave/slave.hpp"
35 
37 
38 namespace mesos {
39 namespace internal {
40 namespace tests {
41 
42 // Definition of a mock FetcherProcess to be used in tests with gmock.
44 {
45 public:
47  ~MockFetcherProcess() override;
48 
50  const hashmap<
51  CommandInfo::URI,
52  Option<process::Future<std::shared_ptr<Cache::Entry>>>>&
53  entries,
54  const ContainerID& containerId,
55  const std::string& sandboxDirectory,
56  const std::string& cacheDirectory,
57  const Option<std::string>& user));
58 
60  const hashmap<
61  CommandInfo::URI,
62  Option<process::Future<std::shared_ptr<Cache::Entry>>>>&
63  entries,
64  const ContainerID& containerId,
65  const std::string& sandboxDirectory,
66  const std::string& cacheDirectory,
67  const Option<std::string>& user);
68 
70  const ContainerID& containerId,
71  const std::string& sandboxDirectory,
72  const Option<std::string>& user,
73  const mesos::fetcher::FetcherInfo& info));
74 
76  const ContainerID& containerId,
77  const std::string& sandboxDirectory,
78  const Option<std::string>& user,
79  const mesos::fetcher::FetcherInfo& info);
80 };
81 
82 } // namespace tests {
83 } // namespace internal {
84 } // namespace mesos {
85 
86 #endif // __TESTS_MOCK_FETCHER_HPP__
process::Future< Nothing > unmocked_run(const ContainerID &containerId, const std::string &sandboxDirectory, const Option< std::string > &user, const mesos::fetcher::FetcherInfo &info)
Definition: option.hpp:29
process::Future< Nothing > unmocked__fetch(const hashmap< CommandInfo::URI, Option< process::Future< std::shared_ptr< Cache::Entry >>>> &entries, const ContainerID &containerId, const std::string &sandboxDirectory, const std::string &cacheDirectory, const Option< std::string > &user)
MOCK_METHOD4(run, process::Future< Nothing >(const ContainerID &containerId, const std::string &sandboxDirectory, const Option< std::string > &user, const mesos::fetcher::FetcherInfo &info))
Result< std::string > user(Option< uid_t > uid=None())
Definition: su.hpp:284
Definition: fetcher_process.hpp:41
virtual process::Future< Nothing > _fetch(const hashmap< CommandInfo::URI, Option< process::Future< std::shared_ptr< Cache::Entry >>>> &entries, const ContainerID &containerId, const std::string &sandboxDirectory, const std::string &cacheDirectory, const Option< std::string > &user)
Definition: flags.hpp:39
Definition: hashmap.hpp:38
MOCK_METHOD5(_fetch, process::Future< Nothing >(const hashmap< CommandInfo::URI, Option< process::Future< std::shared_ptr< Cache::Entry >>>> &entries, const ContainerID &containerId, const std::string &sandboxDirectory, const std::string &cacheDirectory, const Option< std::string > &user))
virtual process::Future< Nothing > run(const ContainerID &containerId, const std::string &sandboxDirectory, const Option< std::string > &user, const mesos::fetcher::FetcherInfo &info)
Definition: agent.hpp:25
MockFetcherProcess(const slave::Flags &flags)
Definition: attributes.hpp:24
Definition: mock_fetcher.hpp:43
Definition: parse.hpp:33