LogCabin
|
00001 /* Copyright (c) 2012 Stanford University 00002 * 00003 * Permission to use, copy, modify, and distribute this software for any 00004 * purpose with or without fee is hereby granted, provided that the above 00005 * copyright notice and this permission notice appear in all copies. 00006 * 00007 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES 00008 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00009 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR 00010 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00011 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00012 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00013 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00014 */ 00015 00016 #include <map> 00017 #include <unordered_map> 00018 #include <vector> 00019 #include "include/LogCabin/Client.h" 00020 #include "Client/ClientImpl.h" 00021 00022 #ifndef LOGCABIN_CLIENT_MOCKCLIENTIMPL_H 00023 #define LOGCABIN_CLIENT_MOCKCLIENTIMPL_H 00024 00025 namespace LogCabin { 00026 namespace Client { 00027 00028 /** 00029 * A mock implementation of the client library that operates against a 00030 * temporary, local, in-memory implementation. 00031 */ 00032 class MockClientImpl : public ClientImpl { 00033 public: 00034 /// Constructor. 00035 explicit MockClientImpl(std::shared_ptr<TestingCallbacks> callbacks); 00036 /// Destructor. 00037 ~MockClientImpl(); 00038 00039 // Implementations of ClientImpl methods 00040 void initDerived(); 00041 std::pair<uint64_t, Configuration> getConfiguration(); 00042 ConfigurationResult setConfiguration( 00043 uint64_t oldId, 00044 const Configuration& newConfiguration); 00045 00046 using ClientImpl::read; 00047 00048 private: 00049 00050 // MockClientImpl is not copyable 00051 MockClientImpl(const MockClientImpl&) = delete; 00052 MockClientImpl& operator=(const MockClientImpl&) = delete; 00053 }; 00054 00055 } // namespace LogCabin::Client 00056 } // namespace LogCabin 00057 00058 #endif /* LOGCABIN_CLIENT_MOCKCLIENTIMPL_H */