Merge lp:~manishsinha/zeitgeist-sharp/fixed-monitor into lp:~zeitgeist-sharp/zeitgeist-sharp/trunk

Status: Merged
Merged at revision: 46
Proposed branch: lp:~manishsinha/zeitgeist-sharp/fixed-monitor
Merge into: lp:~zeitgeist-sharp/zeitgeist-sharp/trunk
Diff against target: 1892 lines (+1293/-71)
24 files modified
.bzrignore (+9/-0)
Zeitgeist.Testsuite/Blacklist/TestMonitor.cs (+65/-0)
Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs (+449/-0)
Zeitgeist.Testsuite/Datamodel/TestManifestation.cs (+156/-0)
Zeitgeist.Testsuite/Log/TestDeleteEvents.cs (+50/-0)
Zeitgeist.Testsuite/Log/TestFindEventIds.cs (+36/-0)
Zeitgeist.Testsuite/Log/TestFindEvents.cs (+43/-0)
Zeitgeist.Testsuite/Log/TestGetEvents.cs (+54/-0)
Zeitgeist.Testsuite/Log/TestInsertEvents.cs (+38/-0)
Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj (+68/-0)
Zeitgeist.sln (+6/-0)
Zeitgeist/Client/ILog.cs (+6/-6)
Zeitgeist/Datamodel/Delegates.cs (+10/-0)
Zeitgeist/Datamodel/Event.cs (+16/-11)
Zeitgeist/Datamodel/Interpretation.cs (+46/-30)
Zeitgeist/Datamodel/Manifestation.cs (+7/-7)
Zeitgeist/Datamodel/Monitor.cs (+103/-0)
Zeitgeist/Datamodel/NameUri.cs (+2/-0)
Zeitgeist/Datamodel/Subject.cs (+12/-1)
Zeitgeist/Datamodel/TimeRange.cs (+71/-7)
Zeitgeist/LogClient.cs (+29/-6)
Zeitgeist/Zeitgeist.csproj (+5/-1)
Zeitgeist/ZsUtils.cs (+11/-2)
configure.ac (+1/-0)
To merge this branch: bzr merge lp:~manishsinha/zeitgeist-sharp/fixed-monitor
Reviewer Review Type Date Requested Status
Mirco Bauer api Approve
Review via email: mp+38948@code.launchpad.net

Description of the change

Added support for Monitor and added many unit tests
Before reviewing this merge, please have a look at the comments at
https://code.launchpad.net/~manishsinha/zeitgeist-sharp/testsuite/+merge/37400

To post a comment you must log in.
Revision history for this message
Mirco Bauer (meebey) wrote :

Please leave the DateTime,DateTime ctor so the API user is not forced to pass Int64 values or add extra lines for using the properties:
1636 - public TimeRange(DateTime startTime, DateTime endTime)
1637 - {
1638 - _begin = startTime;
1639 - _end = endTime;
1640 + public TimeRange()
1641 + {
1642 + }
1643 +
1644 + public TimeRange(Int64 startTime, Int64 endTime)
1645 + {
1646 + _begin = ZsUtils.ToDateTime((ulong)startTime);
1647 + _end = ZsUtils.ToDateTime((ulong)endTime);
1648 }

Besides that, the changes look good!

review: Needs Fixing
46. By Manish Sinha (मनीष सिन्हा)

Added a ctor for TimeRange which takes the start and end values as DateTime instances

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I added the extra constructor. I think this solves the only issue

Revision history for this message
Mirco Bauer (meebey) wrote :

looks good now

review: Approve (api)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-09-05 13:02:10 +0000
3+++ .bzrignore 2010-10-21 15:22:21 +0000
4@@ -1,3 +1,12 @@
5+autom4te.cache
6+install-sh
7+missing
8+aclocal.m4
9+configure
10+config.log
11+config.status
12+Makefile
13+Makefile.in
14 bin/
15 *.userpr*
16 *pidb
17
18=== added directory 'Zeitgeist.Testsuite'
19=== added directory 'Zeitgeist.Testsuite/Blacklist'
20=== added file 'Zeitgeist.Testsuite/Blacklist/TestMonitor.cs'
21--- Zeitgeist.Testsuite/Blacklist/TestMonitor.cs 1970-01-01 00:00:00 +0000
22+++ Zeitgeist.Testsuite/Blacklist/TestMonitor.cs 2010-10-21 15:22:21 +0000
23@@ -0,0 +1,65 @@
24+using System;
25+using NUnit.Framework;
26+using Zeitgeist;
27+using Zeitgeist.Datamodel;
28+using System.Collections.Generic;
29+
30+namespace Zeitgeist.Testsuite
31+{
32+ [TestFixture()]
33+ public class TestMonitor
34+ {
35+ [Test()]
36+ public void TestMonitorPass ()
37+ {
38+ Event ev1 = new Event();
39+ ev1.Interpretation = Interpretation.Instance.EventInterpretation.ModifyEvent;
40+ ev1.Manifestation = Manifestation.Instance.HardDiskPartition;
41+ ev1.Actor = "application://tomboy.desktop";
42+ Subject sub11 = new Subject();
43+ sub11.MimeType = "text/plain";
44+ sub11.Interpretation = Interpretation.Instance.Font;
45+ Subject sub12 = new Subject();
46+ sub12.MimeType = "text/plain";
47+ ev1.Subjects.Add(sub11);
48+ ev1.Subjects.Add(sub12);
49+
50+ Event ev2 = new Event();
51+ ev2.Interpretation = Interpretation.Instance.EventInterpretation.ModifyEvent;
52+ ev2.Manifestation = Manifestation.Instance.SoftwareItem;
53+ ev2.Actor = "application://tomboy.desktop";
54+ Subject sub21 = new Subject();
55+ Subject sub22 = new Subject();
56+ ev2.Subjects.Add(sub21);
57+ ev2.Subjects.Add(sub22);
58+
59+ Monitor mn = new Monitor("/org/gnome/zeitgeist/unittest");
60+ mn.Inserted += delegate(TimeRange range, List<Event> events) {
61+ Console.WriteLine("Inserted");
62+ };
63+ mn.Deleted += delegate(TimeRange range, List<uint> eventIds) {
64+ Console.WriteLine("Deleted");
65+ };
66+
67+ LogClient cl = new LogClient();
68+ TimeRange rng = new TimeRange();
69+ rng.Begin = DateTime.Now.AddDays(-1);
70+ rng.End = DateTime.Now.AddDays(1);
71+
72+ Event ev = new Event();
73+ ev.Actor = "application://tomboy.desktop";
74+ Subject sub1 = new Subject();
75+ Subject sub2 = new Subject();
76+ ev.Subjects.Add(sub1);
77+ ev.Subjects.Add(sub2);
78+
79+ cl.InstallMonitor("/org/gnome/zeitgeist/unittest", rng, new List<Event>() {ev});
80+
81+ List<uint> eventidList = cl.InsertEvents(new List<Event>() { ev1, ev2 });
82+ cl.DeleteEvents(new List<uint>(){eventidList[0]});
83+
84+ cl.RemoveMonitor("/org/gnome/zeitgeist/unittest");
85+ }
86+ }
87+}
88+
89
90=== added directory 'Zeitgeist.Testsuite/Datamodel'
91=== added file 'Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs'
92--- Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs 1970-01-01 00:00:00 +0000
93+++ Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs 2010-10-21 15:22:21 +0000
94@@ -0,0 +1,449 @@
95+using System;
96+using NUnit.Framework;
97+using Zeitgeist.Datamodel;
98+
99+namespace Zeitgeist.Testsuite
100+{
101+ [TestFixture()]
102+ public class TestInterpretation
103+ {
104+ #region Interpretation
105+
106+ [Test()]
107+ public void TestAlarm()
108+ {
109+ Assert.AreEqual(Interpretation.Instance.Alarm.Name, "Alarm");
110+ Assert.AreEqual(Interpretation.Instance.Alarm.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Alarm");
111+ }
112+
113+ [Test()]
114+ public void TestBookmark()
115+ {
116+ Assert.AreEqual(Interpretation.Instance.Bookmark.Name, "Bookmark");
117+ Assert.AreEqual(Interpretation.Instance.Bookmark.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark");
118+ }
119+
120+ [Test()]
121+ public void TestBookmarkFolder()
122+ {
123+ Assert.AreEqual(Interpretation.Instance.BookmarkFolder.Name, "BookmarkFolder");
124+ Assert.AreEqual(Interpretation.Instance.BookmarkFolder.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#BookmarkFolder");
125+ }
126+
127+ [Test()]
128+ public void TestCalendar()
129+ {
130+ Assert.AreEqual(Interpretation.Instance.Calendar.Name, "Calendar");
131+ Assert.AreEqual(Interpretation.Instance.Calendar.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Calendar");
132+ }
133+
134+ [Test()]
135+ public void TestEvent()
136+ {
137+ Assert.AreEqual(Interpretation.Instance.Event.Name, "Event");
138+ Assert.AreEqual(Interpretation.Instance.Event.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Event");
139+ }
140+
141+ [Test()]
142+ public void TestExecutable()
143+ {
144+ Assert.AreEqual(Interpretation.Instance.Executable.Name, "Executable");
145+ Assert.AreEqual(Interpretation.Instance.Executable.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Executable");
146+ }
147+
148+ [Test()]
149+ public void TestFont()
150+ {
151+ Assert.AreEqual(Interpretation.Instance.Font.Name, "Font");
152+ Assert.AreEqual(Interpretation.Instance.Font.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Font");
153+ }
154+
155+ [Test()]
156+ public void TestFreebusy()
157+ {
158+ Assert.AreEqual(Interpretation.Instance.Freebusy.Name, "Freebusy");
159+ Assert.AreEqual(Interpretation.Instance.Freebusy.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Freebusy");
160+ }
161+
162+ [Test()]
163+ public void TestJournal()
164+ {
165+ Assert.AreEqual(Interpretation.Instance.Journal.Name, "Journal");
166+ Assert.AreEqual(Interpretation.Instance.Journal.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Journal");
167+ }
168+
169+ [Test()]
170+ public void TestMailbox()
171+ {
172+ Assert.AreEqual(Interpretation.Instance.Mailbox.Name, "Mailbox");
173+ Assert.AreEqual(Interpretation.Instance.Mailbox.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Mailbox");
174+ }
175+
176+ [Test()]
177+ public void TestMimeEntity()
178+ {
179+ Assert.AreEqual(Interpretation.Instance.MimeEntity.Name, "MimeEntity");
180+ Assert.AreEqual(Interpretation.Instance.MimeEntity.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MimeEntity");
181+ }
182+
183+ [Test()]
184+ public void TestTimezone()
185+ {
186+ Assert.AreEqual(Interpretation.Instance.Timezone.Name, "Timezone");
187+ Assert.AreEqual(Interpretation.Instance.Timezone.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Timezone");
188+ }
189+
190+ [Test()]
191+ public void TestTodo()
192+ {
193+ Assert.AreEqual(Interpretation.Instance.Todo.Name, "Todo");
194+ Assert.AreEqual(Interpretation.Instance.Todo.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Todo");
195+ }
196+
197+ [Test()]
198+ public void TestTVSeries()
199+ {
200+ Assert.AreEqual(Interpretation.Instance.TVSeries.Name, "TVSeries");
201+ Assert.AreEqual(Interpretation.Instance.TVSeries.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVSeries");
202+ }
203+
204+ [Test()]
205+ public void TestWebsite()
206+ {
207+ Assert.AreEqual(Interpretation.Instance.Website.Name, "Website");
208+ Assert.AreEqual(Interpretation.Instance.Website.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Website");
209+ }
210+
211+ #endregion
212+
213+ #region DataContainer
214+
215+ [Test()]
216+ public void TestDataContainer()
217+ {
218+ Assert.AreEqual(Interpretation.Instance.DataContainer.DataContainer.Name, "DataContainer");
219+ Assert.AreEqual(Interpretation.Instance.DataContainer.DataContainer.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#DataContainer");
220+ }
221+
222+ [Test()]
223+ public void TestDataContainerArchive()
224+ {
225+ Assert.AreEqual(Interpretation.Instance.DataContainer.Archive.Name, "Archive");
226+ Assert.AreEqual(Interpretation.Instance.DataContainer.Archive.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Archive");
227+ }
228+
229+ [Test()]
230+ public void TestDataContainerFolder()
231+ {
232+ Assert.AreEqual(Interpretation.Instance.DataContainer.Folder.Name, "Folder");
233+ Assert.AreEqual(Interpretation.Instance.DataContainer.Folder.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Folder");
234+ }
235+
236+ [Test()]
237+ public void TestDataContainerTrash()
238+ {
239+ Assert.AreEqual(Interpretation.Instance.DataContainer.Trash.Name, "Trash");
240+ Assert.AreEqual(Interpretation.Instance.DataContainer.Trash.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Trash");
241+ }
242+
243+ #endregion
244+
245+ #region FileSystem
246+
247+ [Test()]
248+ public void TestDataContainerFilesystemImage()
249+ {
250+ Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.FilesystemImage.Name, "FilesystemImage");
251+ Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.FilesystemImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FilesystemImage");
252+ }
253+
254+ [Test()]
255+ public void TestDataContainerFilesystem()
256+ {
257+ Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.Filesystem.Name, "Filesystem");
258+ Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.Filesystem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Filesystem");
259+ }
260+
261+ #endregion
262+
263+ #region Document
264+
265+ [Test()]
266+ public void TestDocument()
267+ {
268+ Assert.AreEqual(Interpretation.Instance.Document.Document.Name, "Document");
269+ Assert.AreEqual(Interpretation.Instance.Document.Document.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document");
270+ }
271+
272+ [Test()]
273+ public void TestDocumentMindMap()
274+ {
275+ Assert.AreEqual(Interpretation.Instance.Document.MindMap.Name, "MindMap");
276+ Assert.AreEqual(Interpretation.Instance.Document.MindMap.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MindMap");
277+ }
278+
279+ [Test()]
280+ public void TestDocumentPresentation()
281+ {
282+ Assert.AreEqual(Interpretation.Instance.Document.Presentation.Name, "Presentation");
283+ Assert.AreEqual(Interpretation.Instance.Document.Presentation.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Presentation");
284+ }
285+
286+ [Test()]
287+ public void TestDocumentSpreadsheet()
288+ {
289+ Assert.AreEqual(Interpretation.Instance.Document.Spreadsheet.Name, "Spreadsheet");
290+ Assert.AreEqual(Interpretation.Instance.Document.Spreadsheet.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Spreadsheet");
291+ }
292+
293+ [Test()]
294+ public void TestDocumentTextDocument()
295+ {
296+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.TextDocument.Name, "TextDocument");
297+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.TextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument");
298+ }
299+
300+ [Test()]
301+ public void TestDocumentPaginatedTextDocument()
302+ {
303+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PaginatedTextDocument.Name, "PaginatedTextDocument");
304+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PaginatedTextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PaginatedTextDocument");
305+ }
306+
307+ [Test()]
308+ public void TestDocumentPlainTextDocument()
309+ {
310+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.PlainTextDocument.Name, "PlainTextDocument");
311+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.PlainTextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PlainTextDocument");
312+ }
313+
314+ [Test()]
315+ public void TestDocumentHtmlDocument()
316+ {
317+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.HtmlDocument.Name, "HtmlDocument");
318+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.HtmlDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#HtmlDocument");
319+ }
320+
321+ [Test()]
322+ public void TestDocumentSourceCode()
323+ {
324+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.SourceCode.Name, "SourceCode");
325+ Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.SourceCode.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SourceCode");
326+ }
327+
328+ #endregion
329+
330+ #region EventInterpretation
331+
332+ [Test()]
333+ public void TestEventInterpretation()
334+ {
335+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.EventInterpretation.Name, "EventInterpretation");
336+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.EventInterpretation.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#EventInterpretation");
337+ }
338+
339+ [Test()]
340+ public void TestAccessEvent()
341+ {
342+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.AccessEvent.Name, "AccessEvent");
343+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.AccessEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent");
344+ }
345+
346+ [Test()]
347+ public void TestCreateEvent()
348+ {
349+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.CreateEvent.Name, "CreateEvent");
350+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.CreateEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent");
351+ }
352+
353+ [Test()]
354+ public void TestDeleteEvent()
355+ {
356+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.DeleteEvent.Name, "DeleteEvent");
357+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.DeleteEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#DeleteEvent");
358+ }
359+
360+ [Test()]
361+ public void TestLeaveEvent()
362+ {
363+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.LeaveEvent.Name, "LeaveEvent");
364+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.LeaveEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#LeaveEvent");
365+ }
366+
367+ [Test()]
368+ public void TestModifyEvent()
369+ {
370+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.ModifyEvent.Name, "ModifyEvent");
371+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.ModifyEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ModifyEvent");
372+ }
373+
374+ [Test()]
375+ public void TestReceiveEvent()
376+ {
377+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.ReceiveEvent.Name, "ReceiveEvent");
378+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.ReceiveEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ReceiveEvent");
379+ }
380+
381+ [Test()]
382+ public void TestSendEvent()
383+ {
384+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.SendEvent.Name, "SendEvent");
385+ Assert.AreEqual(Interpretation.Instance.EventInterpretation.SendEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#SendEvent");
386+ }
387+
388+ #endregion
389+
390+ #region Media
391+
392+ [Test()]
393+ public void TestMedia()
394+ {
395+ Assert.AreEqual(Interpretation.Instance.Media.Media.Name, "Media");
396+ Assert.AreEqual(Interpretation.Instance.Media.Media.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Media");
397+ }
398+
399+ [Test()]
400+ public void TestAudio()
401+ {
402+ Assert.AreEqual(Interpretation.Instance.Media.Audio.Name, "Audio");
403+ Assert.AreEqual(Interpretation.Instance.Media.Audio.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio");
404+ }
405+
406+ [Test()]
407+ public void TestMusicPiece()
408+ {
409+ Assert.AreEqual(Interpretation.Instance.Media.MusicPiece.Name, "MusicPiece");
410+ Assert.AreEqual(Interpretation.Instance.Media.MusicPiece.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicPiece");
411+ }
412+
413+ [Test()]
414+ public void TestVisual()
415+ {
416+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Visual.Name, "Visual");
417+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Visual.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Visual");
418+ }
419+
420+ [Test()]
421+ public void TestImage()
422+ {
423+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Image.Name, "Image");
424+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Image.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Image");
425+ }
426+
427+ [Test()]
428+ public void TestIcon()
429+ {
430+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Icon.Name, "Icon");
431+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Icon.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Icon");
432+ }
433+
434+ [Test()]
435+ public void TestVectorImage()
436+ {
437+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.VectorImage.Name, "VectorImage");
438+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.VectorImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#VectorImage");
439+ }
440+
441+ [Test()]
442+ public void TestRasterImage()
443+ {
444+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.RasterImage.Name, "RasterImage");
445+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.RasterImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RasterImage");
446+ }
447+
448+ [Test()]
449+ public void TestCursor()
450+ {
451+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.Cursor.Name, "Cursor");
452+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.Cursor.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Cursor");
453+ }
454+
455+ [Test()]
456+ public void TestVideo()
457+ {
458+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Video.Name, "Video");
459+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Video.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Video");
460+ }
461+
462+ [Test()]
463+ public void TestMovie()
464+ {
465+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Movie.Name, "Movie");
466+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Movie.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#Movie");
467+ }
468+
469+ [Test()]
470+ public void TestTVShow()
471+ {
472+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.TVShow.Name, "TVShow");
473+ Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.TVShow.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVShow");
474+ }
475+
476+ [Test()]
477+ public void TestMediaList()
478+ {
479+ Assert.AreEqual(Interpretation.Instance.MediaList.MediaList.Name, "MediaList");
480+ Assert.AreEqual(Interpretation.Instance.MediaList.MediaList.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MediaList");
481+ }
482+
483+ [Test()]
484+ public void TestMusicAlbum()
485+ {
486+ Assert.AreEqual(Interpretation.Instance.MediaList.MusicAlbum.Name, "MusicAlbum");
487+ Assert.AreEqual(Interpretation.Instance.MediaList.MusicAlbum.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicAlbum");
488+ }
489+
490+ #endregion
491+
492+ #region MessageType
493+
494+ [Test()]
495+ public void TestMessage()
496+ {
497+ Assert.AreEqual(Interpretation.Instance.Message.Message.Name, "Message");
498+ Assert.AreEqual(Interpretation.Instance.Message.Message.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Message");
499+ }
500+
501+ [Test()]
502+ public void TestEmail()
503+ {
504+ Assert.AreEqual(Interpretation.Instance.Message.Email.Name, "Email");
505+ Assert.AreEqual(Interpretation.Instance.Message.Email.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email");
506+ }
507+
508+ [Test()]
509+ public void TestIMMessage()
510+ {
511+ Assert.AreEqual(Interpretation.Instance.Message.IMMessage.Name, "IMMessage");
512+ Assert.AreEqual(Interpretation.Instance.Message.IMMessage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#IMMessage");
513+ }
514+
515+ #endregion
516+
517+ #region SoftwareType
518+
519+ [Test()]
520+ public void TestSoftware()
521+ {
522+ Assert.AreEqual(Interpretation.Instance.Software.Software.Name, "Software");
523+ Assert.AreEqual(Interpretation.Instance.Software.Software.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Software");
524+ }
525+
526+ [Test()]
527+ public void TestApplication()
528+ {
529+ Assert.AreEqual(Interpretation.Instance.Software.Application.Name, "Application");
530+ Assert.AreEqual(Interpretation.Instance.Software.Application.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Application");
531+ }
532+
533+ [Test()]
534+ public void TestOperatingSystem()
535+ {
536+ Assert.AreEqual(Interpretation.Instance.Software.OperatingSystem.Name, "OperatingSystem");
537+ Assert.AreEqual(Interpretation.Instance.Software.OperatingSystem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#OperatingSystem");
538+ }
539+
540+ #endregion
541+ }
542+}
543+
544
545=== added file 'Zeitgeist.Testsuite/Datamodel/TestManifestation.cs'
546--- Zeitgeist.Testsuite/Datamodel/TestManifestation.cs 1970-01-01 00:00:00 +0000
547+++ Zeitgeist.Testsuite/Datamodel/TestManifestation.cs 2010-10-21 15:22:21 +0000
548@@ -0,0 +1,156 @@
549+using System;
550+using NUnit.Framework;
551+using Zeitgeist.Datamodel;
552+
553+namespace Zeitgeist.Testsuite
554+{
555+ [TestFixture()]
556+ public class TestManifestation
557+ {
558+ #region Manifestation
559+
560+ [Test()]
561+ public void TestCalendarDataObject()
562+ {
563+ Assert.AreEqual(Manifestation.Instance.CalendarDataObject.Name, "CalendarDataObject");
564+ Assert.AreEqual(Manifestation.Instance.CalendarDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#CalendarDataObject");
565+ }
566+
567+ [Test()]
568+ public void TestHardDiskPartition()
569+ {
570+ Assert.AreEqual(Manifestation.Instance.HardDiskPartition.Name, "HardDiskPartition");
571+ Assert.AreEqual(Manifestation.Instance.HardDiskPartition.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#HardDiskPartition");
572+ }
573+
574+ [Test()]
575+ public void TestMailboxDataObject()
576+ {
577+ Assert.AreEqual(Manifestation.Instance.MailboxDataObject.Name, "MailboxDataObject");
578+ Assert.AreEqual(Manifestation.Instance.MailboxDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MailboxDataObject");
579+ }
580+
581+ [Test()]
582+ public void TestMediaStream()
583+ {
584+ Assert.AreEqual(Manifestation.Instance.MediaStream.Name, "MediaStream");
585+ Assert.AreEqual(Manifestation.Instance.MediaStream.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MediaStream");
586+ }
587+
588+ [Test()]
589+ public void TestRemotePortAddress()
590+ {
591+ Assert.AreEqual(Manifestation.Instance.RemotePortAddress.Name, "RemotePortAddress");
592+ Assert.AreEqual(Manifestation.Instance.RemotePortAddress.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RemotePortAddress");
593+ }
594+
595+ [Test()]
596+ public void TestSoftwareItem()
597+ {
598+ Assert.AreEqual(Manifestation.Instance.SoftwareItem.Name, "SoftwareItem");
599+ Assert.AreEqual(Manifestation.Instance.SoftwareItem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SoftwareItem");
600+ }
601+
602+ [Test()]
603+ public void TestSoftwareService()
604+ {
605+ Assert.AreEqual(Manifestation.Instance.SoftwareService.Name, "SoftwareService");
606+ Assert.AreEqual(Manifestation.Instance.SoftwareService.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SoftwareService");
607+ }
608+
609+ #endregion
610+
611+ #region EventManifestation
612+
613+ [Test()]
614+ public void TestEventManifestation()
615+ {
616+ Assert.AreEqual(Manifestation.Instance.EventManifestation.EventManifestation.Name, "EventManifestation");
617+ Assert.AreEqual(Manifestation.Instance.EventManifestation.EventManifestation.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#EventManifestation");
618+ }
619+
620+ [Test()]
621+ public void TestHeuristicActivity()
622+ {
623+ Assert.AreEqual(Manifestation.Instance.EventManifestation.HeuristicActivity.Name, "HeuristicActivity");
624+ Assert.AreEqual(Manifestation.Instance.EventManifestation.HeuristicActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#HeuristicActivity");
625+ }
626+
627+ [Test()]
628+ public void TestScheduledActivity()
629+ {
630+ Assert.AreEqual(Manifestation.Instance.EventManifestation.ScheduledActivity.Name, "ScheduledActivity");
631+ Assert.AreEqual(Manifestation.Instance.EventManifestation.ScheduledActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ScheduledActivity");
632+ }
633+
634+ [Test()]
635+ public void TestSystemNotification()
636+ {
637+ Assert.AreEqual(Manifestation.Instance.EventManifestation.SystemNotification.Name, "SystemNotification");
638+ Assert.AreEqual(Manifestation.Instance.EventManifestation.SystemNotification.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#SystemNotification");
639+ }
640+
641+ [Test()]
642+ public void TestUserActivity()
643+ {
644+ Assert.AreEqual(Manifestation.Instance.EventManifestation.UserActivity.Name, "UserActivity");
645+ Assert.AreEqual(Manifestation.Instance.EventManifestation.UserActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity");
646+ }
647+
648+ [Test()]
649+ public void TestWorldActivity()
650+ {
651+ Assert.AreEqual(Manifestation.Instance.EventManifestation.WorldActivity.Name, "WorldActivity");
652+ Assert.AreEqual(Manifestation.Instance.EventManifestation.WorldActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#WorldActivity");
653+ }
654+
655+ #endregion
656+
657+ #region FileDataObject
658+
659+ [Test()]
660+ public void TestFileDataObject()
661+ {
662+ Assert.AreEqual(Manifestation.Instance.FileDataObject.FileDataObject.Name, "FileDataObject");
663+ Assert.AreEqual(Manifestation.Instance.FileDataObject.FileDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject");
664+ }
665+
666+ [Test()]
667+ public void TestDeletedResource()
668+ {
669+ Assert.AreEqual(Manifestation.Instance.FileDataObject.DeletedResource.Name, "DeletedResource");
670+ Assert.AreEqual(Manifestation.Instance.FileDataObject.DeletedResource.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#DeletedResource");
671+ }
672+
673+ [Test()]
674+ public void TestRemoteDataObject()
675+ {
676+ Assert.AreEqual(Manifestation.Instance.FileDataObject.RemoteDataObject.Name, "RemoteDataObject");
677+ Assert.AreEqual(Manifestation.Instance.FileDataObject.RemoteDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RemoteDataObject");
678+ }
679+
680+ [Test()]
681+ public void TestEmbeddedFileDataObject()
682+ {
683+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.EmbeddedFileDataObject.Name, "EmbeddedFileDataObject");
684+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.EmbeddedFileDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#EmbeddedFileDataObject");
685+ }
686+
687+ [Test()]
688+ public void TestArchiveItem()
689+ {
690+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.ArchiveItem.Name, "ArchiveItem");
691+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.ArchiveItem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#ArchiveItem");
692+ }
693+
694+ [Test()]
695+ public void TestAttachment()
696+ {
697+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.Attachment.Name, "Attachment");
698+ Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.Attachment.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Attachment");
699+ }
700+
701+ #endregion
702+ }
703+}
704+
705
706=== added directory 'Zeitgeist.Testsuite/Datasource'
707=== added directory 'Zeitgeist.Testsuite/Log'
708=== added file 'Zeitgeist.Testsuite/Log/TestDeleteEvents.cs'
709--- Zeitgeist.Testsuite/Log/TestDeleteEvents.cs 1970-01-01 00:00:00 +0000
710+++ Zeitgeist.Testsuite/Log/TestDeleteEvents.cs 2010-10-21 15:22:21 +0000
711@@ -0,0 +1,50 @@
712+using System;
713+using NUnit.Framework;
714+using Zeitgeist;
715+using Zeitgeist.Datamodel;
716+using System.Collections.Generic;
717+
718+namespace Zeitgeist.Testsuite
719+{
720+ [TestFixture()]
721+ public class TestDeleteEvents
722+ {
723+ [Test()]
724+ public void TestDeleteEventsPass()
725+ {
726+ Event ev1 = new Event();
727+ Subject sub11 = new Subject();
728+ Subject sub12 = new Subject();
729+ ev1.Subjects.Add(sub11);
730+ ev1.Subjects.Add(sub12);
731+
732+ Event ev2 = new Event();
733+ Subject sub21 = new Subject();
734+ Subject sub22 = new Subject();
735+ ev2.Subjects.Add(sub21);
736+ ev2.Subjects.Add(sub22);
737+
738+ LogClient client = new LogClient();
739+ List<uint> eventIds = client.InsertEvents(new List<Event>() { ev1, ev2 });
740+
741+ CollectionAssert.IsNotEmpty(eventIds);
742+ Assert.AreEqual(eventIds.Count, 2);
743+
744+ TimeRange range = client.DeleteEvents(eventIds);
745+
746+ Assert.IsNotNull(range.Begin);
747+ Assert.IsNotNull(range.End);
748+ }
749+
750+ [Test()]
751+ public void TestDeleteEventsFail()
752+ {
753+ LogClient client = new LogClient();
754+
755+ TimeRange range = client.DeleteEvents(new List<uint>(){ 3000 });
756+
757+ Assert.IsNull(range);
758+ }
759+ }
760+}
761+
762
763=== added file 'Zeitgeist.Testsuite/Log/TestFindEventIds.cs'
764--- Zeitgeist.Testsuite/Log/TestFindEventIds.cs 1970-01-01 00:00:00 +0000
765+++ Zeitgeist.Testsuite/Log/TestFindEventIds.cs 2010-10-21 15:22:21 +0000
766@@ -0,0 +1,36 @@
767+using System;
768+using NUnit.Framework;
769+using Zeitgeist;
770+using Zeitgeist.Datamodel;
771+using System.Collections.Generic;
772+
773+namespace Zeitgeist.Testsuite
774+{
775+ [TestFixture()]
776+ public class TestFindEventIds
777+ {
778+ [Test()]
779+ public void TestFindEventIdsPass()
780+ {
781+ TimeRange range = new TimeRange();
782+ range.Begin = DateTime.Now.AddDays(-30);
783+ range.End = DateTime.Now;
784+
785+ Event e = new Event();
786+ e.Actor = "application:///usr/share/applications/eog.desktop";
787+ Subject sub = new Subject();
788+ e.Subjects.Add(sub);
789+
790+ Event e2 = new Event();
791+ e2.Actor = "application://eog.desktop";
792+ Subject sub2 = new Subject();
793+ e2.Subjects.Add(sub2);
794+
795+ LogClient client = new LogClient();
796+ List<uint> eventIds = client.FindEventIds(range, new List<Event>(){e,e2}, StorageState.Any, 20, ResultType.MostRecentEvents);
797+
798+ CollectionAssert.IsNotEmpty(eventIds);
799+ }
800+ }
801+}
802+
803
804=== added file 'Zeitgeist.Testsuite/Log/TestFindEvents.cs'
805--- Zeitgeist.Testsuite/Log/TestFindEvents.cs 1970-01-01 00:00:00 +0000
806+++ Zeitgeist.Testsuite/Log/TestFindEvents.cs 2010-10-21 15:22:21 +0000
807@@ -0,0 +1,43 @@
808+using System;
809+using NUnit.Framework;
810+using Zeitgeist;
811+using Zeitgeist.Datamodel;
812+using System.Collections.Generic;
813+
814+namespace Zeitgeist.Testsuite
815+{
816+ [TestFixture()]
817+ public class TestFindEvents
818+ {
819+ [Test()]
820+ public void TestFindEventsPass()
821+ {
822+ TimeRange range = new TimeRange();
823+ range.Begin = DateTime.Now.AddDays(-30);
824+ range.End = DateTime.Now;
825+
826+ Event e = new Event();
827+ e.Actor = "application:///usr/share/applications/eog.desktop";
828+ Subject sub = new Subject();
829+ e.Subjects.Add(sub);
830+
831+ Event e2 = new Event();
832+ e2.Actor = "application://eog.desktop";
833+ Subject sub2 = new Subject();
834+ e2.Subjects.Add(sub2);
835+
836+ LogClient client = new LogClient();
837+ List<Event> events = client.FindEvents(range, new List<Event>(){e,e2}, StorageState.Any, 20, ResultType.MostRecentEvents);
838+
839+ CollectionAssert.IsNotEmpty(events);
840+
841+ foreach(Event ev in events)
842+ {
843+ Assert.Greater(ev.Id, 0);
844+ Assert.IsNotEmpty(ev.Actor);
845+ Assert.IsNotNull(ev.Interpretation);
846+ }
847+ }
848+ }
849+}
850+
851
852=== added file 'Zeitgeist.Testsuite/Log/TestGetEvents.cs'
853--- Zeitgeist.Testsuite/Log/TestGetEvents.cs 1970-01-01 00:00:00 +0000
854+++ Zeitgeist.Testsuite/Log/TestGetEvents.cs 2010-10-21 15:22:21 +0000
855@@ -0,0 +1,54 @@
856+using System;
857+using NUnit.Framework;
858+using Zeitgeist;
859+using Zeitgeist.Datamodel;
860+using System.Collections.Generic;
861+
862+namespace Zeitgeist.Testsuite
863+{
864+ [TestFixture()]
865+ public class TestGetEvents
866+ {
867+ [Test()]
868+ public void TestEventIds()
869+ {
870+ LogClient client = new LogClient();
871+
872+ List<uint> eventIdList = new List<uint>(){ 1, 2, 3 };
873+ List<Event> events = client.GetEvents(eventIdList);
874+
875+ Assert.IsNotNull(events);
876+
877+ foreach(Event ev in events)
878+ {
879+ Assert.IsNotNull(ev);
880+ Assert.IsNotNull(ev.Interpretation);
881+ Assert.IsNotNull(ev.Manifestation);
882+ Assert.IsNotEmpty(ev.Interpretation.Uri);
883+ Assert.IsNotEmpty(ev.Manifestation.Uri);
884+
885+ Assert.IsNotNull(ev.Timestamp);
886+
887+ Assert.IsNotNull(ev.Actor);
888+
889+ CollectionAssert.AllItemsAreNotNull(ev.Subjects);
890+ CollectionAssert.AllItemsAreUnique(ev.Subjects);
891+ }
892+ }
893+
894+ [Test()]
895+ public void TestNonExistingEventIds()
896+ {
897+ LogClient client = new LogClient();
898+
899+ List<uint> eventIdList = new List<uint>(){ 100000, 200000, 300000 };
900+ List<Event> events = client.GetEvents(eventIdList);
901+
902+ foreach(Event ev in events)
903+ {
904+ Assert.IsNull(ev);
905+ }
906+ }
907+ }
908+}
909+
910
911=== added file 'Zeitgeist.Testsuite/Log/TestInsertEvents.cs'
912--- Zeitgeist.Testsuite/Log/TestInsertEvents.cs 1970-01-01 00:00:00 +0000
913+++ Zeitgeist.Testsuite/Log/TestInsertEvents.cs 2010-10-21 15:22:21 +0000
914@@ -0,0 +1,38 @@
915+using System;
916+using NUnit.Framework;
917+using Zeitgeist;
918+using Zeitgeist.Datamodel;
919+using System.Collections.Generic;
920+
921+namespace Zeitgeist.Testsuite
922+{
923+ [TestFixture()]
924+ public class TestInsertEvents
925+ {
926+ [Test()]
927+ public void TestInsertEventsPass()
928+ {
929+ Event ev = new Event();
930+ ev.Interpretation = Interpretation.Instance.EventInterpretation.AccessEvent;
931+ ev.Manifestation = Manifestation.Instance.EventManifestation.UserActivity;
932+ ev.Actor = "application://tomboy.desktop";
933+
934+ Subject sub11 = new Subject();
935+ sub11.Uri = "/home/manish/.local/share/tomboy/bf7112c1-28dd-4079-b566-c135b19c4e01.note";
936+ sub11.Interpretation = Interpretation.Instance.EventInterpretation.AccessEvent;
937+ sub11.Manifestation = Manifestation.Instance.EventManifestation.UserActivity;
938+ sub11.Origin = "file:///home/manish/.local/share/tomboy/";
939+ sub11.MimeType = "text/x-note";
940+ sub11.Text = "Ubuntu One";
941+
942+ ev.Subjects.Add(sub11);
943+
944+ LogClient client = new LogClient();
945+ List<uint> eventIds = client.InsertEvents(new List<Event>() { ev });
946+
947+ Assert.IsNotNull(eventIds);
948+ CollectionAssert.IsNotEmpty(eventIds);
949+ }
950+ }
951+}
952+
953
954=== added file 'Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj'
955--- Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj 1970-01-01 00:00:00 +0000
956+++ Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj 2010-10-21 15:22:21 +0000
957@@ -0,0 +1,68 @@
958+<?xml version="1.0" encoding="utf-8"?>
959+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
960+ <PropertyGroup>
961+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
962+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
963+ <ProductVersion>8.0.50727</ProductVersion>
964+ <SchemaVersion>2.0</SchemaVersion>
965+ <ProjectGuid>{319E54B4-6715-4287-8E3C-88B7CDDA167A}</ProjectGuid>
966+ <OutputType>Library</OutputType>
967+ <RootNamespace>Zeitgeist.Testsuite</RootNamespace>
968+ <AssemblyName>Zeitgeist.Testsuite</AssemblyName>
969+ </PropertyGroup>
970+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
971+ <DebugSymbols>true</DebugSymbols>
972+ <DebugType>full</DebugType>
973+ <Optimize>false</Optimize>
974+ <OutputPath>bin\Debug</OutputPath>
975+ <DefineConstants>DEBUG</DefineConstants>
976+ <ErrorReport>prompt</ErrorReport>
977+ <WarningLevel>4</WarningLevel>
978+ <ConsolePause>false</ConsolePause>
979+ </PropertyGroup>
980+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
981+ <DebugType>none</DebugType>
982+ <Optimize>false</Optimize>
983+ <OutputPath>bin\Release</OutputPath>
984+ <ErrorReport>prompt</ErrorReport>
985+ <WarningLevel>4</WarningLevel>
986+ <ConsolePause>false</ConsolePause>
987+ </PropertyGroup>
988+ <ItemGroup>
989+ <Reference Include="System" />
990+ <Reference Include="nunit.core, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
991+ <Package>mono-nunit</Package>
992+ </Reference>
993+ <Reference Include="nunit.framework, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
994+ <Package>mono-nunit</Package>
995+ </Reference>
996+ </ItemGroup>
997+ <ItemGroup>
998+ <Compile Include="Datamodel\TestInterpretation.cs" />
999+ <Compile Include="Datamodel\TestManifestation.cs" />
1000+ <Compile Include="Log\TestGetEvents.cs" />
1001+ <Compile Include="Log\TestInsertEvents.cs" />
1002+ <Compile Include="Log\TestDeleteEvents.cs" />
1003+ <Compile Include="Log\TestFindEventIds.cs" />
1004+ <Compile Include="Log\TestFindEvents.cs" />
1005+ <Compile Include="Blacklist\TestMonitor.cs" />
1006+ </ItemGroup>
1007+ <ItemGroup>
1008+ <ProjectReference Include="..\Zeitgeist\Zeitgeist.csproj">
1009+ <Project>{A8352F1A-F10C-41E6-B6B0-655703358EF4}</Project>
1010+ <Name>Zeitgeist</Name>
1011+ </ProjectReference>
1012+ </ItemGroup>
1013+ <ItemGroup>
1014+ <Folder Include="Log\" />
1015+ <Folder Include="Blacklist\" />
1016+ <Folder Include="Datasource\" />
1017+ <Folder Include="Datamodel\" />
1018+ </ItemGroup>
1019+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1020+ <ProjectExtensions>
1021+ <MonoDevelop>
1022+ <Properties InternalTargetFrameworkVersion="3.5" />
1023+ </MonoDevelop>
1024+ </ProjectExtensions>
1025+</Project>
1026\ No newline at end of file
1027
1028=== modified file 'Zeitgeist.sln'
1029--- Zeitgeist.sln 2010-09-19 19:43:25 +0000
1030+++ Zeitgeist.sln 2010-10-21 15:22:21 +0000
1031@@ -3,12 +3,18 @@
1032 # Visual Studio 2005
1033 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zeitgeist", "Zeitgeist\Zeitgeist.csproj", "{A8352F1A-F10C-41E6-B6B0-655703358EF4}"
1034 EndProject
1035+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zeitgeist.Testsuite", "Zeitgeist.Testsuite\Zeitgeist.Testsuite.csproj", "{319E54B4-6715-4287-8E3C-88B7CDDA167A}"
1036+EndProject
1037 Global
1038 GlobalSection(SolutionConfigurationPlatforms) = preSolution
1039 Debug|x86 = Debug|x86
1040 Release|x86 = Release|x86
1041 EndGlobalSection
1042 GlobalSection(ProjectConfigurationPlatforms) = postSolution
1043+ {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Debug|x86.ActiveCfg = Debug|Any CPU
1044+ {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Debug|x86.Build.0 = Debug|Any CPU
1045+ {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Release|x86.ActiveCfg = Release|Any CPU
1046+ {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Release|x86.Build.0 = Release|Any CPU
1047 {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Debug|x86.ActiveCfg = Debug|Any CPU
1048 {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Debug|x86.Build.0 = Debug|Any CPU
1049 {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Release|x86.ActiveCfg = Release|Any CPU
1050
1051=== modified file 'Zeitgeist/Client/ILog.cs'
1052--- Zeitgeist/Client/ILog.cs 2010-10-01 16:29:35 +0000
1053+++ Zeitgeist/Client/ILog.cs 2010-10-21 15:22:21 +0000
1054@@ -59,7 +59,7 @@
1055 /// An array containing the IDs of all matching events, up to a maximum of num_events events.
1056 /// Sorted and grouped as defined by the result_type parameter. <see cref="T:System.UInt32[]"/>
1057 /// </returns>
1058- UInt32[] FindEventIds(TimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1059+ UInt32[] FindEventIds(RawTimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1060
1061 /// <summary>
1062 /// Get events matching a given set of templates.
1063@@ -87,7 +87,7 @@
1064 /// <returns>
1065 /// Full event data for all the requested IDs, up to a maximum of num_events events, sorted and grouped as defined by the result_type parameter. <see cref="T:Zeitgeist.Datamodel.RawEvent[]"/>
1066 /// </returns>
1067- RawEvent[] FindEvents(TimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1068+ RawEvent[] FindEvents(RawTimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1069
1070 /// <summary>
1071 /// Warning: This API is EXPERIMENTAL and is not fully supported yet.
1072@@ -115,7 +115,7 @@
1073 /// <returns>
1074 /// A list of URIs matching the described criteria <see cref="T:System.String[]"/>
1075 /// </returns>
1076- string[] FindRelatedUris(TimeRange range, RawEvent[] eventTemplates, RawEvent[] resultEventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1077+ string[] FindRelatedUris(RawTimeRange range, RawEvent[] eventTemplates, RawEvent[] resultEventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType);
1078
1079 /// <summary>
1080 /// Inserts events into the log. Returns an array containing the IDs of the inserted events
1081@@ -144,7 +144,7 @@
1082 /// <param name="eventTemplates">
1083 /// RawEvent templates that events must match in order to trigger the monitor <see cref="T:Zeitgeist.Datamodel.RawEvent[]"/>
1084 /// </param>
1085- void InstallMonitor(ObjectPath monitorPath, TimeRange range, RawEvent[] eventTemplates);
1086+ void InstallMonitor(ObjectPath monitorPath, RawTimeRange range, RawEvent[] eventTemplates);
1087
1088 /// <summary>
1089 /// Remove a monitor installed with InstallMonitor()
1090@@ -161,9 +161,9 @@
1091 /// The eventId of the Events to be deleted <see cref="T:System.UInt32[]"/>
1092 /// </param>
1093 /// <returns>
1094- /// The TimeRange <see cref="T:Zeitgeist.Datamodel.TimeRange"/>
1095+ /// The TimeRange <see cref="T:Zeitgeist.Datamodel.RawTimeRange"/>
1096 /// </returns>
1097- TimeRange DeleteEvents(UInt32[] eventIds);
1098+ RawTimeRange DeleteEvents(UInt32[] eventIds);
1099
1100 /// <summary>
1101 /// Delete the log file and all its content
1102
1103=== added file 'Zeitgeist/Datamodel/Delegates.cs'
1104--- Zeitgeist/Datamodel/Delegates.cs 1970-01-01 00:00:00 +0000
1105+++ Zeitgeist/Datamodel/Delegates.cs 2010-10-21 15:22:21 +0000
1106@@ -0,0 +1,10 @@
1107+using System;
1108+using System.Collections.Generic;
1109+
1110+namespace Zeitgeist.Datamodel
1111+{
1112+ public delegate void NotifyInsertHandler(TimeRange range, List<Event> events);
1113+
1114+ public delegate void NotifyDeleteHandler(TimeRange range, List<UInt32> eventIds);
1115+}
1116+
1117
1118=== modified file 'Zeitgeist/Datamodel/Event.cs'
1119--- Zeitgeist/Datamodel/Event.cs 2010-10-02 05:20:40 +0000
1120+++ Zeitgeist/Datamodel/Event.cs 2010-10-21 15:22:21 +0000
1121@@ -21,6 +21,10 @@
1122 {
1123 Subjects = new List<Subject>();
1124 Payload =new byte[]{};
1125+ Actor = string.Empty;
1126+ Timestamp = ZsUtils.Epoch;
1127+ Interpretation = new NameUri();
1128+ Manifestation = new NameUri();
1129 }
1130
1131 /// <summary>
1132@@ -97,7 +101,7 @@
1133 /// <summary>
1134 /// The Raw form of Event. Get Event.FromRaw to create an Event from a RawEvent
1135 /// </summary>
1136- internal struct RawEvent
1137+ internal class RawEvent
1138 {
1139 /// <summary>
1140 /// The event Metadata
1141@@ -143,6 +147,11 @@
1142 _payload = value;
1143 }
1144 }
1145+ /// <summary>
1146+ /// The default constructor of RawEvent
1147+ /// </summary>
1148+ public RawEvent()
1149+ {}
1150
1151 /// <summary>
1152 /// A parameterized constructor for creating a RawEvent
1153@@ -186,13 +195,9 @@
1154 for(int i=0; i< metaDataList.Capacity; i++)
1155 metaDataList.Add(null);
1156
1157- if(ev.Id == 0)
1158- metaDataList[(int)EventMetadataPosition.Id] = string.Empty;
1159- else
1160- metaDataList[(int)EventMetadataPosition.Id] = ev.Id.ToString();
1161-
1162-
1163- metaDataList[(int)EventMetadataPosition.Timestamp] = ZsUtils.ToTimestamp(ev.Timestamp).ToString();
1164+ metaDataList[(int)EventMetadataPosition.Id] = (ev.Id == 0)? string.Empty: ev.Id.ToString();
1165+ metaDataList[(int)EventMetadataPosition.Timestamp] = (ev.Id == 0)? string.Empty: ZsUtils.ToTimestamp(ev.Timestamp).ToString();
1166+
1167 metaDataList[(int)EventMetadataPosition.Actor] = ev.Actor;
1168 metaDataList[(int)EventMetadataPosition.Interpretation] = ev.Interpretation.Uri;
1169 metaDataList[(int)EventMetadataPosition.Manifestation] = ev.Manifestation.Uri;
1170@@ -311,9 +316,9 @@
1171
1172 #region RawEvent Private Fields
1173
1174- private string[] _metadata;
1175- private string[][] _subjects;
1176- private byte[] _payload;
1177+ public string[] _metadata;
1178+ public string[][] _subjects;
1179+ public byte[] _payload;
1180
1181 #endregion
1182 }
1183
1184=== modified file 'Zeitgeist/Datamodel/Interpretation.cs'
1185--- Zeitgeist/Datamodel/Interpretation.cs 2010-10-02 05:20:40 +0000
1186+++ Zeitgeist/Datamodel/Interpretation.cs 2010-10-21 15:22:21 +0000
1187@@ -393,34 +393,34 @@
1188 return _website;
1189
1190 NameUri datacont = _data_container.Search(interpretation);
1191- if(datacont.Name != null)
1192+ if(datacont != null)
1193 return datacont;
1194
1195 NameUri doc = _document.Search(interpretation);
1196- if(doc.Name != null)
1197+ if(doc != null)
1198 return doc;
1199
1200 NameUri evnt_int = _event_interpretation.Search(interpretation);
1201- if(evnt_int.Name != null)
1202+ if(evnt_int != null)
1203 return evnt_int;
1204
1205 NameUri media = _media.Search(interpretation);
1206- if(media.Name != null)
1207+ if(media != null)
1208 return media;
1209
1210 NameUri media_lst = _media_list.Search(interpretation);
1211- if(media_lst.Name != null)
1212+ if(media_lst != null)
1213 return media_lst;
1214
1215 NameUri msg = _message.Search(interpretation);
1216- if(msg.Name != null)
1217+ if(msg != null)
1218 return msg;
1219
1220 NameUri sw = _software.Search(interpretation);
1221- if(sw.Name != null)
1222+ if(sw != null)
1223 return sw;
1224
1225- return new NameUri();
1226+ return new NameUri(ZsUtils.GetStringAnchor(interpretation), interpretation);
1227 }
1228
1229 #region Private Fields
1230@@ -563,10 +563,10 @@
1231 return _trash;
1232
1233 NameUri fs = _filesystem.Search(interpretation);
1234- if(fs.Name != null)
1235+ if(fs != null)
1236 return fs;
1237
1238- return new NameUri();
1239+ return null;
1240 }
1241
1242 #region Private Fields
1243@@ -622,7 +622,7 @@
1244 if(string.Equals(_file_system.Uri, interpretation))
1245 return _file_system;
1246
1247- return new NameUri();
1248+ return null;
1249 }
1250
1251 #region Private Fields
1252@@ -725,10 +725,10 @@
1253 return _spreadsheet;
1254
1255 NameUri textdoc = _text_document.Search(interpretation);
1256- if(textdoc.Name != null)
1257+ if(textdoc != null)
1258 return textdoc;
1259
1260- return new NameUri();
1261+ return null;
1262 }
1263
1264 #region Private Fields
1265@@ -749,6 +749,20 @@
1266 public class TextDocumentType
1267 {
1268 /// <summary>
1269+ /// A text document. (Display name: 'TextDocument')
1270+ /// </summary>
1271+ /// <remarks>
1272+ /// http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument
1273+ /// </remarks>
1274+ public NameUri TextDocument
1275+ {
1276+ get
1277+ {
1278+ return _text_document;
1279+ }
1280+ }
1281+
1282+ /// <summary>
1283 /// A file containing a text document, that is unambiguously divided into pages. Examples might include PDF, DOC, PS, DVI etc. (Display name: 'PaginatedTextDocument')
1284 /// </summary>
1285 /// <remarks>
1286@@ -783,15 +797,17 @@
1287 return _paginated_text_document;
1288
1289 NameUri plaintext = _plain_text_document.Search(interpretation);
1290- if(plaintext.Name != null)
1291+ if(plaintext != null)
1292 return plaintext;
1293
1294- return new NameUri();
1295+ return null;
1296 }
1297
1298 #region Private Fields
1299
1300- private NameUri _paginated_text_document = new NameUri("Spreadsheet", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Spreadsheet");
1301+ private NameUri _text_document = new NameUri("TextDocument", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument");
1302+
1303+ private NameUri _paginated_text_document = new NameUri("PaginatedTextDocument", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PaginatedTextDocument");
1304
1305 private PlainTextDocumentType _plain_text_document = new PlainTextDocumentType();
1306
1307@@ -853,7 +869,7 @@
1308 if(string.Equals(_source_code.Uri, interpretation))
1309 return _source_code;
1310
1311- return new NameUri();
1312+ return null;
1313 }
1314
1315 #region Private Fields
1316@@ -1012,7 +1028,7 @@
1317 return _send_event;
1318
1319
1320- return new NameUri();
1321+ return null;
1322 }
1323
1324 #region Private Fields
1325@@ -1110,10 +1126,10 @@
1326 return _music_piece;
1327
1328 NameUri visual = _visual_type.Search(interpretation);
1329- if(visual.Name != null)
1330+ if(visual != null)
1331 return visual;
1332
1333- return new NameUri();
1334+ return null;
1335 }
1336
1337 #region Private Fields
1338@@ -1179,14 +1195,14 @@
1339 return _visual;
1340
1341 NameUri image = _image.Search(interpretation);
1342- if(image.Name != null)
1343+ if(image != null)
1344 return image;
1345
1346 NameUri video = _video.Search(interpretation);
1347- if(video.Name != null)
1348+ if(video != null)
1349 return video;
1350
1351- return new NameUri();
1352+ return null;
1353 }
1354
1355 #region Private Fields
1356@@ -1267,13 +1283,13 @@
1357 return _icon;
1358
1359 NameUri rast = _raster_image.Search(interpretation);
1360- if(rast.Name != null)
1361+ if(rast != null)
1362 return rast;
1363
1364 if(string.Equals(_vector_image.Uri, interpretation))
1365 return _vector_image;
1366
1367- return new NameUri();
1368+ return null;
1369 }
1370
1371 #region Private Fields
1372@@ -1328,7 +1344,7 @@
1373 if(string.Equals(_cursor.Uri, interpretation))
1374 return _cursor;
1375
1376- return new NameUri();
1377+ return null;
1378 }
1379
1380 #region Private Fields
1381@@ -1395,7 +1411,7 @@
1382 if(string.Equals(_tv_show.Uri, interpretation))
1383 return _tv_show;
1384
1385- return new NameUri();
1386+ return null;
1387 }
1388
1389 #region Private Fields
1390@@ -1451,7 +1467,7 @@
1391 if(string.Equals(_music_album.Uri, interpretation))
1392 return _music_album;
1393
1394- return new NameUri();
1395+ return null;
1396 }
1397
1398 #region Private Fields
1399@@ -1522,7 +1538,7 @@
1400 if(string.Equals(_im_message.Uri, interpretation))
1401 return _im_message;
1402
1403- return new NameUri();
1404+ return null;
1405 }
1406
1407 #region Private Fields
1408@@ -1595,7 +1611,7 @@
1409 if(string.Equals(_os.Uri, interpretation))
1410 return _os;
1411
1412- return new NameUri();
1413+ return null;
1414 }
1415
1416 #region Private Fields
1417
1418=== modified file 'Zeitgeist/Datamodel/Manifestation.cs'
1419--- Zeitgeist/Datamodel/Manifestation.cs 2010-10-02 05:20:40 +0000
1420+++ Zeitgeist/Datamodel/Manifestation.cs 2010-10-21 15:22:21 +0000
1421@@ -157,11 +157,11 @@
1422 return _cal_data_obj;
1423
1424 NameUri event_manifestation = _event_manifestation.Search(manifestation);
1425- if(event_manifestation.Name != null)
1426+ if(event_manifestation != null)
1427 return event_manifestation;
1428
1429 NameUri file_data_obj = _file_data_obj.Search(manifestation);
1430- if(file_data_obj.Name != null)
1431+ if(file_data_obj != null)
1432 return file_data_obj;
1433
1434 if(string.Equals(_hd_partition.Uri, manifestation))
1435@@ -182,7 +182,7 @@
1436 if(string.Equals(_sw_service.Uri, manifestation))
1437 return _sw_service;
1438
1439- return new NameUri();
1440+ return new NameUri(ZsUtils.GetStringAnchor(manifestation), manifestation);
1441 }
1442
1443 #region Private Fields
1444@@ -316,7 +316,7 @@
1445 if(string.Equals(_world_activity.Uri, manifestation))
1446 return _world_activity;
1447
1448- return new NameUri();
1449+ return null;
1450 }
1451
1452 #region Private Fields
1453@@ -403,13 +403,13 @@
1454 return _deleted_resc;
1455
1456 NameUri embedded_file_data_obj = _embedded_file_data_obj.Search(manifestation);
1457- if(embedded_file_data_obj.Name != null)
1458+ if(embedded_file_data_obj != null)
1459 return embedded_file_data_obj;
1460
1461 if(string.Equals(_remote_data_obj.Uri, manifestation))
1462 return _remote_data_obj;
1463
1464- return new NameUri();
1465+ return null;
1466 }
1467
1468 #region Private Fields
1469@@ -480,7 +480,7 @@
1470 if(string.Equals(_attachment.Uri, manifestation))
1471 return _attachment;
1472
1473- return new NameUri();
1474+ return null;
1475 }
1476
1477 #region Private Fields
1478
1479=== added file 'Zeitgeist/Datamodel/Monitor.cs'
1480--- Zeitgeist/Datamodel/Monitor.cs 1970-01-01 00:00:00 +0000
1481+++ Zeitgeist/Datamodel/Monitor.cs 2010-10-21 15:22:21 +0000
1482@@ -0,0 +1,103 @@
1483+using System;
1484+using System.Collections.Generic;
1485+using NDesk.DBus;
1486+using GLib;
1487+using System.Threading;
1488+using System.ComponentModel;
1489+
1490+namespace Zeitgeist.Datamodel
1491+{
1492+ [Interface("org.gnome.zeitgeist.Monitor")]
1493+ internal interface IMonitor
1494+ {
1495+ void NotifyInsert(long[] range, RawEvent[] events);
1496+
1497+ void NotifyDelete(long[] range, UInt32[] evendIds);
1498+ }
1499+
1500+ internal class RawMonitor : IMonitor
1501+ {
1502+ public RawMonitor(string monitorPath)
1503+ {
1504+ ObjectPath objPath = new ObjectPath (monitorPath);
1505+ Bus.Session.Register (objPath, this);
1506+
1507+ loop = new MainLoop();
1508+ worker = new BackgroundWorker();
1509+
1510+ worker.DoWork += delegate(object sender, DoWorkEventArgs e) {
1511+ loop.Run();
1512+ };
1513+
1514+ worker.RunWorkerAsync();
1515+ }
1516+
1517+ public void NotifyInsert(long[] range, RawEvent[] events)
1518+ {
1519+ List<Event> eventList = ZsUtils.FromRawEventList(events);
1520+
1521+ if(Inserted != null)
1522+ Inserted(new TimeRange(range[0], range[1]), eventList);
1523+ }
1524+
1525+ public void NotifyDelete(long[] range, UInt32[] evendIds)
1526+ {
1527+ List<UInt32> eventIdList = new List<UInt32>(evendIds);
1528+
1529+ if(Deleted != null)
1530+ Deleted(new TimeRange(range[0], range[1]), eventIdList);
1531+ }
1532+
1533+ public event NotifyInsertHandler Inserted;
1534+
1535+ public event NotifyDeleteHandler Deleted;
1536+
1537+ private BackgroundWorker worker;
1538+
1539+ private MainLoop loop;
1540+ }
1541+
1542+ /// <summary>
1543+ /// DBus interface for monitoring the Zeitgeist log for certain types of events.
1544+ /// When using the Python bindings monitors are normally instantiated indirectly by calling ZeitgeistClient.install_monitor
1545+ /// </summary>
1546+ /// <remarks>
1547+ /// It is important to understand that the Monitor instance lives on the client side, and expose a
1548+ /// DBus service there, and the Zeitgeist engine calls back to the monitor when matching events are registered.
1549+ /// </remarks>
1550+ public class Monitor
1551+ {
1552+ /// <summary>
1553+ /// Create a new instance of Monitor which can be used for notifying the client that some event has been
1554+ /// inserted or deleted which matches the event template
1555+ /// </summary>
1556+ /// <param name="monitorPath">
1557+ /// The DBus path over which the bus is activated <see cref="System.String"/>
1558+ /// </param>
1559+ public Monitor(string monitorPath)
1560+ {
1561+ _monitor = new RawMonitor( monitorPath);
1562+
1563+ _monitor.Inserted += delegate(TimeRange event_range, List<Event> events) {
1564+ if(Inserted != null)
1565+ Inserted(event_range, events);
1566+ };
1567+ _monitor.Deleted += delegate(TimeRange event_range, List<uint> eventIds) {
1568+ if(Deleted != null)
1569+ Deleted(event_range, eventIds);
1570+ };
1571+ }
1572+
1573+ /// <summary>
1574+ /// The event which is fired in the case of an event is inserted which matches the Event Templates
1575+ /// </summary>
1576+ public event NotifyInsertHandler Inserted;
1577+
1578+ /// <summary>
1579+ /// The event which is fired in the case of an event is deleted which matches the Event Templates
1580+ /// </summary>
1581+ public event NotifyDeleteHandler Deleted;
1582+
1583+ private RawMonitor _monitor;
1584+ }
1585+}
1586\ No newline at end of file
1587
1588=== modified file 'Zeitgeist/Datamodel/NameUri.cs'
1589--- Zeitgeist/Datamodel/NameUri.cs 2010-10-02 05:20:40 +0000
1590+++ Zeitgeist/Datamodel/NameUri.cs 2010-10-21 15:22:21 +0000
1591@@ -12,6 +12,8 @@
1592 {
1593 public NameUri()
1594 {
1595+ Name = string.Empty;
1596+ Uri = string.Empty;
1597 }
1598
1599 public NameUri(string name, string uri)
1600
1601=== modified file 'Zeitgeist/Datamodel/Subject.cs'
1602--- Zeitgeist/Datamodel/Subject.cs 2010-10-02 05:20:40 +0000
1603+++ Zeitgeist/Datamodel/Subject.cs 2010-10-21 15:22:21 +0000
1604@@ -6,8 +6,19 @@
1605 /// <summary>
1606 /// Represents a subject of an Event
1607 /// </summary>
1608- public struct Subject
1609+ public class Subject
1610 {
1611+ public Subject()
1612+ {
1613+ Uri = string.Empty;
1614+ Origin = string.Empty;
1615+ MimeType = string.Empty;
1616+ Text = string.Empty;
1617+ Storage = string.Empty;
1618+ Interpretation = new NameUri();
1619+ Manifestation = new NameUri();
1620+ }
1621+
1622 /// <summary>
1623 /// URI of the subject
1624 /// </summary>
1625
1626=== modified file 'Zeitgeist/Datamodel/TimeRange.cs'
1627--- Zeitgeist/Datamodel/TimeRange.cs 2010-10-01 18:15:46 +0000
1628+++ Zeitgeist/Datamodel/TimeRange.cs 2010-10-21 15:22:21 +0000
1629@@ -5,40 +5,69 @@
1630 /// <summary>
1631 /// The type which deals with Start and End time for an event.
1632 /// </summary>
1633- public struct TimeRange
1634+ public class TimeRange
1635 {
1636+ public TimeRange()
1637+ {
1638+ }
1639+
1640+ /// <summary>
1641+ /// Create a TimeRange instance from the start and end values given as milliseconds since Epoch
1642+ /// </summary>
1643+ /// <param name="startTime">
1644+ /// The start time. The millseconds since Epoch <see cref="Int64"/>
1645+ /// </param>
1646+ /// <param name="endTime">
1647+ /// The end time. The millseconds since Epoch <see cref="Int64"/>
1648+ /// </param>
1649+ public TimeRange(Int64 startTime, Int64 endTime)
1650+ {
1651+ _begin = ZsUtils.ToDateTime((ulong)startTime);
1652+ _end = ZsUtils.ToDateTime((ulong)endTime);
1653+ }
1654+
1655+ /// <summary>
1656+ /// Create an instance of TimeRange from the values provided as per CLR DateTime instance representation
1657+ /// </summary>
1658+ /// <param name="startTime">
1659+ /// The start time <see cref="DateTime"/>
1660+ /// </param>
1661+ /// <param name="endTime">
1662+ /// The end time <see cref="DateTime"/>
1663+ /// </param>
1664 public TimeRange(DateTime startTime, DateTime endTime)
1665 {
1666 _begin = startTime;
1667 _end = endTime;
1668 }
1669+
1670 /// <summary>
1671 /// The begin Timestamp of the event. Seconds elapsed since Epoch
1672 /// </summary>
1673- public Int64 Begin
1674+ public DateTime Begin
1675 {
1676 get
1677 {
1678- return (Int64)ZsUtils.ToTimestamp(_begin);
1679+ return _begin;
1680 }
1681 set
1682 {
1683- _begin = ZsUtils.ToDateTime((ulong)value);
1684+ _begin = value;
1685 }
1686 }
1687
1688 /// <summary>
1689 /// The end Timestamp of the event. Seconds elapsed since Epoch
1690 /// </summary>
1691- public Int64 End
1692+ public DateTime End
1693 {
1694 get
1695 {
1696- return (Int64)ZsUtils.ToTimestamp(_end);
1697+ return _end;
1698 }
1699 set
1700 {
1701- _end = ZsUtils.ToDateTime((ulong)value);
1702+ _end = value;
1703 }
1704 }
1705
1706@@ -50,5 +79,40 @@
1707
1708 #endregion
1709 }
1710+
1711+ internal class RawTimeRange
1712+ {
1713+ public Int64 Begin
1714+ {
1715+ get
1716+ {
1717+ return _begin;
1718+ }
1719+ set
1720+ {
1721+ _begin = value;
1722+ }
1723+ }
1724+
1725+ public Int64 End
1726+ {
1727+ get
1728+ {
1729+ return _end;
1730+ }
1731+ set
1732+ {
1733+ _end = value;
1734+ }
1735+ }
1736+
1737+ #region Private Fields
1738+
1739+ public Int64 _begin;
1740+
1741+ public Int64 _end;
1742+
1743+ #endregion
1744+ }
1745 }
1746
1747
1748=== modified file 'Zeitgeist/LogClient.cs'
1749--- Zeitgeist/LogClient.cs 2010-09-10 22:14:30 +0000
1750+++ Zeitgeist/LogClient.cs 2010-10-21 15:22:21 +0000
1751@@ -73,6 +73,7 @@
1752
1753 /// <summary>
1754 /// Delete a set of events from the log given their IDs
1755+ /// If all the Event ID provided does not exist, then null is returned
1756 /// </summary>
1757 /// <param name="eventIds">
1758 /// The eventId (of type <see cref="T:System.Collection.Generic.List{System.UInt32}"/> ) of the Events to be deleted
1759@@ -82,7 +83,12 @@
1760 /// </returns>
1761 public TimeRange DeleteEvents(List<uint> eventIds)
1762 {
1763- return srcInterface.DeleteEvents(eventIds.ToArray());
1764+ RawTimeRange rawRange = srcInterface.DeleteEvents(eventIds.ToArray());
1765+
1766+ if(rawRange.Begin < 0 && rawRange.End < 0)
1767+ return null;
1768+ else
1769+ return new TimeRange(rawRange.Begin, rawRange.End);
1770 }
1771
1772 #endregion
1773@@ -127,7 +133,11 @@
1774 {
1775 RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(eventTemplates).ToArray();
1776
1777- UInt32[] eventIds = srcInterface.FindEventIds(range, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1778+ RawTimeRange rawRange = new RawTimeRange();
1779+ rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin);
1780+ rawRange.End = (long)ZsUtils.ToTimestamp(range.End);
1781+
1782+ UInt32[] eventIds = srcInterface.FindEventIds(rawRange, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1783
1784 return new List<uint>(eventIds);
1785 }
1786@@ -164,7 +174,11 @@
1787 {
1788 RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(eventTemplates).ToArray();
1789
1790- RawEvent[] events = srcInterface.FindEvents(range, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1791+ RawTimeRange rawRange = new RawTimeRange();
1792+ rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin);
1793+ rawRange.End = (long)ZsUtils.ToTimestamp(range.End);
1794+
1795+ RawEvent[] events = srcInterface.FindEvents(rawRange, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1796
1797 return ZsUtils.FromRawEventList(events);
1798 }
1799@@ -202,7 +216,11 @@
1800 RawEvent[] rawEvents = ZsUtils.ToRawEventList(eventTemplates).ToArray();
1801 RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(resultEventTemplates).ToArray();
1802
1803- string[] uris = srcInterface.FindRelatedUris(range, rawEvents, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1804+ RawTimeRange rawRange = new RawTimeRange();
1805+ rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin);
1806+ rawRange.End = (long)ZsUtils.ToTimestamp(range.End);
1807+
1808+ string[] uris = srcInterface.FindRelatedUris(rawRange, rawEvents, rawEventTemplates, (uint)state, maxEvents, (uint) resType);
1809
1810 return new List<string>(uris);
1811 }
1812@@ -224,11 +242,16 @@
1813 /// Event templates <see cref="T:System.Collection.Generic.List{Zeitgeist.Datamodel.Event}"/> that events must match in order to trigger the monitor
1814 /// </param>
1815 public void InstallMonitor(string monitorPath, TimeRange range, List<Event> eventTemplates)
1816- { srcInterface = ZsUtils.GetDBusObject<ILog>(objectPath);
1817+ {
1818+ srcInterface = ZsUtils.GetDBusObject<ILog>(objectPath);
1819+
1820+ RawTimeRange rawRange = new RawTimeRange();
1821+ rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin);
1822+ rawRange.End = (long)ZsUtils.ToTimestamp(range.End);
1823
1824 ObjectPath path = new ObjectPath(monitorPath);
1825 List<RawEvent> rawEvents = ZsUtils.ToRawEventList(eventTemplates);
1826- srcInterface.InstallMonitor(path, range, rawEvents.ToArray());
1827+ srcInterface.InstallMonitor(path, rawRange, rawEvents.ToArray());
1828 }
1829
1830 /// <summary>
1831
1832=== modified file 'Zeitgeist/Zeitgeist.csproj'
1833--- Zeitgeist/Zeitgeist.csproj 2010-10-05 21:28:08 +0000
1834+++ Zeitgeist/Zeitgeist.csproj 2010-10-21 15:22:21 +0000
1835@@ -39,9 +39,11 @@
1836 <Reference Include="NDesk.DBus.GLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099">
1837 <Package>ndesk-dbus-glib-1.0</Package>
1838 </Reference>
1839+ <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
1840+ <Package>glib-sharp-2.0</Package>
1841+ </Reference>
1842 </ItemGroup>
1843 <ItemGroup>
1844- <Compile Include="AssemblyInfo.cs" />
1845 <Compile Include="Datamodel\Event.cs" />
1846 <Compile Include="Datamodel\Subject.cs" />
1847 <Compile Include="Datamodel\ResultType.cs" />
1848@@ -59,6 +61,8 @@
1849 <Compile Include="Datamodel\Interpretation.cs" />
1850 <Compile Include="Datamodel\Manifestation.cs" />
1851 <Compile Include="Datamodel\NameUri.cs" />
1852+ <Compile Include="Datamodel\Monitor.cs" />
1853+ <Compile Include="Datamodel\Delegates.cs" />
1854 </ItemGroup>
1855 <ItemGroup>
1856 <Folder Include="Datamodel\" />
1857
1858=== modified file 'Zeitgeist/ZsUtils.cs'
1859--- Zeitgeist/ZsUtils.cs 2010-10-02 05:20:40 +0000
1860+++ Zeitgeist/ZsUtils.cs 2010-10-21 15:22:21 +0000
1861@@ -190,8 +190,17 @@
1862
1863 return interfaceInst;
1864 }
1865+
1866+ public static string GetStringAnchor(string str)
1867+ {
1868+ if(str != null)
1869+ {
1870+ int pos = str.IndexOf('#');
1871+ return str.Substring(pos+1);
1872+ }
1873+ else
1874+ return null;
1875+ }
1876 }
1877-
1878-
1879 }
1880
1881
1882=== modified file 'configure.ac'
1883--- configure.ac 2010-10-05 21:28:08 +0000
1884+++ configure.ac 2010-10-21 15:22:21 +0000
1885@@ -43,6 +43,7 @@
1886 dnl package checks, common for all configs
1887 PKG_CHECK_MODULES([NDESK_DBUS_10], [ndesk-dbus-1.0])
1888 PKG_CHECK_MODULES([NDESK_DBUS_GLIB_10], [ndesk-dbus-glib-1.0])
1889+PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0])
1890
1891 AC_CONFIG_FILES([
1892 Zeitgeist/zeitgeist-sharp.pc

Subscribers

People subscribed via source and target branches