summaryrefslogtreecommitdiff
path: root/obnam
diff options
context:
space:
mode:
authorLars Wirzenius <liw@gytha>2008-04-13 20:36:28 +0300
committerLars Wirzenius <liw@gytha>2008-04-13 20:36:28 +0300
commit667843720d26d24601da75167f2273606a356bbd (patch)
treebc925d978457702d3b5ab466fd16b7b58eaf039b /obnam
parentc3189b1456c3d8db4e4350e5b84066283faa77f9 (diff)
downloadobnam-667843720d26d24601da75167f2273606a356bbd.tar.gz
Replaced use of Application load_maps and load_content_maps with Store ones.
Diffstat (limited to 'obnam')
-rw-r--r--obnam/app.py16
-rw-r--r--obnam/appTests.py69
-rw-r--r--obnam/oper_backup.py2
-rw-r--r--obnam/oper_forget.py4
-rw-r--r--obnam/oper_restore.py4
-rw-r--r--obnam/oper_show_generations.py2
6 files changed, 6 insertions, 91 deletions
diff --git a/obnam/app.py b/obnam/app.py
index a1b819c4..7a2262ff 100644
--- a/obnam/app.py
+++ b/obnam/app.py
@@ -69,14 +69,6 @@ class Application:
self.get_store().fetch_host_block()
return self.get_store().get_host_block()
- def load_maps(self):
- """Load non-content map blocks."""
- self.get_store().load_maps()
-
- def load_content_maps(self):
- """Load content map blocks."""
- self.get_store().load_content_maps()
-
def get_exclusion_regexps(self):
"""Return list of regexp to exclude things from backup."""
@@ -285,11 +277,3 @@ class Application:
end=end)
self.get_store().queue_object(gen)
return gen
-
- def update_maps(self):
- """Create new object mapping blocks and upload them."""
- self.get_store().update_maps()
-
- def update_content_maps(self):
- """Create new content object mapping blocks and upload them."""
- self.get_store().update_content_maps()
diff --git a/obnam/appTests.py b/obnam/appTests.py
index e9535f3c..ef586a08 100644
--- a/obnam/appTests.py
+++ b/obnam/appTests.py
@@ -347,72 +347,3 @@ class ApplicationBackupTests(unittest.TestCase):
gen = self.app.backup([self.abs("pink"), self.abs("pretty")])
self.failIfEqual(gen.get_start_time(), None)
self.failIfEqual(gen.get_end_time(), None)
-
-
-class ApplicationMapTests(unittest.TestCase):
-
- def setUp(self):
- # First, set up two mappings.
-
- context = obnam.context.Context()
- context.cache = obnam.cache.Cache(context.config)
- context.be = obnam.backend.init(context.config, context.cache)
-
- obnam.map.add(context.map, "pink", "pretty")
- obnam.map.add(context.contmap, "black", "beautiful")
-
- map_id = context.be.generate_block_id()
- map_block = obnam.map.encode_new_to_block(context.map, map_id)
- context.be.upload_block(map_id, map_block, True)
-
- contmap_id = context.be.generate_block_id()
- contmap_block = obnam.map.encode_new_to_block(context.contmap,
- contmap_id)
- context.be.upload_block(contmap_id, contmap_block, True)
-
- host_id = context.config.get("backup", "host-id")
- host = obnam.obj.HostBlockObject(host_id=host_id,
- map_block_ids=[map_id],
- contmap_block_ids=[contmap_id])
- obnam.io.upload_host_block(context, host.encode())
-
- # Then set up the real context and app.
-
- self.context = obnam.context.Context()
- self.context.cache = obnam.cache.Cache(self.context.config)
- self.context.be = obnam.backend.init(self.context.config,
- self.context.cache)
- self.app = obnam.Application(self.context)
- self.app.load_host()
-
- def testHasNoMapsLoadedByDefault(self):
- self.failUnlessEqual(obnam.map.count(self.context.map), 0)
-
- def testHasNoContentMapsLoadedByDefault(self):
- self.failUnlessEqual(obnam.map.count(self.context.contmap), 0)
-
- def testLoadsMapsWhenRequested(self):
- self.app.load_maps()
- self.failUnlessEqual(obnam.map.count(self.context.map), 1)
-
- def testLoadsContentMapsWhenRequested(self):
- self.app.load_content_maps()
- self.failUnlessEqual(obnam.map.count(self.context.contmap), 1)
-
- def testAddsNoNewMapsWhenNothingHasChanged(self):
- self.app.update_maps()
- self.failUnlessEqual(obnam.map.count(self.context.map), 0)
-
- def testAddsANewMapsWhenSomethingHasChanged(self):
- obnam.map.add(self.context.map, "pink", "pretty")
- self.app.update_maps()
- self.failUnlessEqual(obnam.map.count(self.context.map), 1)
-
- def testAddsNoNewContentMapsWhenNothingHasChanged(self):
- self.app.update_content_maps()
- self.failUnlessEqual(obnam.map.count(self.context.contmap), 0)
-
- def testAddsANewContentMapsWhenSomethingHasChanged(self):
- obnam.map.add(self.context.contmap, "pink", "pretty")
- self.app.update_content_maps()
- self.failUnlessEqual(obnam.map.count(self.context.contmap), 1)
diff --git a/obnam/oper_backup.py b/obnam/oper_backup.py
index 6a74432c..dd11690f 100644
--- a/obnam/oper_backup.py
+++ b/obnam/oper_backup.py
@@ -34,7 +34,7 @@ class Backup(obnam.Operation):
logging.info("Getting and decoding host block")
app = self.get_application()
host = app.load_host()
- app.load_maps()
+ app.get_store().load_maps()
# We don't need to load in file data, therefore we don't load
# the content map blocks.
diff --git a/obnam/oper_forget.py b/obnam/oper_forget.py
index b901da5c..40d98f41 100644
--- a/obnam/oper_forget.py
+++ b/obnam/oper_forget.py
@@ -40,8 +40,8 @@ class Forget(obnam.Operation):
map_block_ids = host.get_map_block_ids()
contmap_block_ids = host.get_contmap_block_ids()
- app.load_maps()
- app.load_content_maps()
+ app.get_store().load_maps()
+ app.get_store().load_content_maps()
logging.debug("forget: Forgetting each id")
for id in forgettable_ids:
diff --git a/obnam/oper_restore.py b/obnam/oper_restore.py
index 31129791..a4a161e1 100644
--- a/obnam/oper_restore.py
+++ b/obnam/oper_restore.py
@@ -197,8 +197,8 @@ class Restore(obnam.Operation):
context = app.get_context()
host = app.load_host()
- app.load_maps()
- app.load_content_maps()
+ app.get_store().load_maps()
+ app.get_store().load_content_maps()
logging.debug("Getting generation object")
gen = obnam.io.get_object(context, gen_id)
diff --git a/obnam/oper_show_generations.py b/obnam/oper_show_generations.py
index db20eb2f..e22d9510 100644
--- a/obnam/oper_show_generations.py
+++ b/obnam/oper_show_generations.py
@@ -90,7 +90,7 @@ class ShowGenerations(obnam.Operation):
app = self.get_application()
context = app.get_context()
host = app.load_host()
- app.load_maps()
+ app.get_store().load_maps()
for gen_id in gen_ids:
gen = obnam.io.get_object(context, gen_id)