summaryrefslogtreecommitdiffstats
path: root/filedistribution/src/tests/rpc/mockfileprovider.h
diff options
context:
space:
mode:
Diffstat (limited to 'filedistribution/src/tests/rpc/mockfileprovider.h')
-rw-r--r--filedistribution/src/tests/rpc/mockfileprovider.h49
1 files changed, 0 insertions, 49 deletions
diff --git a/filedistribution/src/tests/rpc/mockfileprovider.h b/filedistribution/src/tests/rpc/mockfileprovider.h
deleted file mode 100644
index be0a6100165..00000000000
--- a/filedistribution/src/tests/rpc/mockfileprovider.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <vespa/filedistribution/rpc/fileprovider.h>
-#include <boost/thread/barrier.hpp>
-
-namespace filedistribution {
-
-class MockFileProvider : public FileProvider {
- DownloadCompletedSignal _downloadCompleted;
- DownloadFailedSignal _downloadFailed;
-public:
- static const std::string _queueForeverFileReference;
-
- boost::barrier _queueForeverBarrier;
-
- boost::optional<Path> getPath(const std::string& fileReference) override {
- if (fileReference == "dd") {
- return Path("direct/result/path");
- } else {
- return boost::optional<Path>();
- }
- }
-
- void downloadFile(const std::string& fileReference) override {
- if (fileReference == _queueForeverFileReference) {
- _queueForeverBarrier.wait();
- return;
- }
-
- sleep(1);
- downloadCompleted()(fileReference, "downloaded/path/" + fileReference);
- }
-
- DownloadCompletedSignal& downloadCompleted() override {
- return _downloadCompleted;
- }
-
- DownloadFailedSignal& downloadFailed() override {
- return _downloadFailed;
- }
-
- MockFileProvider()
- :_queueForeverBarrier(2)
- {}
-};
-
-} //namespace filedistribution
-