aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-30 20:28:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-30 20:28:36 +0000
commitbd09698c8455cd9ec4f44858466e31ba6882f994 (patch)
tree0eeed3dc1ee03fa0029a9d07c14731ee82c7cf28
parentecce91b572d9fec3eaede4b22db51a1ec133aa46 (diff)
downloadpaludis-bd09698c8455cd9ec4f44858466e31ba6882f994.tar.gz
paludis-bd09698c8455cd9ec4f44858466e31ba6882f994.tar.xz
Let fake repositories use mirrors for test cases
-rw-r--r--paludis/repositories/fake/fake_repository.cc19
-rw-r--r--paludis/repositories/fake/fake_repository.hh10
2 files changed, 27 insertions, 2 deletions
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index abc7c83..39f5772 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -32,6 +32,8 @@
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
+#include <map>
+
using namespace paludis;
namespace paludis
@@ -40,10 +42,13 @@ namespace paludis
struct Implementation<FakeRepository>
{
tr1::shared_ptr<FakeRepository::VirtualsSequence> virtual_packages;
+ std::map<std::string, std::string> mirrors;
Implementation() :
virtual_packages(new FakeRepository::VirtualsSequence)
{
+ mirrors.insert(std::make_pair("example", "http://fake-example/fake-example/"));
+ mirrors.insert(std::make_pair("repo", "http://fake-repo/fake-repo/"));
}
};
}
@@ -56,7 +61,7 @@ FakeRepository::FakeRepository(const Environment * const e, const RepositoryName
.syncable_interface(0)
.use_interface(this)
.world_interface(0)
- .mirrors_interface(0)
+ .mirrors_interface(this)
.environment_variable_interface(0)
.provides_interface(0)
.virtuals_interface(DistributionData::get_instance()->distribution_from_string(
@@ -150,3 +155,15 @@ FakeRepository::do_some_ids_might_support_action(const SupportsActionTestBase &
return q.result;
}
+FakeRepository::MirrorsIterator
+FakeRepository::begin_mirrors(const std::string & s) const
+{
+ return MirrorsIterator(_imp->mirrors.equal_range(s).first);
+}
+
+FakeRepository::MirrorsIterator
+FakeRepository::end_mirrors(const std::string & s) const
+{
+ return MirrorsIterator(_imp->mirrors.equal_range(s).second);
+}
+
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index 6391739..c3aa54b 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -32,7 +32,8 @@ namespace paludis
class PALUDIS_VISIBLE FakeRepository :
private PrivateImplementationPattern<FakeRepository>,
public FakeRepositoryBase,
- public RepositoryVirtualsInterface
+ public RepositoryVirtualsInterface,
+ public RepositoryMirrorsInterface
{
private:
Implementation<FakeRepository> * const _imp;
@@ -58,6 +59,13 @@ namespace paludis
virtual tr1::shared_ptr<const VirtualsSequence> virtual_packages() const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /* RepositoryMirrorsInterface */
+
+ virtual MirrorsIterator begin_mirrors(const std::string & s) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual MirrorsIterator end_mirrors(const std::string & s) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
};
}