"could not be represented in the filesystem encoding."
% quote_output(local_dir_utf8))
+ self._objid = None
+ self._classname = 'DropUploader'
self._pending = set()
self._client = client
self._stats_provider = client.stats_provider
return not r.was_uploaded()
def _scan(self, localpath):
+ print "_scan"
if not os.path.isdir(localpath):
raise AssertionError("Programmer error: _scan() must be passed a directory path.")
quoted_path = quote_local_unicode_path(localpath)
if islink:
self.warn("WARNING: cannot backup symlink %s" % quote_local_unicode_path(childpath))
elif isdir:
+ print "isdir"
# recurse on the child directory
self._scan(childpath)
must_upload = self._check_db_file(childpath)
if must_upload:
self._append_to_deque(childpath)
elif isfile:
+ print "isfile"
must_upload = self._check_db_file(childpath)
if must_upload:
self._append_to_deque(childpath)
self._turn_deque()
def _append_to_deque(self, path):
+ print "_append_to_deque"
self._upload_deque.append(path)
self._pending.add(path)
self._stats_provider.count('drop_upload.objects_queued', 1)
def _test_persistence(self):
self.uploader = None
self.dir_node = None
-
self.set_up_grid()
self.local_dir = os.path.join(self.basedir, u"test_persistence")
self.mkdir_nonascii(self.local_dir)
-
self.client = self.g.clients[0]
self.stats_provider = self.client.stats_provider
-
d = self.client.create_dirnode()
d.addCallback(self._made_upload_dir)
- d.addCallback(lambda ign: self.uploader.Pause())
+ d.addCallback(self._cleanup)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_uploaded'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
+ d.addCallback(lambda ign: self.client.removeService(self.uploader))
+
+ def msg(val):
+ print "old uploader removed"
+ return None
+ d.addCallback(msg)
+
def create_file(val):
myFile = os.path.join(self.local_dir, "what")
f = open(myFile, "wb")
f.write("meow")
f.close()
- # XXX
- #self.notify_close_write(FilePath(myFile))
+ print "test file created"
return None
d.addCallback(create_file)
- d.addCallback(self._cleanup)
- #d.addCallback(lambda ign: self.client.stopService())
- #d.addCallback(lambda ign: self.client.disownParentService(self))
- #d.addCallback(lambda ign: self.client.startService())
+
d.addCallback(self._made_upload_dir)
-
def resume_uploader(val):
- self.uploader.Resume()
+ print "created new uploader"
d = defer.Deferred()
self.uploader.set_uploaded_callback(d.callback)
return d
d.addCallback(resume_uploader)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('drop_upload.objects_uploaded'), 1))
-
d.addBoth(self._cleanup)
return d