Merge lp:~jdobrien/ubuntuone-client/bugfix-553547 into lp:ubuntuone-client

Proposed by John O'Brien
Status: Merged
Approved by: Eric Casteleijn
Approved revision: 474
Merged at revision: not available
Proposed branch: lp:~jdobrien/ubuntuone-client/bugfix-553547
Merge into: lp:ubuntuone-client
Diff against target: 145 lines (+33/-28)
5 files modified
tests/syncdaemon/test_dbus.py (+2/-2)
tests/syncdaemon/test_vm.py (+4/-4)
ubuntuone/syncdaemon/action_queue.py (+8/-3)
ubuntuone/syncdaemon/event_queue.py (+2/-1)
ubuntuone/syncdaemon/volume_manager.py (+17/-18)
To merge this branch: bzr merge lp:~jdobrien/ubuntuone-client/bugfix-553547
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve
Rick McBride (community) Approve
Review via email: mp+22953@code.launchpad.net

Commit message

Fix a discrepancy between the client and protocol where share_deletion notifications are handled.

Description of the change

This branch makes the adjustments to the client so it is compatible with the storage protocol branch lp:ubuntuone-storage-protocol/split-share-change and must be tested with that revision.

To post a comment you must log in.
Revision history for this message
Rick McBride (rmcbride) :
review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good, tests pass

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/syncdaemon/test_dbus.py'
--- tests/syncdaemon/test_dbus.py 2010-03-26 18:29:38 +0000
+++ tests/syncdaemon/test_dbus.py 2010-04-07 15:42:22 +0000
@@ -1176,7 +1176,7 @@
1176 match = self.bus.add_signal_receiver(share_handler,1176 match = self.bus.add_signal_receiver(share_handler,
1177 signal_name='ShareChanged')1177 signal_name='ShareChanged')
1178 self.signal_receivers.add(match)1178 self.signal_receivers.add(match)
1179 self.main.event_q.push('SV_SHARE_CHANGED', 'changed', info=share_holder)1179 self.main.event_q.push('SV_SHARE_CHANGED', share_holder)
1180 return d1180 return d
11811181
1182 def test_share_deleted(self):1182 def test_share_deleted(self):
@@ -1217,7 +1217,7 @@
1217 signal_name='ShareDeleted')1217 signal_name='ShareDeleted')
1218 self.signal_receivers.add(match)1218 self.signal_receivers.add(match)
12191219
1220 self.main.event_q.push('SV_SHARE_CHANGED', 'deleted', share_holder)1220 self.main.event_q.push('SV_SHARE_DELETED', share_holder.share_id)
1221 return d1221 return d
12221222
1223 def test_share_created(self):1223 def test_share_created(self):
12241224
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2010-03-31 21:48:44 +0000
+++ tests/syncdaemon/test_vm.py 2010-04-07 15:42:22 +0000
@@ -223,9 +223,9 @@
223 share = Share(path=share_path, volume_id=str(share_holder.share_id),223 share = Share(path=share_path, volume_id=str(share_holder.share_id),
224 access_level='View')224 access_level='View')
225 self.vm.add_share(share)225 self.vm.add_share(share)
226 self.vm.handle_SV_SHARE_CHANGED(message='changed', info=share_holder)226 self.vm.handle_SV_SHARE_CHANGED(share_holder)
227 self.assertEquals('Modify', self.vm.shares[str(share_id)].access_level)227 self.assertEquals('Modify', self.vm.shares[str(share_id)].access_level)
228 self.vm.handle_SV_SHARE_CHANGED('deleted', share_holder)228 self.vm.handle_SV_SHARE_DELETED(share_holder.share_id)
229 self.assertNotIn('share_id', self.vm.shares)229 self.assertNotIn('share_id', self.vm.shares)
230230
231 def test_persistence(self):231 def test_persistence(self):
@@ -600,7 +600,7 @@
600 'test_username',600 'test_username',
601 'visible', 'Modify')601 'visible', 'Modify')
602 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')602 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')
603 self.vm.handle_SV_SHARE_CHANGED('changed', share_holder)603 self.vm.handle_SV_SHARE_CHANGED(share_holder)
604 shouldbe_dir = os.path.join(self.shares_dir,604 shouldbe_dir = os.path.join(self.shares_dir,
605 u"año".encode("utf8") + " from visible")605 u"año".encode("utf8") + " from visible")
606 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)606 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)
@@ -612,7 +612,7 @@
612 'test_username',612 'test_username',
613 u'Ramón', 'Modify')613 u'Ramón', 'Modify')
614 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')614 self.vm.handle_SYS_ROOT_RECEIVED('root_uuid')
615 self.vm.handle_SV_SHARE_CHANGED('changed', share_holder)615 self.vm.handle_SV_SHARE_CHANGED(share_holder)
616 shouldbe_dir = os.path.join(self.shares_dir,616 shouldbe_dir = os.path.join(self.shares_dir,
617 "share from " + u"Ramón".encode("utf8"))617 "share from " + u"Ramón".encode("utf8"))
618 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)618 self.assertEquals(shouldbe_dir, self.vm.shares['share_id'].path)
619619
=== modified file 'ubuntuone/syncdaemon/action_queue.py'
--- ubuntuone/syncdaemon/action_queue.py 2010-04-05 14:51:51 +0000
+++ ubuntuone/syncdaemon/action_queue.py 2010-04-07 15:42:22 +0000
@@ -715,12 +715,17 @@
715 self.event_queue.push('SV_HASH_NEW',715 self.event_queue.push('SV_HASH_NEW',
716 share_id=share_id, node_id=node_id, hash=hash)716 share_id=share_id, node_id=node_id, hash=hash)
717717
718 def _share_change_callback(self, message, info):718 def _share_change_callback(self, info):
719 """719 """
720 Called by the client when notified that a share changed.720 Called by the client when notified that a share changed.
721 """721 """
722 self.event_queue.push('SV_SHARE_CHANGED',722 self.event_queue.push('SV_SHARE_CHANGED', info=info)
723 message=message, info=info)723
724 def _share_delete_callback(self, share_id):
725 """
726 Called by the client when notified that a share was deleted.
727 """
728 self.event_queue.push('SV_SHARE_DELETED', share_id=share_id)
724729
725 def _share_answer_callback(self, share_id, answer):730 def _share_answer_callback(self, share_id, answer):
726 """731 """
727732
=== modified file 'ubuntuone/syncdaemon/event_queue.py'
--- ubuntuone/syncdaemon/event_queue.py 2010-03-26 20:16:23 +0000
+++ ubuntuone/syncdaemon/event_queue.py 2010-04-07 15:42:22 +0000
@@ -80,7 +80,8 @@
80 'public_url'),80 'public_url'),
81 'AQ_CHANGE_PUBLIC_ACCESS_ERROR': ('share_id', 'node_id', 'error'),81 'AQ_CHANGE_PUBLIC_ACCESS_ERROR': ('share_id', 'node_id', 'error'),
8282
83 'SV_SHARE_CHANGED': ('message', 'info'),83 'SV_SHARE_CHANGED': ('info',),
84 'SV_SHARE_DELETED': ('share_id',),
84 'SV_SHARE_ANSWERED': ('share_id', 'answer'),85 'SV_SHARE_ANSWERED': ('share_id', 'answer'),
85 'SV_HASH_NEW': ('share_id', 'node_id', 'hash'),86 'SV_HASH_NEW': ('share_id', 'node_id', 'hash'),
86 'SV_FILE_NEW': ('share_id', 'node_id', 'parent_id', 'name'),87 'SV_FILE_NEW': ('share_id', 'node_id', 'parent_id', 'name'),
8788
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2010-03-31 21:48:44 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2010-04-07 15:42:22 +0000
@@ -523,23 +523,24 @@
523 # check AQ wait conditions523 # check AQ wait conditions
524 self.m.action_q.check_conditions()524 self.m.action_q.check_conditions()
525525
526 def handle_SV_SHARE_CHANGED(self, message, info):526 def handle_SV_SHARE_CHANGED(self, share_info):
527 """ handle SV_SHARE_CHANGED event """527 """ handle SV_SHARE_CHANGED event """
528 if message == 'changed':528 if str(share_info.share_id) not in self.shares:
529 if str(info.share_id) not in self.shares:529 self.log.debug("New share notification, share_id: %s",
530 self.log.debug("New share notification, share_id: %s",530 share_info.share_id)
531 info.share_id)531 dir_name = self._build_share_path(share_info.share_name,
532 dir_name = self._build_share_path(info.share_name,532 share_info.from_visible_name)
533 info.from_visible_name)533 path = os.path.join(self.m.shares_dir, dir_name)
534 path = os.path.join(self.m.shares_dir, dir_name)534 share = Share.from_notify_holder(share_info, path)
535 share = Share.from_notify_holder(info, path)535 self.add_share(share)
536 self.add_share(share)536 else:
537 else:537 self.log.debug('share changed! %s', share_info.share_id)
538 self.log.debug('share changed! %s', info.share_id)538 self.share_changed(share_info)
539 self.share_changed(info)539
540 elif message == 'deleted':540 def handle_SV_SHARE_DELETED(self, share_id):
541 self.log.debug('share deleted! %s', info.share_id)541 """ handle SV_SHARE_DELETED event """
542 self.share_deleted(str(info.share_id))542 self.log.debug('share deleted! %s', share_id)
543 self.share_deleted(str(share_id))
543544
544 def handle_AQ_CREATE_SHARE_OK(self, share_id, marker):545 def handle_AQ_CREATE_SHARE_OK(self, share_id, marker):
545 """ handle AQ_CREATE_SHARE_OK event. """546 """ handle AQ_CREATE_SHARE_OK event. """
@@ -1493,5 +1494,3 @@
1493 def _pickle(self, value, fd, protocol):1494 def _pickle(self, value, fd, protocol):
1494 """Pickle value in fd using protocol."""1495 """Pickle value in fd using protocol."""
1495 cPickle.dump(value, fd, protocol=protocol)1496 cPickle.dump(value, fd, protocol=protocol)
1496
1497

Subscribers

People subscribed via source and target branches