diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-09-18 20:28:43 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-09-18 20:28:43 +0000 |
commit | fd92c8aa8ad1b3bb7d807e4a0cbfa35f0ec8f640 (patch) | |
tree | 5e2db27f4b45126b9d6f3799646a6d7a375eb567 /test/bbackupd | |
parent | 192ea0683c5e782419314d5378bf7c7533412836 (diff) |
Move MockClientContext and MockBackupDaemon up in testbbackupd file
Diffstat (limited to 'test/bbackupd')
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index bcbefbf4..fd250b80 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -1096,6 +1096,69 @@ bool search_for_file(const std::string& filename) return (testDirId != 0); } +class MockClientContext : public BackupClientContext +{ +public: + BackupProtocolCallable& mrClient; + MockClientContext + ( + LocationResolver &rResolver, + TLSContext &rTLSContext, + const std::string &rHostname, + int32_t Port, + uint32_t AccountNumber, + bool ExtendedLogging, + bool ExtendedLogToFile, + std::string ExtendedLogFile, + ProgressNotifier &rProgressNotifier, + bool TcpNiceMode, + BackupProtocolCallable& rClient + ) + : BackupClientContext(rResolver, rTLSContext, + rHostname, Port, AccountNumber, ExtendedLogging, + ExtendedLogToFile, ExtendedLogFile, + rProgressNotifier, TcpNiceMode), + mrClient(rClient) + { } + + BackupProtocolCallable &GetConnection() + { + return mrClient; + } +}; + +class MockBackupDaemon : public BackupDaemon { + BackupProtocolCallable& mrClient; + +public: + MockBackupDaemon(BackupProtocolCallable &rClient) + : mrClient(rClient) + { } + + std::auto_ptr<BackupClientContext> GetNewContext + ( + LocationResolver &rResolver, + TLSContext &rTLSContext, + const std::string &rHostname, + int32_t Port, + uint32_t AccountNumber, + bool ExtendedLogging, + bool ExtendedLogToFile, + std::string ExtendedLogFile, + ProgressNotifier &rProgressNotifier, + bool TcpNiceMode + ) + { + std::auto_ptr<BackupClientContext> context( + new MockClientContext(rResolver, + rTLSContext, rHostname, Port, + AccountNumber, ExtendedLogging, + ExtendedLogToFile, ExtendedLogFile, + rProgressNotifier, TcpNiceMode, mrClient)); + return context; + } +}; + bool test_readdirectory_on_nonexistent_dir() { SETUP_WITH_BBSTORED(); @@ -1832,69 +1895,6 @@ bool test_bbackupd_uploads_files() TEARDOWN(); } -class MockClientContext : public BackupClientContext -{ -public: - BackupProtocolCallable& mrClient; - MockClientContext - ( - LocationResolver &rResolver, - TLSContext &rTLSContext, - const std::string &rHostname, - int32_t Port, - uint32_t AccountNumber, - bool ExtendedLogging, - bool ExtendedLogToFile, - std::string ExtendedLogFile, - ProgressNotifier &rProgressNotifier, - bool TcpNiceMode, - BackupProtocolCallable& rClient - ) - : BackupClientContext(rResolver, rTLSContext, - rHostname, Port, AccountNumber, ExtendedLogging, - ExtendedLogToFile, ExtendedLogFile, - rProgressNotifier, TcpNiceMode), - mrClient(rClient) - { } - - BackupProtocolCallable &GetConnection() - { - return mrClient; - } -}; - -class MockBackupDaemon : public BackupDaemon { - BackupProtocolCallable& mrClient; - -public: - MockBackupDaemon(BackupProtocolCallable &rClient) - : mrClient(rClient) - { } - - std::auto_ptr<BackupClientContext> GetNewContext - ( - LocationResolver &rResolver, - TLSContext &rTLSContext, - const std::string &rHostname, - int32_t Port, - uint32_t AccountNumber, - bool ExtendedLogging, - bool ExtendedLogToFile, - std::string ExtendedLogFile, - ProgressNotifier &rProgressNotifier, - bool TcpNiceMode - ) - { - std::auto_ptr<BackupClientContext> context( - new MockClientContext(rResolver, - rTLSContext, rHostname, Port, - AccountNumber, ExtendedLogging, - ExtendedLogToFile, ExtendedLogFile, - rProgressNotifier, TcpNiceMode, mrClient)); - return context; - } -}; - bool test_bbackupd_responds_to_connection_failure() { SETUP(); |