Merge lp:~alecu/ubuntuone-client/fix-activity-journal-names into lp:ubuntuone-client

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 924
Merged at revision: 925
Proposed branch: lp:~alecu/ubuntuone-client/fix-activity-journal-names
Merge into: lp:ubuntuone-client
Prerequisite: lp:~alecu/ubuntuone-client/fix-ziggy-createshares
Diff against target: 685 lines (+117/-50)
2 files modified
tests/platform/linux/eventlog/test_zg_listener.py (+92/-50)
ubuntuone/eventlog/zg_listener.py (+25/-0)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/fix-activity-journal-names
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+53743@code.launchpad.net

Commit message

Set the freeform .text in Zeitgeist events, including file name. (fixes LP: #735613)

Description of the change

Make the name of the zeitgeist events use a user friendly m.text field, so when the gnome-activity-journal is used to browse the Ubuntu One history, no ubuntuone:uuids are shown there anymore.(fixes LP: #735613)

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

To test this IRL, make sure you have gnome-activity-journal installed, so all Zeitgeist dependencies are running.

If you've just installed zeitgeist, make sure to restart ubuntuone-syncdaemon.

Try copying files and directories into your UbuntuOne directory, and try uploading files and creating directories in the web UI; wait for them to sync.
Try deleting local and remote files.

Then go to the gnome-activity-journal and you'll see all files and folders there.
Also, try opening ~/.local/share/zeitgeist/activity.sqlite with sqlite3 and run "select * from event_view".

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks good, tests pass, but I still see uuids in the journal when running:

PYTHONPATH=. bin/ubuntuone-syncdaemon

from this branch. Do I need to do something else?

review: Needs Information
Revision history for this message
Eric Casteleijn (thisfred) wrote :

This is what I see in the sqlite db:

3978|1300721509453|7|1|1||ubuntuone:a366382b-10cc-4b77-9261-ccd8c5aa557e|20|2|file:////home/eric/Ubuntu One/emacs-stuff/pylint_etc_wrapper.py|20|pylint_etc_wrapper.py|net|

I'm thinking I need to kill and start something else?

Revision history for this message
Eric Casteleijn (thisfred) wrote :

It does show the filename in multiview and thumbview but the timeline view shows uuids. This is not an issue of this branch then, if it is an issue at all.

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :

Attempt to merge into lp:ubuntuone-client failed due to conflicts:

text conflict in tests/platform/linux/eventlog/test_zg_listener.py
text conflict in ubuntuone/eventlog/zg_listener.py

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (32.1 KiB)

The attempt to merge lp:~alecu/ubuntuone-client/fix-activity-journal-names into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.67
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.1
checking for libtool >= 1.5...
  testing libtoolize... found 2.2.6b
checking for intltool >= 0.30...
  testing intltoolize... found 0.41.1
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.25
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.16
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize depen...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/linux/eventlog/test_zg_listener.py'
2--- tests/platform/linux/eventlog/test_zg_listener.py 2011-03-21 16:41:20 +0000
3+++ tests/platform/linux/eventlog/test_zg_listener.py 2011-03-22 20:04:41 +0000
4@@ -26,6 +26,7 @@
5 import unittest
6 import uuid
7
8+from os.path import basename
9 from twisted.internet import defer
10 from zeitgeist.datamodel import Interpretation, Manifestation
11
12@@ -194,6 +195,7 @@
13
14 self.assertEqual(len(self.listener.zg.events), 1)
15 event = self.listener.zg.events[0]
16+ foldername = basename(path)
17
18 self.assertEqual(event.interpretation,
19 EVENT_INTERPRETATION_U1_FOLDER_SHARED)
20@@ -207,6 +209,7 @@
21 self.assertEqual(folder.manifestation,
22 Manifestation.REMOTE_DATA_OBJECT)
23 self.assertTrue(folder.origin.endswith(path))
24+ self.assertEqual(folder.text, foldername)
25 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
26 self.assertEqual(folder.storage, STORAGE_NETWORK)
27
28@@ -215,6 +218,7 @@
29 self.assertEqual(other_user.interpretation, INTERPRETATION_U1_CONTACT)
30 self.assertEqual(other_user.manifestation,
31 MANIFESTATION_U1_CONTACT_DATA_OBJECT)
32+ self.assertEqual(other_user.text, fake_username)
33
34
35 @defer.inlineCallbacks
36@@ -223,7 +227,8 @@
37 sample_share_id = "share id"
38 sample_node_id = "node id"
39 fake_username = "fake user"
40- path = os.path.join(self.vm.root.path, 'shared_path')
41+ folder_name = "shared_path"
42+ path = os.path.join(self.vm.root.path, folder_name)
43 self.main.fs.create(path, "")
44 self.main.fs.set_node_id(path, sample_node_id)
45 share = Shared(path=path, volume_id=sample_share_id,
46@@ -256,6 +261,7 @@
47 self.assertEqual(folder.manifestation,
48 Manifestation.REMOTE_DATA_OBJECT)
49 self.assertTrue(folder.origin.endswith(path))
50+ self.assertEqual(folder.text, folder_name)
51 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
52 self.assertEqual(folder.storage, STORAGE_NETWORK)
53
54@@ -264,6 +270,7 @@
55 self.assertEqual(other_user.interpretation, INTERPRETATION_U1_CONTACT)
56 self.assertEqual(other_user.manifestation,
57 MANIFESTATION_U1_CONTACT_DATA_OBJECT)
58+ self.assertEqual(other_user.text, fake_username)
59
60 @defer.inlineCallbacks
61 def test_share_accepted_is_logged(self):
62@@ -271,9 +278,10 @@
63 # initialize the the root
64 self.vm._got_root('root_uuid')
65 fake_username = "fake user"
66- path = os.path.join(self.vm.root.path, 'shared_path')
67+ folder_name = "shared_path"
68+ path = os.path.join(self.vm.root.path, folder_name)
69 self.main.fs.create(path, "")
70- share_path = os.path.join(self.shares_dir, 'fake_share')
71+ share_path = os.path.join(self.shares_dir, folder_name)
72 share = Share(path=share_path, volume_id='volume_id', node_id="node_id",
73 other_username=fake_username)
74 yield self.vm.add_share(share)
75@@ -293,6 +301,7 @@
76 self.assertEqual(folder.manifestation,
77 Manifestation.REMOTE_DATA_OBJECT)
78 self.assertTrue(folder.origin.endswith(share_path))
79+ self.assertEqual(folder.text, folder_name)
80 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
81 self.assertEqual(folder.storage, STORAGE_NETWORK)
82
83@@ -301,15 +310,17 @@
84 self.assertEqual(other_user.interpretation, INTERPRETATION_U1_CONTACT)
85 self.assertEqual(other_user.manifestation,
86 MANIFESTATION_U1_CONTACT_DATA_OBJECT)
87+ self.assertEqual(other_user.text, fake_username)
88
89
90 @defer.inlineCallbacks
91 def test_share_unaccepted_is_logged(self):
92 """Test that an unaccepted share event is logged."""
93 fake_username = "fake user"
94+ folder_name = u"share"
95 d = defer.Deferred()
96
97- share_path = os.path.join(self.main.shares_dir, 'share')
98+ share_path = os.path.join(self.main.shares_dir, folder_name)
99 holder = NotifyShareHolder.from_params(uuid.uuid4(),
100 uuid.uuid4(),
101 u'fake_share',
102@@ -337,6 +348,7 @@
103 self.assertEqual(folder.manifestation,
104 Manifestation.REMOTE_DATA_OBJECT)
105 self.assertTrue(folder.origin.endswith(share_path))
106+ self.assertEqual(folder.text, folder_name)
107 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
108 self.assertEqual(folder.storage, STORAGE_NETWORK)
109
110@@ -345,6 +357,7 @@
111 self.assertEqual(other_user.interpretation, INTERPRETATION_U1_CONTACT)
112 self.assertEqual(other_user.manifestation,
113 MANIFESTATION_U1_CONTACT_DATA_OBJECT)
114+ self.assertEqual(other_user.text, fake_username)
115
116
117 class ZeitgeistUDFsTestCase(ZeitgeistListenerTestCase):
118@@ -375,7 +388,8 @@
119 @defer.inlineCallbacks
120 def test_udf_create_is_logged(self):
121 """Test for Folders.create."""
122- path = os.path.join(self.home_dir, u'ñoño'.encode('utf-8'))
123+ folder_name = u'ñoño'.encode('utf-8')
124+ path = os.path.join(self.home_dir, folder_name)
125 id = uuid.uuid4()
126 node_id = uuid.uuid4()
127
128@@ -413,6 +427,7 @@
129 self.assertEqual(folder.manifestation,
130 Manifestation.REMOTE_DATA_OBJECT)
131 self.assertTrue(folder.origin.endswith(path))
132+ self.assertEqual(folder.text, folder_name)
133 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
134 self.assertEqual(folder.storage, STORAGE_NETWORK)
135
136@@ -421,7 +436,8 @@
137 """Test for Folders.delete."""
138 id = uuid.uuid4()
139 node_id = uuid.uuid4()
140- path = os.path.join(self.home_dir, u'ñoño'.encode('utf-8'))
141+ folder_name = u'ñoño'.encode('utf-8')
142+ path = os.path.join(self.home_dir, folder_name)
143
144 d = defer.Deferred()
145 self.listener.zg.deferreds.append(d)
146@@ -472,13 +488,15 @@
147 self.assertEqual(folder.manifestation,
148 Manifestation.DELETED_RESOURCE)
149 self.assertTrue(folder.origin.endswith(path))
150+ self.assertEqual(folder.text, folder_name)
151 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
152 self.assertEqual(folder.storage, STORAGE_DELETED)
153
154 @defer.inlineCallbacks
155 def test_udf_subscribe_is_logged(self):
156 """Test for Folders.subscribe."""
157- suggested_path = u'~/ñoño'
158+ folder_name = u"ñoño"
159+ suggested_path = u'~/' + folder_name
160 udf = self._create_udf(uuid.uuid4(), 'node_id', suggested_path,
161 subscribed=False)
162 yield self.main.vm.add_udf(udf)
163@@ -502,6 +520,7 @@
164 self.assertEqual(folder.manifestation,
165 Manifestation.FILE_DATA_OBJECT)
166 self.assertTrue(folder.origin.startswith(URI_PROTOCOL_U1))
167+ self.assertEqual(folder.text, folder_name)
168 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
169 self.assertEqual(folder.storage, STORAGE_LOCAL)
170
171@@ -511,6 +530,7 @@
172 suggested_path = u'~/ñoño'
173 udf = self._create_udf(uuid.uuid4(), 'node_id', suggested_path,
174 subscribed=True)
175+ folder_name = basename(udf.path)
176 yield self.main.vm.add_udf(udf)
177 d = defer.Deferred()
178 self._listen_for('VM_UDF_UNSUBSCRIBED', d.callback, 1, collect=True)
179@@ -532,6 +552,7 @@
180 self.assertEqual(folder.manifestation,
181 Manifestation.DELETED_RESOURCE)
182 self.assertTrue(folder.origin.startswith(URI_PROTOCOL_U1))
183+ self.assertEqual(folder.text, folder_name)
184 self.assertEqual(folder.mimetype, DIRECTORY_MIMETYPE)
185 self.assertEqual(folder.storage, STORAGE_DELETED)
186
187@@ -620,6 +641,7 @@
188 self.assertEqual(remote_file.manifestation,
189 Manifestation.REMOTE_DATA_OBJECT)
190 self.assertTrue(remote_file.origin.endswith(filename))
191+ self.assertEqual(remote_file.text, filename)
192 self.assertEqual(remote_file.mimetype, "audio/mpeg")
193 self.assertEqual(remote_file.storage, STORAGE_NETWORK)
194
195@@ -655,14 +677,15 @@
196 Manifestation.SCHEDULED_ACTIVITY)
197 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
198
199- remote_file = event.subjects[0]
200- self.assertTrue(remote_file.uri.startswith(URI_PROTOCOL_U1))
201- self.assertEqual(remote_file.interpretation, Interpretation.FOLDER)
202- self.assertEqual(remote_file.manifestation,
203+ remote_folder = event.subjects[0]
204+ self.assertTrue(remote_folder.uri.startswith(URI_PROTOCOL_U1))
205+ self.assertEqual(remote_folder.interpretation, Interpretation.FOLDER)
206+ self.assertEqual(remote_folder.manifestation,
207 Manifestation.REMOTE_DATA_OBJECT)
208- self.assertTrue(remote_file.origin.endswith(dirname))
209- self.assertEqual(remote_file.mimetype, DIRECTORY_MIMETYPE)
210- self.assertEqual(remote_file.storage, STORAGE_NETWORK)
211+ self.assertTrue(remote_folder.origin.endswith(dirname))
212+ self.assertEqual(remote_folder.text, dirname)
213+ self.assertEqual(remote_folder.mimetype, DIRECTORY_MIMETYPE)
214+ self.assertEqual(remote_folder.storage, STORAGE_NETWORK)
215
216 def test_syncdaemon_modifies_on_server_is_logged(self):
217 """Files modified by SyncDaemon on the server are logged."""
218@@ -702,12 +725,14 @@
219 self.assertEqual(remote_file.manifestation,
220 Manifestation.REMOTE_DATA_OBJECT)
221 self.assertTrue(remote_file.origin.endswith(filename))
222+ self.assertEqual(remote_file.text, filename)
223 self.assertEqual(remote_file.mimetype, "audio/mpeg")
224 self.assertEqual(remote_file.storage, STORAGE_NETWORK)
225
226 @defer.inlineCallbacks
227 def test_syncdaemon_deletes_file_on_server_is_logged(self):
228 """Files deleted by SD on the server are logged."""
229+ file_name = "filename.mp3"
230 d = defer.Deferred()
231 listen_for(self.main.event_q, 'AQ_UNLINK_OK', d.callback)
232
233@@ -727,18 +752,20 @@
234 Manifestation.SCHEDULED_ACTIVITY)
235 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
236
237- remote_folder = event.subjects[0]
238- self.assertTrue(remote_folder.uri.startswith(URI_PROTOCOL_U1))
239- self.assertEqual(remote_folder.interpretation, Interpretation.AUDIO)
240- self.assertEqual(remote_folder.manifestation,
241+ remote_file = event.subjects[0]
242+ self.assertTrue(remote_file.uri.startswith(URI_PROTOCOL_U1))
243+ self.assertEqual(remote_file.interpretation, Interpretation.AUDIO)
244+ self.assertEqual(remote_file.manifestation,
245 Manifestation.DELETED_RESOURCE)
246- self.assertTrue(remote_folder.origin.endswith("filename.mp3"))
247- self.assertEqual(remote_folder.mimetype, "audio/mpeg")
248- self.assertEqual(remote_folder.storage, STORAGE_DELETED)
249+ self.assertTrue(remote_file.origin.endswith(file_name))
250+ self.assertEqual(remote_file.text, file_name)
251+ self.assertEqual(remote_file.mimetype, "audio/mpeg")
252+ self.assertEqual(remote_file.storage, STORAGE_DELETED)
253
254 @defer.inlineCallbacks
255 def test_syncdaemon_deletes_dir_on_server_is_logged(self):
256- """Files deleted by SD on the server are logged."""
257+ """Directories deleted by SD on the server are logged."""
258+ folder_name = "folder name"
259 d = defer.Deferred()
260 listen_for(self.main.event_q, 'AQ_UNLINK_OK', d.callback)
261
262@@ -763,7 +790,8 @@
263 self.assertEqual(remote_folder.interpretation, Interpretation.FOLDER)
264 self.assertEqual(remote_folder.manifestation,
265 Manifestation.DELETED_RESOURCE)
266- self.assertTrue(remote_folder.origin.endswith("folder name"))
267+ self.assertTrue(remote_folder.origin.endswith(folder_name))
268+ self.assertEqual(remote_folder.text, folder_name)
269 self.assertEqual(remote_folder.mimetype, DIRECTORY_MIMETYPE)
270 self.assertEqual(remote_folder.storage, STORAGE_DELETED)
271
272@@ -823,6 +851,7 @@
273 @defer.inlineCallbacks
274 def test_syncdaemon_creates_file_locally_is_logged(self):
275 """Files created locally by SyncDaemon are logged."""
276+ file_name = self.filemp3delta.name.encode('utf8')
277 d = defer.Deferred()
278 d2 = defer.Deferred()
279 listen_for(self.main.event_q, 'SV_FILE_NEW', d.callback)
280@@ -835,7 +864,7 @@
281
282 # check that the file is created
283 node = self.main.fs.get_by_node_id(ROOT, self.filemp3delta.node_id)
284- self.assertEqual(node.path, self.filemp3delta.name.encode('utf8'))
285+ self.assertEqual(node.path, file_name)
286 self.assertEqual(node.is_dir, False)
287 self.assertEqual(node.generation, self.filemp3delta.generation)
288
289@@ -859,18 +888,19 @@
290 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
291
292 local_file = event.subjects[0]
293- self.assertTrue(local_file.uri.endswith(
294- self.filemp3delta.name.encode('utf8')))
295+ self.assertTrue(local_file.uri.endswith(file_name))
296 self.assertEqual(local_file.interpretation, Interpretation.AUDIO)
297 self.assertEqual(local_file.manifestation,
298 Manifestation.FILE_DATA_OBJECT)
299 self.assertTrue(local_file.origin.startswith(URI_PROTOCOL_U1))
300+ self.assertEqual(local_file.text, file_name)
301 self.assertEqual(local_file.mimetype, "audio/mpeg")
302 self.assertEqual(local_file.storage, STORAGE_LOCAL)
303
304 @defer.inlineCallbacks
305 def test_syncdaemon_creates_dir_locally_is_logged(self):
306 """Dirs created locally by SyncDaemon are logged."""
307+ folder_name = self.dirdelta.name.encode('utf8')
308 d = defer.Deferred()
309 listen_for(self.main.event_q, 'SV_DIR_NEW', d.callback)
310
311@@ -881,7 +911,7 @@
312
313 # check that the dir is created
314 node = self.main.fs.get_by_node_id(ROOT, self.dirdelta.node_id)
315- self.assertEqual(node.path, self.dirdelta.name.encode('utf8'))
316+ self.assertEqual(node.path, folder_name)
317 self.assertEqual(node.is_dir, True)
318 self.assertEqual(node.generation, self.dirdelta.generation)
319
320@@ -896,19 +926,20 @@
321 Manifestation.WORLD_ACTIVITY)
322 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
323
324- local_file = event.subjects[0]
325- self.assertTrue(local_file.uri.endswith(
326- self.dirdelta.name.encode('utf8')))
327- self.assertEqual(local_file.interpretation, Interpretation.FOLDER)
328- self.assertEqual(local_file.manifestation,
329+ local_folder = event.subjects[0]
330+ self.assertTrue(local_folder.uri.endswith(folder_name))
331+ self.assertEqual(local_folder.interpretation, Interpretation.FOLDER)
332+ self.assertEqual(local_folder.manifestation,
333 Manifestation.FILE_DATA_OBJECT)
334- self.assertTrue(local_file.origin.startswith(URI_PROTOCOL_U1))
335- self.assertEqual(local_file.mimetype, DIRECTORY_MIMETYPE)
336- self.assertEqual(local_file.storage, STORAGE_LOCAL)
337+ self.assertTrue(local_folder.origin.startswith(URI_PROTOCOL_U1))
338+ self.assertEqual(local_folder.text, folder_name)
339+ self.assertEqual(local_folder.mimetype, DIRECTORY_MIMETYPE)
340+ self.assertEqual(local_folder.storage, STORAGE_LOCAL)
341
342 @defer.inlineCallbacks
343 def test_syncdaemon_modifies_locally_is_logged(self):
344 """Files modified locally by SyncDaemon are logged."""
345+ file_name = self.filemp3delta.name.encode('utf8')
346 d = defer.Deferred()
347 d2 = defer.Deferred()
348 listen_for(self.main.event_q, 'SV_FILE_NEW', d.callback)
349@@ -921,7 +952,7 @@
350
351 # check that the file is modified
352 node = self.main.fs.get_by_node_id(ROOT, self.filemp3delta.node_id)
353- self.assertEqual(node.path, self.filemp3delta.name.encode('utf8'))
354+ self.assertEqual(node.path, file_name)
355 self.assertEqual(node.is_dir, False)
356 self.assertEqual(node.generation, self.filemp3delta.generation)
357
358@@ -949,18 +980,19 @@
359 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
360
361 local_file = event.subjects[0]
362- self.assertTrue(local_file.uri.endswith(
363- self.filemp3delta.name.encode('utf8')))
364+ self.assertTrue(local_file.uri.endswith(file_name))
365 self.assertEqual(local_file.interpretation, Interpretation.AUDIO)
366 self.assertEqual(local_file.manifestation,
367 Manifestation.FILE_DATA_OBJECT)
368 self.assertTrue(local_file.origin.startswith(URI_PROTOCOL_U1))
369+ self.assertEqual(local_file.text, file_name)
370 self.assertEqual(local_file.mimetype, "audio/mpeg")
371 self.assertEqual(local_file.storage, STORAGE_LOCAL)
372
373 @defer.inlineCallbacks
374 def test_syncdaemon_deletes_file_locally_is_logged(self):
375 """Files deleted locally by SyncDaemon are logged."""
376+ file_name = self.filemp3delta.name.encode("utf-8")
377 d = defer.Deferred()
378 listen_for(self.main.event_q, 'SV_FILE_DELETED', d.callback)
379
380@@ -981,18 +1013,19 @@
381 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
382
383 local_file = event.subjects[0]
384- self.assertTrue(local_file.uri.endswith(
385- self.filemp3delta.name.encode('utf8')))
386+ self.assertTrue(local_file.uri.endswith(file_name))
387 self.assertEqual(local_file.interpretation, Interpretation.AUDIO)
388 self.assertEqual(local_file.manifestation,
389 Manifestation.DELETED_RESOURCE)
390 self.assertTrue(local_file.origin.startswith(URI_PROTOCOL_U1))
391+ self.assertEqual(local_file.text, file_name)
392 self.assertEqual(local_file.mimetype, "audio/mpeg")
393 self.assertEqual(local_file.storage, STORAGE_DELETED)
394
395 @defer.inlineCallbacks
396 def test_syncdaemon_deletes_dir_locally_is_logged(self):
397 """Dirs deleted locally by SyncDaemon are logged."""
398+ folder_name = "folder name"
399 d = defer.Deferred()
400 listen_for(self.main.event_q, 'SV_FILE_DELETED', d.callback)
401
402@@ -1013,21 +1046,23 @@
403 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
404
405 local_folder = event.subjects[0]
406- self.assertTrue(local_folder.uri.endswith("folder name"))
407+ self.assertTrue(local_folder.uri.endswith(folder_name))
408 self.assertEqual(local_folder.interpretation, Interpretation.FOLDER)
409 self.assertEqual(local_folder.manifestation,
410 Manifestation.DELETED_RESOURCE)
411 self.assertTrue(local_folder.origin.startswith(URI_PROTOCOL_U1))
412+ self.assertEqual(local_folder.text, folder_name)
413 self.assertEqual(local_folder.mimetype, DIRECTORY_MIMETYPE)
414 self.assertEqual(local_folder.storage, STORAGE_DELETED)
415
416 @defer.inlineCallbacks
417 def test_file_sync_conflict_is_logged(self):
418 """Files renamed because of conflict are logged."""
419+ file_name = "sample.mp3"
420 d = defer.Deferred()
421 listen_for(self.main.event_q, 'FSM_FILE_CONFLICT', d.callback)
422
423- testfile = os.path.join(self.main.vm.root.path, 'sample.mp3')
424+ testfile = os.path.join(self.main.vm.root.path, file_name)
425 mdid = self.main.fs.create(testfile, "")
426 self.main.fs.set_node_id(testfile, "uuid")
427 with open(testfile, "w") as fh:
428@@ -1053,16 +1088,19 @@
429 self.assertEqual(local_file.manifestation,
430 Manifestation.FILE_DATA_OBJECT)
431 self.assertTrue(local_file.origin.endswith(testfile))
432+ self.assertEqual(local_file.text,
433+ file_name + self.main.fs.CONFLICT_SUFFIX)
434 self.assertEqual(local_file.mimetype, "audio/mpeg")
435 self.assertEqual(local_file.storage, STORAGE_LOCAL)
436
437 @defer.inlineCallbacks
438 def test_dir_sync_conflict_is_logged(self):
439 """Dirs renamed because of conflict are logged."""
440+ folder_name = "sampledir"
441 d = defer.Deferred()
442 listen_for(self.main.event_q, 'FSM_DIR_CONFLICT', d.callback)
443
444- testdir = os.path.join(self.main.vm.root.path, 'sampledir')
445+ testdir = os.path.join(self.main.vm.root.path, folder_name)
446 mdid = self.main.fs.create(testdir, "", is_dir=True)
447 self.main.fs.set_node_id(testdir, "uuid")
448 os.mkdir(testdir)
449@@ -1080,15 +1118,17 @@
450 Manifestation.WORLD_ACTIVITY)
451 self.assertEqual(event.actor, ACTOR_UBUNTUONE)
452
453- local_file = event.subjects[0]
454+ local_folder = event.subjects[0]
455 new_name = testdir + self.main.fs.CONFLICT_SUFFIX
456- self.assertTrue(local_file.uri.endswith(new_name))
457- self.assertEqual(local_file.interpretation, Interpretation.FOLDER)
458- self.assertEqual(local_file.manifestation,
459+ self.assertTrue(local_folder.uri.endswith(new_name))
460+ self.assertEqual(local_folder.interpretation, Interpretation.FOLDER)
461+ self.assertEqual(local_folder.manifestation,
462 Manifestation.FILE_DATA_OBJECT)
463- self.assertTrue(local_file.origin.endswith(testdir))
464- self.assertEqual(local_file.mimetype, DIRECTORY_MIMETYPE)
465- self.assertEqual(local_file.storage, STORAGE_LOCAL)
466+ self.assertTrue(local_folder.origin.endswith(testdir))
467+ self.assertEqual(local_folder.text,
468+ folder_name + self.main.fs.CONFLICT_SUFFIX)
469+ self.assertEqual(local_folder.mimetype, DIRECTORY_MIMETYPE)
470+ self.assertEqual(local_folder.storage, STORAGE_LOCAL)
471
472 class ZeitgeistPublicFilesTestCase(ZeitgeistListenerTestCase):
473 """Public files events are logged into Zeitgeist."""
474@@ -1130,6 +1170,7 @@
475 self.assertEqual(public_file.manifestation,
476 Manifestation.REMOTE_DATA_OBJECT)
477 self.assertTrue(public_file.origin.endswith(node_id))
478+ self.assertEqual(public_file.text, public_url)
479 self.assertEqual(public_file.mimetype, "audio/mpeg")
480 self.assertEqual(public_file.storage, STORAGE_NETWORK)
481
482@@ -1170,6 +1211,7 @@
483 self.assertEqual(public_file.manifestation,
484 Manifestation.DELETED_RESOURCE)
485 self.assertTrue(public_file.origin.endswith(node_id))
486+ self.assertEqual(public_file.text, public_url)
487 self.assertEqual(public_file.mimetype, "audio/mpeg")
488 self.assertEqual(public_file.storage, STORAGE_DELETED)
489
490
491=== modified file 'ubuntuone/eventlog/zg_listener.py'
492--- ubuntuone/eventlog/zg_listener.py 2011-03-21 16:41:20 +0000
493+++ ubuntuone/eventlog/zg_listener.py 2011-03-22 20:04:41 +0000
494@@ -19,6 +19,8 @@
495
496 import mimetypes
497
498+from os.path import basename
499+
500 from zeitgeist.datamodel import Event, Interpretation, Manifestation, Subject
501 from zeitgeist.mimetypes import get_interpretation_for_mimetype
502
503@@ -74,12 +76,14 @@
504 def log_folder_shared(self, share, share_id):
505 """Log the 'directory shared' event."""
506 fullpath = share.path
507+ folder_name = basename(fullpath)
508
509 folder = Subject.new_for_values(
510 uri=URI_PROTOCOL_U1 + str(share.node_id),
511 interpretation=Interpretation.FOLDER,
512 manifestation=Manifestation.REMOTE_DATA_OBJECT,
513 origin="file:///" + fullpath,
514+ text=folder_name,
515 mimetype=DIRECTORY_MIMETYPE,
516 storage=STORAGE_NETWORK)
517
518@@ -87,6 +91,7 @@
519 other_user = Subject.new_for_values(
520 uri="mailto:" + other_username,
521 interpretation=INTERPRETATION_U1_CONTACT,
522+ text=other_username,
523 manifestation=MANIFESTATION_U1_CONTACT_DATA_OBJECT)
524
525 event = Event.new_for_values(
526@@ -104,6 +109,7 @@
527 interpretation=Interpretation.FOLDER,
528 manifestation=Manifestation.REMOTE_DATA_OBJECT,
529 origin="file:///" + share.path,
530+ text=basename(share.path),
531 mimetype=DIRECTORY_MIMETYPE,
532 storage=STORAGE_NETWORK)
533
534@@ -111,6 +117,7 @@
535 other_user = Subject.new_for_values(
536 uri="mailto:" + other_username,
537 interpretation=INTERPRETATION_U1_CONTACT,
538+ text=other_username,
539 manifestation=MANIFESTATION_U1_CONTACT_DATA_OBJECT)
540
541 event = Event.new_for_values(
542@@ -130,6 +137,7 @@
543 interpretation=Interpretation.FOLDER,
544 manifestation=Manifestation.REMOTE_DATA_OBJECT,
545 origin="file:///" + share.path,
546+ text=basename(share.path),
547 mimetype=DIRECTORY_MIMETYPE,
548 storage=STORAGE_NETWORK)
549
550@@ -137,6 +145,7 @@
551 other_user = Subject.new_for_values(
552 uri="mailto:" + other_username,
553 interpretation=INTERPRETATION_U1_CONTACT,
554+ text=other_username,
555 manifestation=MANIFESTATION_U1_CONTACT_DATA_OBJECT)
556
557 event = Event.new_for_values(
558@@ -154,6 +163,7 @@
559 interpretation=Interpretation.FOLDER,
560 manifestation=Manifestation.REMOTE_DATA_OBJECT,
561 origin="file:///" + share.path,
562+ text=basename(share.path),
563 mimetype=DIRECTORY_MIMETYPE,
564 storage=STORAGE_NETWORK)
565
566@@ -161,6 +171,7 @@
567 other_user = Subject.new_for_values(
568 uri="mailto:" + other_username,
569 interpretation=INTERPRETATION_U1_CONTACT,
570+ text=other_username,
571 manifestation=MANIFESTATION_U1_CONTACT_DATA_OBJECT)
572
573 event = Event.new_for_values(
574@@ -178,6 +189,7 @@
575 interpretation=Interpretation.FOLDER,
576 manifestation=Manifestation.DELETED_RESOURCE,
577 origin="file:///" + volume.path,
578+ text=basename(volume.path),
579 mimetype=DIRECTORY_MIMETYPE,
580 storage=STORAGE_DELETED)
581
582@@ -203,6 +215,7 @@
583 interpretation=Interpretation.FOLDER,
584 manifestation=Manifestation.REMOTE_DATA_OBJECT,
585 origin="file:///" + udf.path,
586+ text=basename(udf.path),
587 mimetype=DIRECTORY_MIMETYPE,
588 storage=STORAGE_NETWORK)
589
590@@ -222,6 +235,7 @@
591 interpretation=Interpretation.FOLDER,
592 manifestation=Manifestation.FILE_DATA_OBJECT,
593 origin=URI_PROTOCOL_U1 + str(udf.node_id),
594+ text=basename(udf.path),
595 mimetype=DIRECTORY_MIMETYPE,
596 storage=STORAGE_LOCAL)
597
598@@ -241,6 +255,7 @@
599 interpretation=Interpretation.FOLDER,
600 manifestation=Manifestation.DELETED_RESOURCE,
601 origin=URI_PROTOCOL_U1 + str(udf.node_id),
602+ text=basename(udf.path),
603 mimetype=DIRECTORY_MIMETYPE,
604 storage=STORAGE_DELETED)
605
606@@ -286,6 +301,7 @@
607 interpretation=interp,
608 manifestation=Manifestation.REMOTE_DATA_OBJECT,
609 origin="file:///" + path,
610+ text=basename(path),
611 mimetype=mime,
612 storage=STORAGE_NETWORK)
613
614@@ -308,6 +324,7 @@
615 interpretation=Interpretation.FOLDER,
616 manifestation=Manifestation.REMOTE_DATA_OBJECT,
617 origin="file:///" + path,
618+ text=basename(path),
619 mimetype=DIRECTORY_MIMETYPE,
620 storage=STORAGE_NETWORK)
621
622@@ -342,6 +359,7 @@
623 interpretation=interp,
624 manifestation=Manifestation.FILE_DATA_OBJECT,
625 origin=URI_PROTOCOL_U1 + str(node_id),
626+ text=basename(path),
627 mimetype=mime,
628 storage=STORAGE_LOCAL)
629
630@@ -364,6 +382,7 @@
631 interpretation=Interpretation.FOLDER,
632 manifestation=Manifestation.FILE_DATA_OBJECT,
633 origin=URI_PROTOCOL_U1 + str(node_id),
634+ text=basename(path),
635 mimetype=DIRECTORY_MIMETYPE,
636 storage=STORAGE_LOCAL)
637
638@@ -388,6 +407,7 @@
639 interpretation=interp,
640 manifestation=Manifestation.DELETED_RESOURCE,
641 origin=URI_PROTOCOL_U1 + str(node_id),
642+ text=basename(old_path),
643 mimetype=mime,
644 storage=STORAGE_DELETED)
645
646@@ -413,6 +433,7 @@
647 interpretation=interp,
648 manifestation=Manifestation.DELETED_RESOURCE,
649 origin="file:///" + old_path,
650+ text=basename(old_path),
651 mimetype=mime,
652 storage=STORAGE_DELETED)
653
654@@ -433,6 +454,7 @@
655 interpretation=interp,
656 manifestation=Manifestation.FILE_DATA_OBJECT,
657 origin="file:///" + old_name,
658+ text=basename(new_name),
659 mimetype=mime,
660 storage=STORAGE_LOCAL)
661
662@@ -451,6 +473,7 @@
663 interpretation=Interpretation.FOLDER,
664 manifestation=Manifestation.FILE_DATA_OBJECT,
665 origin="file:///" + old_name,
666+ text=basename(new_name),
667 mimetype=DIRECTORY_MIMETYPE,
668 storage=STORAGE_LOCAL)
669
670@@ -482,6 +505,7 @@
671 interpretation=interp,
672 manifestation=Manifestation.REMOTE_DATA_OBJECT,
673 origin=origin,
674+ text=public_url,
675 mimetype=mime,
676 storage=STORAGE_NETWORK)
677
678@@ -504,6 +528,7 @@
679 uri=public_url,
680 interpretation=interp,
681 manifestation=Manifestation.DELETED_RESOURCE,
682+ text=public_url,
683 origin=origin,
684 mimetype=mime,
685 storage=STORAGE_DELETED)

Subscribers

People subscribed via source and target branches