Merge lp:~manishsinha/zeitgeist-sharp/testsuite into lp:~zeitgeist-sharp/zeitgeist-sharp/trunk
- testsuite
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Manish Sinha (मनीष सिन्हा) |
Proposed branch: | lp:~manishsinha/zeitgeist-sharp/testsuite |
Merge into: | lp:~zeitgeist-sharp/zeitgeist-sharp/trunk |
Diff against target: |
1632 lines (+1078/-75) 19 files modified
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 (+67/-0) Zeitgeist.sln (+6/-0) Zeitgeist/Client/ILog.cs (+6/-6) Zeitgeist/Datamodel/Event.cs (+16/-11) Zeitgeist/Datamodel/Interpretation.cs (+46/-30) Zeitgeist/Datamodel/Manifestation.cs (+7/-7) Zeitgeist/Datamodel/NameUri.cs (+2/-0) Zeitgeist/Datamodel/Subject.cs (+12/-1) Zeitgeist/Datamodel/TimeRange.cs (+50/-11) Zeitgeist/LogClient.cs (+29/-6) Zeitgeist/Zeitgeist.csproj (+0/-1) Zeitgeist/ZsUtils.cs (+11/-2) |
To merge this branch: | bzr merge lp:~manishsinha/zeitgeist-sharp/testsuite |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manish Sinha (मनीष सिन्हा) | Disapprove | ||
Mirco Bauer | source | Needs Fixing | |
Seif Lotfy | Pending | ||
Review via email: mp+37400@code.launchpad.net |
Commit message
Added lots of Unit Tests
Description of the change
Added lots of Unit Tests
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Cosmetic Issues:
Empty.cs file can be removed. Not a big deal
Serious Issues:
Well those fields have been made public since NDesk.DBus was throwing exceptions which sounded like "Backing field not found/accessible". I don't understand what the problem is. If this problem happens in one place, then it's fine, but it's happening with all the types which are being sent over DBus. i.e. RawEvent and TimeRange
Since the problem is occurring all over, then is it due to NDesk.DBus being at fault or some programming mistake.
If it is a progg mistake, then it is really tough to find since NDesk.DBus docs are nearly non-existant. Otherwise the way I was keeping it(private fields) are exactly how classes should be written.
If you can find out how it is to be done, can you please explain otherwise it is seriously a big headache. It doesnt work when fields are private
UnSure:
DBus doesnt support null. There is no datatype such as null over DBus. So every nullablle type can be to initialized before passing it over DBus. In this case strings are set to string.Empty
I know it is bad coding style, but possible to fix only if DBus starts taking null as a value.
- 41. By Manish Sinha (मनीष सिन्हा)
-
Merge with fixed build system and also changed the type from struct to class
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
I merged the trunk with this branch and resolved all the merge conflicts. This branch should merge with trunk without any conflicts.
I still want people to try out this branch with their zeitgeist-daemon running as 5 UnitTests are still failing on my laptop whereas all pass on my desktop. On my desktop I have two installations - 10.04 and 10.10RC with MonoDevelop 2.4 and Mono 2.6.7 (from badgerports) and on both installs they work well
On laptop I have 10.04 with same MD 2.4 and Mono 2.6.7(badgerports) and 5 unit tests fail.
If unit tests failing can be fixed, there is nothing preventing this from getting merged.
I have discussed with meebey and it looks public fields cannot be avoided. Probably some problems with ndesk-dbus. When zg-sharp is migrated to dbus-sharp, then we can fix this public field issue (Provided dbus-sharp doesnt have the same issue)
- 42. By Manish Sinha (मनीष सिन्हा)
-
Fixed Interpretation and Manifestation to deal with unknown Uris and Fixed all the test cases. Removed Test.cs file
Added a method in ZsUtils.cs which helps in creating a human readable variant of Manifestation and Interpretation Uri
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
Chuck the previous message. I was running a very old version of Zeitgeist (some 0.3.x), removed it and installed from the trunk.
Now it works
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
I tried running all unit tests and it works. Plus, I removed the Test.cs file.
Don't find any show-stoppers here.
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
I rejected this merge since there is a superseded version of this which is in a different branch. Here is the merge request
https:/
Unmerged revisions
Preview Diff
1 | === added directory 'Zeitgeist.Testsuite' |
2 | === added directory 'Zeitgeist.Testsuite/Blacklist' |
3 | === added directory 'Zeitgeist.Testsuite/Datamodel' |
4 | === added file 'Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs' |
5 | --- Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs 1970-01-01 00:00:00 +0000 |
6 | +++ Zeitgeist.Testsuite/Datamodel/TestInterpretation.cs 2010-10-07 15:32:44 +0000 |
7 | @@ -0,0 +1,449 @@ |
8 | +using System; |
9 | +using NUnit.Framework; |
10 | +using Zeitgeist.Datamodel; |
11 | + |
12 | +namespace Zeitgeist.Testsuite |
13 | +{ |
14 | + [TestFixture()] |
15 | + public class TestInterpretation |
16 | + { |
17 | + #region Interpretation |
18 | + |
19 | + [Test()] |
20 | + public void TestAlarm() |
21 | + { |
22 | + Assert.AreEqual(Interpretation.Instance.Alarm.Name, "Alarm"); |
23 | + Assert.AreEqual(Interpretation.Instance.Alarm.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Alarm"); |
24 | + } |
25 | + |
26 | + [Test()] |
27 | + public void TestBookmark() |
28 | + { |
29 | + Assert.AreEqual(Interpretation.Instance.Bookmark.Name, "Bookmark"); |
30 | + Assert.AreEqual(Interpretation.Instance.Bookmark.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark"); |
31 | + } |
32 | + |
33 | + [Test()] |
34 | + public void TestBookmarkFolder() |
35 | + { |
36 | + Assert.AreEqual(Interpretation.Instance.BookmarkFolder.Name, "BookmarkFolder"); |
37 | + Assert.AreEqual(Interpretation.Instance.BookmarkFolder.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#BookmarkFolder"); |
38 | + } |
39 | + |
40 | + [Test()] |
41 | + public void TestCalendar() |
42 | + { |
43 | + Assert.AreEqual(Interpretation.Instance.Calendar.Name, "Calendar"); |
44 | + Assert.AreEqual(Interpretation.Instance.Calendar.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Calendar"); |
45 | + } |
46 | + |
47 | + [Test()] |
48 | + public void TestEvent() |
49 | + { |
50 | + Assert.AreEqual(Interpretation.Instance.Event.Name, "Event"); |
51 | + Assert.AreEqual(Interpretation.Instance.Event.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Event"); |
52 | + } |
53 | + |
54 | + [Test()] |
55 | + public void TestExecutable() |
56 | + { |
57 | + Assert.AreEqual(Interpretation.Instance.Executable.Name, "Executable"); |
58 | + Assert.AreEqual(Interpretation.Instance.Executable.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Executable"); |
59 | + } |
60 | + |
61 | + [Test()] |
62 | + public void TestFont() |
63 | + { |
64 | + Assert.AreEqual(Interpretation.Instance.Font.Name, "Font"); |
65 | + Assert.AreEqual(Interpretation.Instance.Font.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Font"); |
66 | + } |
67 | + |
68 | + [Test()] |
69 | + public void TestFreebusy() |
70 | + { |
71 | + Assert.AreEqual(Interpretation.Instance.Freebusy.Name, "Freebusy"); |
72 | + Assert.AreEqual(Interpretation.Instance.Freebusy.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Freebusy"); |
73 | + } |
74 | + |
75 | + [Test()] |
76 | + public void TestJournal() |
77 | + { |
78 | + Assert.AreEqual(Interpretation.Instance.Journal.Name, "Journal"); |
79 | + Assert.AreEqual(Interpretation.Instance.Journal.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Journal"); |
80 | + } |
81 | + |
82 | + [Test()] |
83 | + public void TestMailbox() |
84 | + { |
85 | + Assert.AreEqual(Interpretation.Instance.Mailbox.Name, "Mailbox"); |
86 | + Assert.AreEqual(Interpretation.Instance.Mailbox.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Mailbox"); |
87 | + } |
88 | + |
89 | + [Test()] |
90 | + public void TestMimeEntity() |
91 | + { |
92 | + Assert.AreEqual(Interpretation.Instance.MimeEntity.Name, "MimeEntity"); |
93 | + Assert.AreEqual(Interpretation.Instance.MimeEntity.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MimeEntity"); |
94 | + } |
95 | + |
96 | + [Test()] |
97 | + public void TestTimezone() |
98 | + { |
99 | + Assert.AreEqual(Interpretation.Instance.Timezone.Name, "Timezone"); |
100 | + Assert.AreEqual(Interpretation.Instance.Timezone.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Timezone"); |
101 | + } |
102 | + |
103 | + [Test()] |
104 | + public void TestTodo() |
105 | + { |
106 | + Assert.AreEqual(Interpretation.Instance.Todo.Name, "Todo"); |
107 | + Assert.AreEqual(Interpretation.Instance.Todo.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Todo"); |
108 | + } |
109 | + |
110 | + [Test()] |
111 | + public void TestTVSeries() |
112 | + { |
113 | + Assert.AreEqual(Interpretation.Instance.TVSeries.Name, "TVSeries"); |
114 | + Assert.AreEqual(Interpretation.Instance.TVSeries.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVSeries"); |
115 | + } |
116 | + |
117 | + [Test()] |
118 | + public void TestWebsite() |
119 | + { |
120 | + Assert.AreEqual(Interpretation.Instance.Website.Name, "Website"); |
121 | + Assert.AreEqual(Interpretation.Instance.Website.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Website"); |
122 | + } |
123 | + |
124 | + #endregion |
125 | + |
126 | + #region DataContainer |
127 | + |
128 | + [Test()] |
129 | + public void TestDataContainer() |
130 | + { |
131 | + Assert.AreEqual(Interpretation.Instance.DataContainer.DataContainer.Name, "DataContainer"); |
132 | + Assert.AreEqual(Interpretation.Instance.DataContainer.DataContainer.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#DataContainer"); |
133 | + } |
134 | + |
135 | + [Test()] |
136 | + public void TestDataContainerArchive() |
137 | + { |
138 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Archive.Name, "Archive"); |
139 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Archive.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Archive"); |
140 | + } |
141 | + |
142 | + [Test()] |
143 | + public void TestDataContainerFolder() |
144 | + { |
145 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Folder.Name, "Folder"); |
146 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Folder.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Folder"); |
147 | + } |
148 | + |
149 | + [Test()] |
150 | + public void TestDataContainerTrash() |
151 | + { |
152 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Trash.Name, "Trash"); |
153 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Trash.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Trash"); |
154 | + } |
155 | + |
156 | + #endregion |
157 | + |
158 | + #region FileSystem |
159 | + |
160 | + [Test()] |
161 | + public void TestDataContainerFilesystemImage() |
162 | + { |
163 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.FilesystemImage.Name, "FilesystemImage"); |
164 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.FilesystemImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FilesystemImage"); |
165 | + } |
166 | + |
167 | + [Test()] |
168 | + public void TestDataContainerFilesystem() |
169 | + { |
170 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.Filesystem.Name, "Filesystem"); |
171 | + Assert.AreEqual(Interpretation.Instance.DataContainer.Filesystem.Filesystem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Filesystem"); |
172 | + } |
173 | + |
174 | + #endregion |
175 | + |
176 | + #region Document |
177 | + |
178 | + [Test()] |
179 | + public void TestDocument() |
180 | + { |
181 | + Assert.AreEqual(Interpretation.Instance.Document.Document.Name, "Document"); |
182 | + Assert.AreEqual(Interpretation.Instance.Document.Document.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document"); |
183 | + } |
184 | + |
185 | + [Test()] |
186 | + public void TestDocumentMindMap() |
187 | + { |
188 | + Assert.AreEqual(Interpretation.Instance.Document.MindMap.Name, "MindMap"); |
189 | + Assert.AreEqual(Interpretation.Instance.Document.MindMap.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MindMap"); |
190 | + } |
191 | + |
192 | + [Test()] |
193 | + public void TestDocumentPresentation() |
194 | + { |
195 | + Assert.AreEqual(Interpretation.Instance.Document.Presentation.Name, "Presentation"); |
196 | + Assert.AreEqual(Interpretation.Instance.Document.Presentation.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Presentation"); |
197 | + } |
198 | + |
199 | + [Test()] |
200 | + public void TestDocumentSpreadsheet() |
201 | + { |
202 | + Assert.AreEqual(Interpretation.Instance.Document.Spreadsheet.Name, "Spreadsheet"); |
203 | + Assert.AreEqual(Interpretation.Instance.Document.Spreadsheet.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Spreadsheet"); |
204 | + } |
205 | + |
206 | + [Test()] |
207 | + public void TestDocumentTextDocument() |
208 | + { |
209 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.TextDocument.Name, "TextDocument"); |
210 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.TextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument"); |
211 | + } |
212 | + |
213 | + [Test()] |
214 | + public void TestDocumentPaginatedTextDocument() |
215 | + { |
216 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PaginatedTextDocument.Name, "PaginatedTextDocument"); |
217 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PaginatedTextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PaginatedTextDocument"); |
218 | + } |
219 | + |
220 | + [Test()] |
221 | + public void TestDocumentPlainTextDocument() |
222 | + { |
223 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.PlainTextDocument.Name, "PlainTextDocument"); |
224 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.PlainTextDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PlainTextDocument"); |
225 | + } |
226 | + |
227 | + [Test()] |
228 | + public void TestDocumentHtmlDocument() |
229 | + { |
230 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.HtmlDocument.Name, "HtmlDocument"); |
231 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.HtmlDocument.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#HtmlDocument"); |
232 | + } |
233 | + |
234 | + [Test()] |
235 | + public void TestDocumentSourceCode() |
236 | + { |
237 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.SourceCode.Name, "SourceCode"); |
238 | + Assert.AreEqual(Interpretation.Instance.Document.TextDocument.PlainTextDocument.SourceCode.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SourceCode"); |
239 | + } |
240 | + |
241 | + #endregion |
242 | + |
243 | + #region EventInterpretation |
244 | + |
245 | + [Test()] |
246 | + public void TestEventInterpretation() |
247 | + { |
248 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.EventInterpretation.Name, "EventInterpretation"); |
249 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.EventInterpretation.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#EventInterpretation"); |
250 | + } |
251 | + |
252 | + [Test()] |
253 | + public void TestAccessEvent() |
254 | + { |
255 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.AccessEvent.Name, "AccessEvent"); |
256 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.AccessEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent"); |
257 | + } |
258 | + |
259 | + [Test()] |
260 | + public void TestCreateEvent() |
261 | + { |
262 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.CreateEvent.Name, "CreateEvent"); |
263 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.CreateEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent"); |
264 | + } |
265 | + |
266 | + [Test()] |
267 | + public void TestDeleteEvent() |
268 | + { |
269 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.DeleteEvent.Name, "DeleteEvent"); |
270 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.DeleteEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#DeleteEvent"); |
271 | + } |
272 | + |
273 | + [Test()] |
274 | + public void TestLeaveEvent() |
275 | + { |
276 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.LeaveEvent.Name, "LeaveEvent"); |
277 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.LeaveEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#LeaveEvent"); |
278 | + } |
279 | + |
280 | + [Test()] |
281 | + public void TestModifyEvent() |
282 | + { |
283 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.ModifyEvent.Name, "ModifyEvent"); |
284 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.ModifyEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ModifyEvent"); |
285 | + } |
286 | + |
287 | + [Test()] |
288 | + public void TestReceiveEvent() |
289 | + { |
290 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.ReceiveEvent.Name, "ReceiveEvent"); |
291 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.ReceiveEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ReceiveEvent"); |
292 | + } |
293 | + |
294 | + [Test()] |
295 | + public void TestSendEvent() |
296 | + { |
297 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.SendEvent.Name, "SendEvent"); |
298 | + Assert.AreEqual(Interpretation.Instance.EventInterpretation.SendEvent.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#SendEvent"); |
299 | + } |
300 | + |
301 | + #endregion |
302 | + |
303 | + #region Media |
304 | + |
305 | + [Test()] |
306 | + public void TestMedia() |
307 | + { |
308 | + Assert.AreEqual(Interpretation.Instance.Media.Media.Name, "Media"); |
309 | + Assert.AreEqual(Interpretation.Instance.Media.Media.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Media"); |
310 | + } |
311 | + |
312 | + [Test()] |
313 | + public void TestAudio() |
314 | + { |
315 | + Assert.AreEqual(Interpretation.Instance.Media.Audio.Name, "Audio"); |
316 | + Assert.AreEqual(Interpretation.Instance.Media.Audio.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio"); |
317 | + } |
318 | + |
319 | + [Test()] |
320 | + public void TestMusicPiece() |
321 | + { |
322 | + Assert.AreEqual(Interpretation.Instance.Media.MusicPiece.Name, "MusicPiece"); |
323 | + Assert.AreEqual(Interpretation.Instance.Media.MusicPiece.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicPiece"); |
324 | + } |
325 | + |
326 | + [Test()] |
327 | + public void TestVisual() |
328 | + { |
329 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Visual.Name, "Visual"); |
330 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Visual.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Visual"); |
331 | + } |
332 | + |
333 | + [Test()] |
334 | + public void TestImage() |
335 | + { |
336 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Image.Name, "Image"); |
337 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Image.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Image"); |
338 | + } |
339 | + |
340 | + [Test()] |
341 | + public void TestIcon() |
342 | + { |
343 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Icon.Name, "Icon"); |
344 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.Icon.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Icon"); |
345 | + } |
346 | + |
347 | + [Test()] |
348 | + public void TestVectorImage() |
349 | + { |
350 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.VectorImage.Name, "VectorImage"); |
351 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.VectorImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#VectorImage"); |
352 | + } |
353 | + |
354 | + [Test()] |
355 | + public void TestRasterImage() |
356 | + { |
357 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.RasterImage.Name, "RasterImage"); |
358 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.RasterImage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RasterImage"); |
359 | + } |
360 | + |
361 | + [Test()] |
362 | + public void TestCursor() |
363 | + { |
364 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.Cursor.Name, "Cursor"); |
365 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Image.RasterImage.Cursor.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Cursor"); |
366 | + } |
367 | + |
368 | + [Test()] |
369 | + public void TestVideo() |
370 | + { |
371 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Video.Name, "Video"); |
372 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Video.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Video"); |
373 | + } |
374 | + |
375 | + [Test()] |
376 | + public void TestMovie() |
377 | + { |
378 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Movie.Name, "Movie"); |
379 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.Movie.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#Movie"); |
380 | + } |
381 | + |
382 | + [Test()] |
383 | + public void TestTVShow() |
384 | + { |
385 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.TVShow.Name, "TVShow"); |
386 | + Assert.AreEqual(Interpretation.Instance.Media.Visual.Video.TVShow.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#TVShow"); |
387 | + } |
388 | + |
389 | + [Test()] |
390 | + public void TestMediaList() |
391 | + { |
392 | + Assert.AreEqual(Interpretation.Instance.MediaList.MediaList.Name, "MediaList"); |
393 | + Assert.AreEqual(Interpretation.Instance.MediaList.MediaList.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MediaList"); |
394 | + } |
395 | + |
396 | + [Test()] |
397 | + public void TestMusicAlbum() |
398 | + { |
399 | + Assert.AreEqual(Interpretation.Instance.MediaList.MusicAlbum.Name, "MusicAlbum"); |
400 | + Assert.AreEqual(Interpretation.Instance.MediaList.MusicAlbum.Uri, "http://www.semanticdesktop.org/ontologies/2009/02/19/nmm#MusicAlbum"); |
401 | + } |
402 | + |
403 | + #endregion |
404 | + |
405 | + #region MessageType |
406 | + |
407 | + [Test()] |
408 | + public void TestMessage() |
409 | + { |
410 | + Assert.AreEqual(Interpretation.Instance.Message.Message.Name, "Message"); |
411 | + Assert.AreEqual(Interpretation.Instance.Message.Message.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Message"); |
412 | + } |
413 | + |
414 | + [Test()] |
415 | + public void TestEmail() |
416 | + { |
417 | + Assert.AreEqual(Interpretation.Instance.Message.Email.Name, "Email"); |
418 | + Assert.AreEqual(Interpretation.Instance.Message.Email.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email"); |
419 | + } |
420 | + |
421 | + [Test()] |
422 | + public void TestIMMessage() |
423 | + { |
424 | + Assert.AreEqual(Interpretation.Instance.Message.IMMessage.Name, "IMMessage"); |
425 | + Assert.AreEqual(Interpretation.Instance.Message.IMMessage.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#IMMessage"); |
426 | + } |
427 | + |
428 | + #endregion |
429 | + |
430 | + #region SoftwareType |
431 | + |
432 | + [Test()] |
433 | + public void TestSoftware() |
434 | + { |
435 | + Assert.AreEqual(Interpretation.Instance.Software.Software.Name, "Software"); |
436 | + Assert.AreEqual(Interpretation.Instance.Software.Software.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Software"); |
437 | + } |
438 | + |
439 | + [Test()] |
440 | + public void TestApplication() |
441 | + { |
442 | + Assert.AreEqual(Interpretation.Instance.Software.Application.Name, "Application"); |
443 | + Assert.AreEqual(Interpretation.Instance.Software.Application.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Application"); |
444 | + } |
445 | + |
446 | + [Test()] |
447 | + public void TestOperatingSystem() |
448 | + { |
449 | + Assert.AreEqual(Interpretation.Instance.Software.OperatingSystem.Name, "OperatingSystem"); |
450 | + Assert.AreEqual(Interpretation.Instance.Software.OperatingSystem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#OperatingSystem"); |
451 | + } |
452 | + |
453 | + #endregion |
454 | + } |
455 | +} |
456 | + |
457 | |
458 | === added file 'Zeitgeist.Testsuite/Datamodel/TestManifestation.cs' |
459 | --- Zeitgeist.Testsuite/Datamodel/TestManifestation.cs 1970-01-01 00:00:00 +0000 |
460 | +++ Zeitgeist.Testsuite/Datamodel/TestManifestation.cs 2010-10-07 15:32:44 +0000 |
461 | @@ -0,0 +1,156 @@ |
462 | +using System; |
463 | +using NUnit.Framework; |
464 | +using Zeitgeist.Datamodel; |
465 | + |
466 | +namespace Zeitgeist.Testsuite |
467 | +{ |
468 | + [TestFixture()] |
469 | + public class TestManifestation |
470 | + { |
471 | + #region Manifestation |
472 | + |
473 | + [Test()] |
474 | + public void TestCalendarDataObject() |
475 | + { |
476 | + Assert.AreEqual(Manifestation.Instance.CalendarDataObject.Name, "CalendarDataObject"); |
477 | + Assert.AreEqual(Manifestation.Instance.CalendarDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#CalendarDataObject"); |
478 | + } |
479 | + |
480 | + [Test()] |
481 | + public void TestHardDiskPartition() |
482 | + { |
483 | + Assert.AreEqual(Manifestation.Instance.HardDiskPartition.Name, "HardDiskPartition"); |
484 | + Assert.AreEqual(Manifestation.Instance.HardDiskPartition.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#HardDiskPartition"); |
485 | + } |
486 | + |
487 | + [Test()] |
488 | + public void TestMailboxDataObject() |
489 | + { |
490 | + Assert.AreEqual(Manifestation.Instance.MailboxDataObject.Name, "MailboxDataObject"); |
491 | + Assert.AreEqual(Manifestation.Instance.MailboxDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MailboxDataObject"); |
492 | + } |
493 | + |
494 | + [Test()] |
495 | + public void TestMediaStream() |
496 | + { |
497 | + Assert.AreEqual(Manifestation.Instance.MediaStream.Name, "MediaStream"); |
498 | + Assert.AreEqual(Manifestation.Instance.MediaStream.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#MediaStream"); |
499 | + } |
500 | + |
501 | + [Test()] |
502 | + public void TestRemotePortAddress() |
503 | + { |
504 | + Assert.AreEqual(Manifestation.Instance.RemotePortAddress.Name, "RemotePortAddress"); |
505 | + Assert.AreEqual(Manifestation.Instance.RemotePortAddress.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RemotePortAddress"); |
506 | + } |
507 | + |
508 | + [Test()] |
509 | + public void TestSoftwareItem() |
510 | + { |
511 | + Assert.AreEqual(Manifestation.Instance.SoftwareItem.Name, "SoftwareItem"); |
512 | + Assert.AreEqual(Manifestation.Instance.SoftwareItem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SoftwareItem"); |
513 | + } |
514 | + |
515 | + [Test()] |
516 | + public void TestSoftwareService() |
517 | + { |
518 | + Assert.AreEqual(Manifestation.Instance.SoftwareService.Name, "SoftwareService"); |
519 | + Assert.AreEqual(Manifestation.Instance.SoftwareService.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#SoftwareService"); |
520 | + } |
521 | + |
522 | + #endregion |
523 | + |
524 | + #region EventManifestation |
525 | + |
526 | + [Test()] |
527 | + public void TestEventManifestation() |
528 | + { |
529 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.EventManifestation.Name, "EventManifestation"); |
530 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.EventManifestation.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#EventManifestation"); |
531 | + } |
532 | + |
533 | + [Test()] |
534 | + public void TestHeuristicActivity() |
535 | + { |
536 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.HeuristicActivity.Name, "HeuristicActivity"); |
537 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.HeuristicActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#HeuristicActivity"); |
538 | + } |
539 | + |
540 | + [Test()] |
541 | + public void TestScheduledActivity() |
542 | + { |
543 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.ScheduledActivity.Name, "ScheduledActivity"); |
544 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.ScheduledActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ScheduledActivity"); |
545 | + } |
546 | + |
547 | + [Test()] |
548 | + public void TestSystemNotification() |
549 | + { |
550 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.SystemNotification.Name, "SystemNotification"); |
551 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.SystemNotification.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#SystemNotification"); |
552 | + } |
553 | + |
554 | + [Test()] |
555 | + public void TestUserActivity() |
556 | + { |
557 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.UserActivity.Name, "UserActivity"); |
558 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.UserActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity"); |
559 | + } |
560 | + |
561 | + [Test()] |
562 | + public void TestWorldActivity() |
563 | + { |
564 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.WorldActivity.Name, "WorldActivity"); |
565 | + Assert.AreEqual(Manifestation.Instance.EventManifestation.WorldActivity.Uri, "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#WorldActivity"); |
566 | + } |
567 | + |
568 | + #endregion |
569 | + |
570 | + #region FileDataObject |
571 | + |
572 | + [Test()] |
573 | + public void TestFileDataObject() |
574 | + { |
575 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.FileDataObject.Name, "FileDataObject"); |
576 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.FileDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#FileDataObject"); |
577 | + } |
578 | + |
579 | + [Test()] |
580 | + public void TestDeletedResource() |
581 | + { |
582 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.DeletedResource.Name, "DeletedResource"); |
583 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.DeletedResource.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#DeletedResource"); |
584 | + } |
585 | + |
586 | + [Test()] |
587 | + public void TestRemoteDataObject() |
588 | + { |
589 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.RemoteDataObject.Name, "RemoteDataObject"); |
590 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.RemoteDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#RemoteDataObject"); |
591 | + } |
592 | + |
593 | + [Test()] |
594 | + public void TestEmbeddedFileDataObject() |
595 | + { |
596 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.EmbeddedFileDataObject.Name, "EmbeddedFileDataObject"); |
597 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.EmbeddedFileDataObject.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#EmbeddedFileDataObject"); |
598 | + } |
599 | + |
600 | + [Test()] |
601 | + public void TestArchiveItem() |
602 | + { |
603 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.ArchiveItem.Name, "ArchiveItem"); |
604 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.ArchiveItem.Uri, "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#ArchiveItem"); |
605 | + } |
606 | + |
607 | + [Test()] |
608 | + public void TestAttachment() |
609 | + { |
610 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.Attachment.Name, "Attachment"); |
611 | + Assert.AreEqual(Manifestation.Instance.FileDataObject.EmbeddedFileDataObject.Attachment.Uri, "http://www.semanticdesktop.org/ontologies/2007/04/02/ncal#Attachment"); |
612 | + } |
613 | + |
614 | + #endregion |
615 | + } |
616 | +} |
617 | + |
618 | |
619 | === added directory 'Zeitgeist.Testsuite/Datasource' |
620 | === added directory 'Zeitgeist.Testsuite/Log' |
621 | === added file 'Zeitgeist.Testsuite/Log/TestDeleteEvents.cs' |
622 | --- Zeitgeist.Testsuite/Log/TestDeleteEvents.cs 1970-01-01 00:00:00 +0000 |
623 | +++ Zeitgeist.Testsuite/Log/TestDeleteEvents.cs 2010-10-07 15:32:44 +0000 |
624 | @@ -0,0 +1,50 @@ |
625 | +using System; |
626 | +using NUnit.Framework; |
627 | +using Zeitgeist; |
628 | +using Zeitgeist.Datamodel; |
629 | +using System.Collections.Generic; |
630 | + |
631 | +namespace Zeitgeist.Testsuite |
632 | +{ |
633 | + [TestFixture()] |
634 | + public class TestDeleteEvents |
635 | + { |
636 | + [Test()] |
637 | + public void TestDeleteEventsPass() |
638 | + { |
639 | + Event ev1 = new Event(); |
640 | + Subject sub11 = new Subject(); |
641 | + Subject sub12 = new Subject(); |
642 | + ev1.Subjects.Add(sub11); |
643 | + ev1.Subjects.Add(sub12); |
644 | + |
645 | + Event ev2 = new Event(); |
646 | + Subject sub21 = new Subject(); |
647 | + Subject sub22 = new Subject(); |
648 | + ev2.Subjects.Add(sub21); |
649 | + ev2.Subjects.Add(sub22); |
650 | + |
651 | + LogClient client = new LogClient(); |
652 | + List<uint> eventIds = client.InsertEvents(new List<Event>() { ev1, ev2 }); |
653 | + |
654 | + CollectionAssert.IsNotEmpty(eventIds); |
655 | + Assert.AreEqual(eventIds.Count, 2); |
656 | + |
657 | + TimeRange range = client.DeleteEvents(eventIds); |
658 | + |
659 | + Assert.IsNotNull(range.Begin); |
660 | + Assert.IsNotNull(range.End); |
661 | + } |
662 | + |
663 | + [Test()] |
664 | + public void TestDeleteEventsFail() |
665 | + { |
666 | + LogClient client = new LogClient(); |
667 | + |
668 | + TimeRange range = client.DeleteEvents(new List<uint>(){ 3000 }); |
669 | + |
670 | + Assert.IsNull(range); |
671 | + } |
672 | + } |
673 | +} |
674 | + |
675 | |
676 | === added file 'Zeitgeist.Testsuite/Log/TestFindEventIds.cs' |
677 | --- Zeitgeist.Testsuite/Log/TestFindEventIds.cs 1970-01-01 00:00:00 +0000 |
678 | +++ Zeitgeist.Testsuite/Log/TestFindEventIds.cs 2010-10-07 15:32:44 +0000 |
679 | @@ -0,0 +1,36 @@ |
680 | +using System; |
681 | +using NUnit.Framework; |
682 | +using Zeitgeist; |
683 | +using Zeitgeist.Datamodel; |
684 | +using System.Collections.Generic; |
685 | + |
686 | +namespace Zeitgeist.Testsuite |
687 | +{ |
688 | + [TestFixture()] |
689 | + public class TestFindEventIds |
690 | + { |
691 | + [Test()] |
692 | + public void TestFindEventIdsPass() |
693 | + { |
694 | + TimeRange range = new TimeRange(); |
695 | + range.Begin = DateTime.Now.AddDays(-30); |
696 | + range.End = DateTime.Now; |
697 | + |
698 | + Event e = new Event(); |
699 | + e.Actor = "application:///usr/share/applications/eog.desktop"; |
700 | + Subject sub = new Subject(); |
701 | + e.Subjects.Add(sub); |
702 | + |
703 | + Event e2 = new Event(); |
704 | + e2.Actor = "application://eog.desktop"; |
705 | + Subject sub2 = new Subject(); |
706 | + e2.Subjects.Add(sub2); |
707 | + |
708 | + LogClient client = new LogClient(); |
709 | + List<uint> eventIds = client.FindEventIds(range, new List<Event>(){e,e2}, StorageState.Any, 20, ResultType.MostRecentEvents); |
710 | + |
711 | + CollectionAssert.IsNotEmpty(eventIds); |
712 | + } |
713 | + } |
714 | +} |
715 | + |
716 | |
717 | === added file 'Zeitgeist.Testsuite/Log/TestFindEvents.cs' |
718 | --- Zeitgeist.Testsuite/Log/TestFindEvents.cs 1970-01-01 00:00:00 +0000 |
719 | +++ Zeitgeist.Testsuite/Log/TestFindEvents.cs 2010-10-07 15:32:44 +0000 |
720 | @@ -0,0 +1,43 @@ |
721 | +using System; |
722 | +using NUnit.Framework; |
723 | +using Zeitgeist; |
724 | +using Zeitgeist.Datamodel; |
725 | +using System.Collections.Generic; |
726 | + |
727 | +namespace Zeitgeist.Testsuite |
728 | +{ |
729 | + [TestFixture()] |
730 | + public class TestFindEvents |
731 | + { |
732 | + [Test()] |
733 | + public void TestFindEventsPass() |
734 | + { |
735 | + TimeRange range = new TimeRange(); |
736 | + range.Begin = DateTime.Now.AddDays(-30); |
737 | + range.End = DateTime.Now; |
738 | + |
739 | + Event e = new Event(); |
740 | + e.Actor = "application:///usr/share/applications/eog.desktop"; |
741 | + Subject sub = new Subject(); |
742 | + e.Subjects.Add(sub); |
743 | + |
744 | + Event e2 = new Event(); |
745 | + e2.Actor = "application://eog.desktop"; |
746 | + Subject sub2 = new Subject(); |
747 | + e2.Subjects.Add(sub2); |
748 | + |
749 | + LogClient client = new LogClient(); |
750 | + List<Event> events = client.FindEvents(range, new List<Event>(){e,e2}, StorageState.Any, 20, ResultType.MostRecentEvents); |
751 | + |
752 | + CollectionAssert.IsNotEmpty(events); |
753 | + |
754 | + foreach(Event ev in events) |
755 | + { |
756 | + Assert.Greater(ev.Id, 0); |
757 | + Assert.IsNotEmpty(ev.Actor); |
758 | + Assert.IsNotNull(ev.Interpretation); |
759 | + } |
760 | + } |
761 | + } |
762 | +} |
763 | + |
764 | |
765 | === added file 'Zeitgeist.Testsuite/Log/TestGetEvents.cs' |
766 | --- Zeitgeist.Testsuite/Log/TestGetEvents.cs 1970-01-01 00:00:00 +0000 |
767 | +++ Zeitgeist.Testsuite/Log/TestGetEvents.cs 2010-10-07 15:32:44 +0000 |
768 | @@ -0,0 +1,54 @@ |
769 | +using System; |
770 | +using NUnit.Framework; |
771 | +using Zeitgeist; |
772 | +using Zeitgeist.Datamodel; |
773 | +using System.Collections.Generic; |
774 | + |
775 | +namespace Zeitgeist.Testsuite |
776 | +{ |
777 | + [TestFixture()] |
778 | + public class TestGetEvents |
779 | + { |
780 | + [Test()] |
781 | + public void TestEventIds() |
782 | + { |
783 | + LogClient client = new LogClient(); |
784 | + |
785 | + List<uint> eventIdList = new List<uint>(){ 1, 2, 3 }; |
786 | + List<Event> events = client.GetEvents(eventIdList); |
787 | + |
788 | + Assert.IsNotNull(events); |
789 | + |
790 | + foreach(Event ev in events) |
791 | + { |
792 | + Assert.IsNotNull(ev); |
793 | + Assert.IsNotNull(ev.Interpretation); |
794 | + Assert.IsNotNull(ev.Manifestation); |
795 | + Assert.IsNotEmpty(ev.Interpretation.Uri); |
796 | + Assert.IsNotEmpty(ev.Manifestation.Uri); |
797 | + |
798 | + Assert.IsNotNull(ev.Timestamp); |
799 | + |
800 | + Assert.IsNotNull(ev.Actor); |
801 | + |
802 | + CollectionAssert.AllItemsAreNotNull(ev.Subjects); |
803 | + CollectionAssert.AllItemsAreUnique(ev.Subjects); |
804 | + } |
805 | + } |
806 | + |
807 | + [Test()] |
808 | + public void TestNonExistingEventIds() |
809 | + { |
810 | + LogClient client = new LogClient(); |
811 | + |
812 | + List<uint> eventIdList = new List<uint>(){ 100000, 200000, 300000 }; |
813 | + List<Event> events = client.GetEvents(eventIdList); |
814 | + |
815 | + foreach(Event ev in events) |
816 | + { |
817 | + Assert.IsNull(ev); |
818 | + } |
819 | + } |
820 | + } |
821 | +} |
822 | + |
823 | |
824 | === added file 'Zeitgeist.Testsuite/Log/TestInsertEvents.cs' |
825 | --- Zeitgeist.Testsuite/Log/TestInsertEvents.cs 1970-01-01 00:00:00 +0000 |
826 | +++ Zeitgeist.Testsuite/Log/TestInsertEvents.cs 2010-10-07 15:32:44 +0000 |
827 | @@ -0,0 +1,38 @@ |
828 | +using System; |
829 | +using NUnit.Framework; |
830 | +using Zeitgeist; |
831 | +using Zeitgeist.Datamodel; |
832 | +using System.Collections.Generic; |
833 | + |
834 | +namespace Zeitgeist.Testsuite |
835 | +{ |
836 | + [TestFixture()] |
837 | + public class TestInsertEvents |
838 | + { |
839 | + [Test()] |
840 | + public void TestInsertEventsPass() |
841 | + { |
842 | + Event ev = new Event(); |
843 | + ev.Interpretation = Interpretation.Instance.EventInterpretation.AccessEvent; |
844 | + ev.Manifestation = Manifestation.Instance.EventManifestation.UserActivity; |
845 | + ev.Actor = "application://tomboy.desktop"; |
846 | + |
847 | + Subject sub11 = new Subject(); |
848 | + sub11.Uri = "/home/manish/.local/share/tomboy/bf7112c1-28dd-4079-b566-c135b19c4e01.note"; |
849 | + sub11.Interpretation = Interpretation.Instance.EventInterpretation.AccessEvent; |
850 | + sub11.Manifestation = Manifestation.Instance.EventManifestation.UserActivity; |
851 | + sub11.Origin = "file:///home/manish/.local/share/tomboy/"; |
852 | + sub11.MimeType = "text/x-note"; |
853 | + sub11.Text = "Ubuntu One"; |
854 | + |
855 | + ev.Subjects.Add(sub11); |
856 | + |
857 | + LogClient client = new LogClient(); |
858 | + List<uint> eventIds = client.InsertEvents(new List<Event>() { ev }); |
859 | + |
860 | + Assert.IsNotNull(eventIds); |
861 | + CollectionAssert.IsNotEmpty(eventIds); |
862 | + } |
863 | + } |
864 | +} |
865 | + |
866 | |
867 | === added file 'Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj' |
868 | --- Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj 1970-01-01 00:00:00 +0000 |
869 | +++ Zeitgeist.Testsuite/Zeitgeist.Testsuite.csproj 2010-10-07 15:32:44 +0000 |
870 | @@ -0,0 +1,67 @@ |
871 | +<?xml version="1.0" encoding="utf-8"?> |
872 | +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
873 | + <PropertyGroup> |
874 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
875 | + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
876 | + <ProductVersion>8.0.50727</ProductVersion> |
877 | + <SchemaVersion>2.0</SchemaVersion> |
878 | + <ProjectGuid>{319E54B4-6715-4287-8E3C-88B7CDDA167A}</ProjectGuid> |
879 | + <OutputType>Library</OutputType> |
880 | + <RootNamespace>Zeitgeist.Testsuite</RootNamespace> |
881 | + <AssemblyName>Zeitgeist.Testsuite</AssemblyName> |
882 | + </PropertyGroup> |
883 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
884 | + <DebugSymbols>true</DebugSymbols> |
885 | + <DebugType>full</DebugType> |
886 | + <Optimize>false</Optimize> |
887 | + <OutputPath>bin\Debug</OutputPath> |
888 | + <DefineConstants>DEBUG</DefineConstants> |
889 | + <ErrorReport>prompt</ErrorReport> |
890 | + <WarningLevel>4</WarningLevel> |
891 | + <ConsolePause>false</ConsolePause> |
892 | + </PropertyGroup> |
893 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
894 | + <DebugType>none</DebugType> |
895 | + <Optimize>false</Optimize> |
896 | + <OutputPath>bin\Release</OutputPath> |
897 | + <ErrorReport>prompt</ErrorReport> |
898 | + <WarningLevel>4</WarningLevel> |
899 | + <ConsolePause>false</ConsolePause> |
900 | + </PropertyGroup> |
901 | + <ItemGroup> |
902 | + <Reference Include="System" /> |
903 | + <Reference Include="nunit.core, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"> |
904 | + <Package>mono-nunit</Package> |
905 | + </Reference> |
906 | + <Reference Include="nunit.framework, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"> |
907 | + <Package>mono-nunit</Package> |
908 | + </Reference> |
909 | + </ItemGroup> |
910 | + <ItemGroup> |
911 | + <Compile Include="Datamodel\TestInterpretation.cs" /> |
912 | + <Compile Include="Datamodel\TestManifestation.cs" /> |
913 | + <Compile Include="Log\TestGetEvents.cs" /> |
914 | + <Compile Include="Log\TestInsertEvents.cs" /> |
915 | + <Compile Include="Log\TestDeleteEvents.cs" /> |
916 | + <Compile Include="Log\TestFindEventIds.cs" /> |
917 | + <Compile Include="Log\TestFindEvents.cs" /> |
918 | + </ItemGroup> |
919 | + <ItemGroup> |
920 | + <ProjectReference Include="..\Zeitgeist\Zeitgeist.csproj"> |
921 | + <Project>{A8352F1A-F10C-41E6-B6B0-655703358EF4}</Project> |
922 | + <Name>Zeitgeist</Name> |
923 | + </ProjectReference> |
924 | + </ItemGroup> |
925 | + <ItemGroup> |
926 | + <Folder Include="Log\" /> |
927 | + <Folder Include="Blacklist\" /> |
928 | + <Folder Include="Datasource\" /> |
929 | + <Folder Include="Datamodel\" /> |
930 | + </ItemGroup> |
931 | + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
932 | + <ProjectExtensions> |
933 | + <MonoDevelop> |
934 | + <Properties InternalTargetFrameworkVersion="3.5" /> |
935 | + </MonoDevelop> |
936 | + </ProjectExtensions> |
937 | +</Project> |
938 | \ No newline at end of file |
939 | |
940 | === modified file 'Zeitgeist.sln' |
941 | --- Zeitgeist.sln 2010-09-19 19:43:25 +0000 |
942 | +++ Zeitgeist.sln 2010-10-07 15:32:44 +0000 |
943 | @@ -3,12 +3,18 @@ |
944 | # Visual Studio 2005 |
945 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zeitgeist", "Zeitgeist\Zeitgeist.csproj", "{A8352F1A-F10C-41E6-B6B0-655703358EF4}" |
946 | EndProject |
947 | +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zeitgeist.Testsuite", "Zeitgeist.Testsuite\Zeitgeist.Testsuite.csproj", "{319E54B4-6715-4287-8E3C-88B7CDDA167A}" |
948 | +EndProject |
949 | Global |
950 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
951 | Debug|x86 = Debug|x86 |
952 | Release|x86 = Release|x86 |
953 | EndGlobalSection |
954 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
955 | + {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Debug|x86.ActiveCfg = Debug|Any CPU |
956 | + {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Debug|x86.Build.0 = Debug|Any CPU |
957 | + {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Release|x86.ActiveCfg = Release|Any CPU |
958 | + {319E54B4-6715-4287-8E3C-88B7CDDA167A}.Release|x86.Build.0 = Release|Any CPU |
959 | {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Debug|x86.ActiveCfg = Debug|Any CPU |
960 | {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Debug|x86.Build.0 = Debug|Any CPU |
961 | {A8352F1A-F10C-41E6-B6B0-655703358EF4}.Release|x86.ActiveCfg = Release|Any CPU |
962 | |
963 | === modified file 'Zeitgeist/Client/ILog.cs' |
964 | --- Zeitgeist/Client/ILog.cs 2010-10-01 16:29:35 +0000 |
965 | +++ Zeitgeist/Client/ILog.cs 2010-10-07 15:32:44 +0000 |
966 | @@ -59,7 +59,7 @@ |
967 | /// An array containing the IDs of all matching events, up to a maximum of num_events events. |
968 | /// Sorted and grouped as defined by the result_type parameter. <see cref="T:System.UInt32[]"/> |
969 | /// </returns> |
970 | - UInt32[] FindEventIds(TimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
971 | + UInt32[] FindEventIds(RawTimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
972 | |
973 | /// <summary> |
974 | /// Get events matching a given set of templates. |
975 | @@ -87,7 +87,7 @@ |
976 | /// <returns> |
977 | /// 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[]"/> |
978 | /// </returns> |
979 | - RawEvent[] FindEvents(TimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
980 | + RawEvent[] FindEvents(RawTimeRange range, RawEvent[] eventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
981 | |
982 | /// <summary> |
983 | /// Warning: This API is EXPERIMENTAL and is not fully supported yet. |
984 | @@ -115,7 +115,7 @@ |
985 | /// <returns> |
986 | /// A list of URIs matching the described criteria <see cref="T:System.String[]"/> |
987 | /// </returns> |
988 | - string[] FindRelatedUris(TimeRange range, RawEvent[] eventTemplates, RawEvent[] resultEventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
989 | + string[] FindRelatedUris(RawTimeRange range, RawEvent[] eventTemplates, RawEvent[] resultEventTemplates, UInt32 state, UInt32 maxEvents, UInt32 resType); |
990 | |
991 | /// <summary> |
992 | /// Inserts events into the log. Returns an array containing the IDs of the inserted events |
993 | @@ -144,7 +144,7 @@ |
994 | /// <param name="eventTemplates"> |
995 | /// RawEvent templates that events must match in order to trigger the monitor <see cref="T:Zeitgeist.Datamodel.RawEvent[]"/> |
996 | /// </param> |
997 | - void InstallMonitor(ObjectPath monitorPath, TimeRange range, RawEvent[] eventTemplates); |
998 | + void InstallMonitor(ObjectPath monitorPath, RawTimeRange range, RawEvent[] eventTemplates); |
999 | |
1000 | /// <summary> |
1001 | /// Remove a monitor installed with InstallMonitor() |
1002 | @@ -161,9 +161,9 @@ |
1003 | /// The eventId of the Events to be deleted <see cref="T:System.UInt32[]"/> |
1004 | /// </param> |
1005 | /// <returns> |
1006 | - /// The TimeRange <see cref="T:Zeitgeist.Datamodel.TimeRange"/> |
1007 | + /// The TimeRange <see cref="T:Zeitgeist.Datamodel.RawTimeRange"/> |
1008 | /// </returns> |
1009 | - TimeRange DeleteEvents(UInt32[] eventIds); |
1010 | + RawTimeRange DeleteEvents(UInt32[] eventIds); |
1011 | |
1012 | /// <summary> |
1013 | /// Delete the log file and all its content |
1014 | |
1015 | === modified file 'Zeitgeist/Datamodel/Event.cs' |
1016 | --- Zeitgeist/Datamodel/Event.cs 2010-10-02 05:20:40 +0000 |
1017 | +++ Zeitgeist/Datamodel/Event.cs 2010-10-07 15:32:44 +0000 |
1018 | @@ -21,6 +21,10 @@ |
1019 | { |
1020 | Subjects = new List<Subject>(); |
1021 | Payload =new byte[]{}; |
1022 | + Actor = string.Empty; |
1023 | + Timestamp = ZsUtils.Epoch; |
1024 | + Interpretation = new NameUri(); |
1025 | + Manifestation = new NameUri(); |
1026 | } |
1027 | |
1028 | /// <summary> |
1029 | @@ -97,7 +101,7 @@ |
1030 | /// <summary> |
1031 | /// The Raw form of Event. Get Event.FromRaw to create an Event from a RawEvent |
1032 | /// </summary> |
1033 | - internal struct RawEvent |
1034 | + internal class RawEvent |
1035 | { |
1036 | /// <summary> |
1037 | /// The event Metadata |
1038 | @@ -143,6 +147,11 @@ |
1039 | _payload = value; |
1040 | } |
1041 | } |
1042 | + /// <summary> |
1043 | + /// The default constructor of RawEvent |
1044 | + /// </summary> |
1045 | + public RawEvent() |
1046 | + {} |
1047 | |
1048 | /// <summary> |
1049 | /// A parameterized constructor for creating a RawEvent |
1050 | @@ -186,13 +195,9 @@ |
1051 | for(int i=0; i< metaDataList.Capacity; i++) |
1052 | metaDataList.Add(null); |
1053 | |
1054 | - if(ev.Id == 0) |
1055 | - metaDataList[(int)EventMetadataPosition.Id] = string.Empty; |
1056 | - else |
1057 | - metaDataList[(int)EventMetadataPosition.Id] = ev.Id.ToString(); |
1058 | - |
1059 | - |
1060 | - metaDataList[(int)EventMetadataPosition.Timestamp] = ZsUtils.ToTimestamp(ev.Timestamp).ToString(); |
1061 | + metaDataList[(int)EventMetadataPosition.Id] = (ev.Id == 0)? string.Empty: ev.Id.ToString(); |
1062 | + metaDataList[(int)EventMetadataPosition.Timestamp] = (ev.Id == 0)? string.Empty: ZsUtils.ToTimestamp(ev.Timestamp).ToString(); |
1063 | + |
1064 | metaDataList[(int)EventMetadataPosition.Actor] = ev.Actor; |
1065 | metaDataList[(int)EventMetadataPosition.Interpretation] = ev.Interpretation.Uri; |
1066 | metaDataList[(int)EventMetadataPosition.Manifestation] = ev.Manifestation.Uri; |
1067 | @@ -311,9 +316,9 @@ |
1068 | |
1069 | #region RawEvent Private Fields |
1070 | |
1071 | - private string[] _metadata; |
1072 | - private string[][] _subjects; |
1073 | - private byte[] _payload; |
1074 | + public string[] _metadata; |
1075 | + public string[][] _subjects; |
1076 | + public byte[] _payload; |
1077 | |
1078 | #endregion |
1079 | } |
1080 | |
1081 | === modified file 'Zeitgeist/Datamodel/Interpretation.cs' |
1082 | --- Zeitgeist/Datamodel/Interpretation.cs 2010-10-02 05:20:40 +0000 |
1083 | +++ Zeitgeist/Datamodel/Interpretation.cs 2010-10-07 15:32:44 +0000 |
1084 | @@ -393,34 +393,34 @@ |
1085 | return _website; |
1086 | |
1087 | NameUri datacont = _data_container.Search(interpretation); |
1088 | - if(datacont.Name != null) |
1089 | + if(datacont != null) |
1090 | return datacont; |
1091 | |
1092 | NameUri doc = _document.Search(interpretation); |
1093 | - if(doc.Name != null) |
1094 | + if(doc != null) |
1095 | return doc; |
1096 | |
1097 | NameUri evnt_int = _event_interpretation.Search(interpretation); |
1098 | - if(evnt_int.Name != null) |
1099 | + if(evnt_int != null) |
1100 | return evnt_int; |
1101 | |
1102 | NameUri media = _media.Search(interpretation); |
1103 | - if(media.Name != null) |
1104 | + if(media != null) |
1105 | return media; |
1106 | |
1107 | NameUri media_lst = _media_list.Search(interpretation); |
1108 | - if(media_lst.Name != null) |
1109 | + if(media_lst != null) |
1110 | return media_lst; |
1111 | |
1112 | NameUri msg = _message.Search(interpretation); |
1113 | - if(msg.Name != null) |
1114 | + if(msg != null) |
1115 | return msg; |
1116 | |
1117 | NameUri sw = _software.Search(interpretation); |
1118 | - if(sw.Name != null) |
1119 | + if(sw != null) |
1120 | return sw; |
1121 | |
1122 | - return new NameUri(); |
1123 | + return new NameUri(ZsUtils.GetStringAnchor(interpretation), interpretation); |
1124 | } |
1125 | |
1126 | #region Private Fields |
1127 | @@ -563,10 +563,10 @@ |
1128 | return _trash; |
1129 | |
1130 | NameUri fs = _filesystem.Search(interpretation); |
1131 | - if(fs.Name != null) |
1132 | + if(fs != null) |
1133 | return fs; |
1134 | |
1135 | - return new NameUri(); |
1136 | + return null; |
1137 | } |
1138 | |
1139 | #region Private Fields |
1140 | @@ -622,7 +622,7 @@ |
1141 | if(string.Equals(_file_system.Uri, interpretation)) |
1142 | return _file_system; |
1143 | |
1144 | - return new NameUri(); |
1145 | + return null; |
1146 | } |
1147 | |
1148 | #region Private Fields |
1149 | @@ -725,10 +725,10 @@ |
1150 | return _spreadsheet; |
1151 | |
1152 | NameUri textdoc = _text_document.Search(interpretation); |
1153 | - if(textdoc.Name != null) |
1154 | + if(textdoc != null) |
1155 | return textdoc; |
1156 | |
1157 | - return new NameUri(); |
1158 | + return null; |
1159 | } |
1160 | |
1161 | #region Private Fields |
1162 | @@ -749,6 +749,20 @@ |
1163 | public class TextDocumentType |
1164 | { |
1165 | /// <summary> |
1166 | + /// A text document. (Display name: 'TextDocument') |
1167 | + /// </summary> |
1168 | + /// <remarks> |
1169 | + /// http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument |
1170 | + /// </remarks> |
1171 | + public NameUri TextDocument |
1172 | + { |
1173 | + get |
1174 | + { |
1175 | + return _text_document; |
1176 | + } |
1177 | + } |
1178 | + |
1179 | + /// <summary> |
1180 | /// A file containing a text document, that is unambiguously divided into pages. Examples might include PDF, DOC, PS, DVI etc. (Display name: 'PaginatedTextDocument') |
1181 | /// </summary> |
1182 | /// <remarks> |
1183 | @@ -783,15 +797,17 @@ |
1184 | return _paginated_text_document; |
1185 | |
1186 | NameUri plaintext = _plain_text_document.Search(interpretation); |
1187 | - if(plaintext.Name != null) |
1188 | + if(plaintext != null) |
1189 | return plaintext; |
1190 | |
1191 | - return new NameUri(); |
1192 | + return null; |
1193 | } |
1194 | |
1195 | #region Private Fields |
1196 | |
1197 | - private NameUri _paginated_text_document = new NameUri("Spreadsheet", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Spreadsheet"); |
1198 | + private NameUri _text_document = new NameUri("TextDocument", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#TextDocument"); |
1199 | + |
1200 | + private NameUri _paginated_text_document = new NameUri("PaginatedTextDocument", "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#PaginatedTextDocument"); |
1201 | |
1202 | private PlainTextDocumentType _plain_text_document = new PlainTextDocumentType(); |
1203 | |
1204 | @@ -853,7 +869,7 @@ |
1205 | if(string.Equals(_source_code.Uri, interpretation)) |
1206 | return _source_code; |
1207 | |
1208 | - return new NameUri(); |
1209 | + return null; |
1210 | } |
1211 | |
1212 | #region Private Fields |
1213 | @@ -1012,7 +1028,7 @@ |
1214 | return _send_event; |
1215 | |
1216 | |
1217 | - return new NameUri(); |
1218 | + return null; |
1219 | } |
1220 | |
1221 | #region Private Fields |
1222 | @@ -1110,10 +1126,10 @@ |
1223 | return _music_piece; |
1224 | |
1225 | NameUri visual = _visual_type.Search(interpretation); |
1226 | - if(visual.Name != null) |
1227 | + if(visual != null) |
1228 | return visual; |
1229 | |
1230 | - return new NameUri(); |
1231 | + return null; |
1232 | } |
1233 | |
1234 | #region Private Fields |
1235 | @@ -1179,14 +1195,14 @@ |
1236 | return _visual; |
1237 | |
1238 | NameUri image = _image.Search(interpretation); |
1239 | - if(image.Name != null) |
1240 | + if(image != null) |
1241 | return image; |
1242 | |
1243 | NameUri video = _video.Search(interpretation); |
1244 | - if(video.Name != null) |
1245 | + if(video != null) |
1246 | return video; |
1247 | |
1248 | - return new NameUri(); |
1249 | + return null; |
1250 | } |
1251 | |
1252 | #region Private Fields |
1253 | @@ -1267,13 +1283,13 @@ |
1254 | return _icon; |
1255 | |
1256 | NameUri rast = _raster_image.Search(interpretation); |
1257 | - if(rast.Name != null) |
1258 | + if(rast != null) |
1259 | return rast; |
1260 | |
1261 | if(string.Equals(_vector_image.Uri, interpretation)) |
1262 | return _vector_image; |
1263 | |
1264 | - return new NameUri(); |
1265 | + return null; |
1266 | } |
1267 | |
1268 | #region Private Fields |
1269 | @@ -1328,7 +1344,7 @@ |
1270 | if(string.Equals(_cursor.Uri, interpretation)) |
1271 | return _cursor; |
1272 | |
1273 | - return new NameUri(); |
1274 | + return null; |
1275 | } |
1276 | |
1277 | #region Private Fields |
1278 | @@ -1395,7 +1411,7 @@ |
1279 | if(string.Equals(_tv_show.Uri, interpretation)) |
1280 | return _tv_show; |
1281 | |
1282 | - return new NameUri(); |
1283 | + return null; |
1284 | } |
1285 | |
1286 | #region Private Fields |
1287 | @@ -1451,7 +1467,7 @@ |
1288 | if(string.Equals(_music_album.Uri, interpretation)) |
1289 | return _music_album; |
1290 | |
1291 | - return new NameUri(); |
1292 | + return null; |
1293 | } |
1294 | |
1295 | #region Private Fields |
1296 | @@ -1522,7 +1538,7 @@ |
1297 | if(string.Equals(_im_message.Uri, interpretation)) |
1298 | return _im_message; |
1299 | |
1300 | - return new NameUri(); |
1301 | + return null; |
1302 | } |
1303 | |
1304 | #region Private Fields |
1305 | @@ -1595,7 +1611,7 @@ |
1306 | if(string.Equals(_os.Uri, interpretation)) |
1307 | return _os; |
1308 | |
1309 | - return new NameUri(); |
1310 | + return null; |
1311 | } |
1312 | |
1313 | #region Private Fields |
1314 | |
1315 | === modified file 'Zeitgeist/Datamodel/Manifestation.cs' |
1316 | --- Zeitgeist/Datamodel/Manifestation.cs 2010-10-02 05:20:40 +0000 |
1317 | +++ Zeitgeist/Datamodel/Manifestation.cs 2010-10-07 15:32:44 +0000 |
1318 | @@ -157,11 +157,11 @@ |
1319 | return _cal_data_obj; |
1320 | |
1321 | NameUri event_manifestation = _event_manifestation.Search(manifestation); |
1322 | - if(event_manifestation.Name != null) |
1323 | + if(event_manifestation != null) |
1324 | return event_manifestation; |
1325 | |
1326 | NameUri file_data_obj = _file_data_obj.Search(manifestation); |
1327 | - if(file_data_obj.Name != null) |
1328 | + if(file_data_obj != null) |
1329 | return file_data_obj; |
1330 | |
1331 | if(string.Equals(_hd_partition.Uri, manifestation)) |
1332 | @@ -182,7 +182,7 @@ |
1333 | if(string.Equals(_sw_service.Uri, manifestation)) |
1334 | return _sw_service; |
1335 | |
1336 | - return new NameUri(); |
1337 | + return new NameUri(ZsUtils.GetStringAnchor(manifestation), manifestation); |
1338 | } |
1339 | |
1340 | #region Private Fields |
1341 | @@ -316,7 +316,7 @@ |
1342 | if(string.Equals(_world_activity.Uri, manifestation)) |
1343 | return _world_activity; |
1344 | |
1345 | - return new NameUri(); |
1346 | + return null; |
1347 | } |
1348 | |
1349 | #region Private Fields |
1350 | @@ -403,13 +403,13 @@ |
1351 | return _deleted_resc; |
1352 | |
1353 | NameUri embedded_file_data_obj = _embedded_file_data_obj.Search(manifestation); |
1354 | - if(embedded_file_data_obj.Name != null) |
1355 | + if(embedded_file_data_obj != null) |
1356 | return embedded_file_data_obj; |
1357 | |
1358 | if(string.Equals(_remote_data_obj.Uri, manifestation)) |
1359 | return _remote_data_obj; |
1360 | |
1361 | - return new NameUri(); |
1362 | + return null; |
1363 | } |
1364 | |
1365 | #region Private Fields |
1366 | @@ -480,7 +480,7 @@ |
1367 | if(string.Equals(_attachment.Uri, manifestation)) |
1368 | return _attachment; |
1369 | |
1370 | - return new NameUri(); |
1371 | + return null; |
1372 | } |
1373 | |
1374 | #region Private Fields |
1375 | |
1376 | === modified file 'Zeitgeist/Datamodel/NameUri.cs' |
1377 | --- Zeitgeist/Datamodel/NameUri.cs 2010-10-02 05:20:40 +0000 |
1378 | +++ Zeitgeist/Datamodel/NameUri.cs 2010-10-07 15:32:44 +0000 |
1379 | @@ -12,6 +12,8 @@ |
1380 | { |
1381 | public NameUri() |
1382 | { |
1383 | + Name = string.Empty; |
1384 | + Uri = string.Empty; |
1385 | } |
1386 | |
1387 | public NameUri(string name, string uri) |
1388 | |
1389 | === modified file 'Zeitgeist/Datamodel/Subject.cs' |
1390 | --- Zeitgeist/Datamodel/Subject.cs 2010-10-02 05:20:40 +0000 |
1391 | +++ Zeitgeist/Datamodel/Subject.cs 2010-10-07 15:32:44 +0000 |
1392 | @@ -6,8 +6,19 @@ |
1393 | /// <summary> |
1394 | /// Represents a subject of an Event |
1395 | /// </summary> |
1396 | - public struct Subject |
1397 | + public class Subject |
1398 | { |
1399 | + public Subject() |
1400 | + { |
1401 | + Uri = string.Empty; |
1402 | + Origin = string.Empty; |
1403 | + MimeType = string.Empty; |
1404 | + Text = string.Empty; |
1405 | + Storage = string.Empty; |
1406 | + Interpretation = new NameUri(); |
1407 | + Manifestation = new NameUri(); |
1408 | + } |
1409 | + |
1410 | /// <summary> |
1411 | /// URI of the subject |
1412 | /// </summary> |
1413 | |
1414 | === modified file 'Zeitgeist/Datamodel/TimeRange.cs' |
1415 | --- Zeitgeist/Datamodel/TimeRange.cs 2010-10-01 18:15:46 +0000 |
1416 | +++ Zeitgeist/Datamodel/TimeRange.cs 2010-10-07 15:32:44 +0000 |
1417 | @@ -5,40 +5,44 @@ |
1418 | /// <summary> |
1419 | /// The type which deals with Start and End time for an event. |
1420 | /// </summary> |
1421 | - public struct TimeRange |
1422 | + public class TimeRange |
1423 | { |
1424 | - public TimeRange(DateTime startTime, DateTime endTime) |
1425 | - { |
1426 | - _begin = startTime; |
1427 | - _end = endTime; |
1428 | + public TimeRange() |
1429 | + { |
1430 | + } |
1431 | + |
1432 | + public TimeRange(Int64 startTime, Int64 endTime) |
1433 | + { |
1434 | + _begin = ZsUtils.ToDateTime((ulong)startTime); |
1435 | + _end = ZsUtils.ToDateTime((ulong)endTime); |
1436 | } |
1437 | /// <summary> |
1438 | /// The begin Timestamp of the event. Seconds elapsed since Epoch |
1439 | /// </summary> |
1440 | - public Int64 Begin |
1441 | + public DateTime Begin |
1442 | { |
1443 | get |
1444 | { |
1445 | - return (Int64)ZsUtils.ToTimestamp(_begin); |
1446 | + return _begin; |
1447 | } |
1448 | set |
1449 | { |
1450 | - _begin = ZsUtils.ToDateTime((ulong)value); |
1451 | + _begin = value; |
1452 | } |
1453 | } |
1454 | |
1455 | /// <summary> |
1456 | /// The end Timestamp of the event. Seconds elapsed since Epoch |
1457 | /// </summary> |
1458 | - public Int64 End |
1459 | + public DateTime End |
1460 | { |
1461 | get |
1462 | { |
1463 | - return (Int64)ZsUtils.ToTimestamp(_end); |
1464 | + return _end; |
1465 | } |
1466 | set |
1467 | { |
1468 | - _end = ZsUtils.ToDateTime((ulong)value); |
1469 | + _end = value; |
1470 | } |
1471 | } |
1472 | |
1473 | @@ -50,5 +54,40 @@ |
1474 | |
1475 | #endregion |
1476 | } |
1477 | + |
1478 | + internal class RawTimeRange |
1479 | + { |
1480 | + public Int64 Begin |
1481 | + { |
1482 | + get |
1483 | + { |
1484 | + return _begin; |
1485 | + } |
1486 | + set |
1487 | + { |
1488 | + _begin = value; |
1489 | + } |
1490 | + } |
1491 | + |
1492 | + public Int64 End |
1493 | + { |
1494 | + get |
1495 | + { |
1496 | + return _end; |
1497 | + } |
1498 | + set |
1499 | + { |
1500 | + _end = value; |
1501 | + } |
1502 | + } |
1503 | + |
1504 | + #region Private Fields |
1505 | + |
1506 | + public Int64 _begin; |
1507 | + |
1508 | + public Int64 _end; |
1509 | + |
1510 | + #endregion |
1511 | + } |
1512 | } |
1513 | |
1514 | |
1515 | === modified file 'Zeitgeist/LogClient.cs' |
1516 | --- Zeitgeist/LogClient.cs 2010-09-10 22:14:30 +0000 |
1517 | +++ Zeitgeist/LogClient.cs 2010-10-07 15:32:44 +0000 |
1518 | @@ -73,6 +73,7 @@ |
1519 | |
1520 | /// <summary> |
1521 | /// Delete a set of events from the log given their IDs |
1522 | + /// If all the Event ID provided does not exist, then null is returned |
1523 | /// </summary> |
1524 | /// <param name="eventIds"> |
1525 | /// The eventId (of type <see cref="T:System.Collection.Generic.List{System.UInt32}"/> ) of the Events to be deleted |
1526 | @@ -82,7 +83,12 @@ |
1527 | /// </returns> |
1528 | public TimeRange DeleteEvents(List<uint> eventIds) |
1529 | { |
1530 | - return srcInterface.DeleteEvents(eventIds.ToArray()); |
1531 | + RawTimeRange rawRange = srcInterface.DeleteEvents(eventIds.ToArray()); |
1532 | + |
1533 | + if(rawRange.Begin < 0 && rawRange.End < 0) |
1534 | + return null; |
1535 | + else |
1536 | + return new TimeRange(rawRange.Begin, rawRange.End); |
1537 | } |
1538 | |
1539 | #endregion |
1540 | @@ -127,7 +133,11 @@ |
1541 | { |
1542 | RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(eventTemplates).ToArray(); |
1543 | |
1544 | - UInt32[] eventIds = srcInterface.FindEventIds(range, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1545 | + RawTimeRange rawRange = new RawTimeRange(); |
1546 | + rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin); |
1547 | + rawRange.End = (long)ZsUtils.ToTimestamp(range.End); |
1548 | + |
1549 | + UInt32[] eventIds = srcInterface.FindEventIds(rawRange, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1550 | |
1551 | return new List<uint>(eventIds); |
1552 | } |
1553 | @@ -164,7 +174,11 @@ |
1554 | { |
1555 | RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(eventTemplates).ToArray(); |
1556 | |
1557 | - RawEvent[] events = srcInterface.FindEvents(range, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1558 | + RawTimeRange rawRange = new RawTimeRange(); |
1559 | + rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin); |
1560 | + rawRange.End = (long)ZsUtils.ToTimestamp(range.End); |
1561 | + |
1562 | + RawEvent[] events = srcInterface.FindEvents(rawRange, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1563 | |
1564 | return ZsUtils.FromRawEventList(events); |
1565 | } |
1566 | @@ -202,7 +216,11 @@ |
1567 | RawEvent[] rawEvents = ZsUtils.ToRawEventList(eventTemplates).ToArray(); |
1568 | RawEvent[] rawEventTemplates = ZsUtils.ToRawEventList(resultEventTemplates).ToArray(); |
1569 | |
1570 | - string[] uris = srcInterface.FindRelatedUris(range, rawEvents, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1571 | + RawTimeRange rawRange = new RawTimeRange(); |
1572 | + rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin); |
1573 | + rawRange.End = (long)ZsUtils.ToTimestamp(range.End); |
1574 | + |
1575 | + string[] uris = srcInterface.FindRelatedUris(rawRange, rawEvents, rawEventTemplates, (uint)state, maxEvents, (uint) resType); |
1576 | |
1577 | return new List<string>(uris); |
1578 | } |
1579 | @@ -224,11 +242,16 @@ |
1580 | /// Event templates <see cref="T:System.Collection.Generic.List{Zeitgeist.Datamodel.Event}"/> that events must match in order to trigger the monitor |
1581 | /// </param> |
1582 | public void InstallMonitor(string monitorPath, TimeRange range, List<Event> eventTemplates) |
1583 | - { srcInterface = ZsUtils.GetDBusObject<ILog>(objectPath); |
1584 | + { |
1585 | + srcInterface = ZsUtils.GetDBusObject<ILog>(objectPath); |
1586 | + |
1587 | + RawTimeRange rawRange = new RawTimeRange(); |
1588 | + rawRange.Begin = (long)ZsUtils.ToTimestamp(range.Begin); |
1589 | + rawRange.End = (long)ZsUtils.ToTimestamp(range.End); |
1590 | |
1591 | ObjectPath path = new ObjectPath(monitorPath); |
1592 | List<RawEvent> rawEvents = ZsUtils.ToRawEventList(eventTemplates); |
1593 | - srcInterface.InstallMonitor(path, range, rawEvents.ToArray()); |
1594 | + srcInterface.InstallMonitor(path, rawRange, rawEvents.ToArray()); |
1595 | } |
1596 | |
1597 | /// <summary> |
1598 | |
1599 | === modified file 'Zeitgeist/Zeitgeist.csproj' |
1600 | --- Zeitgeist/Zeitgeist.csproj 2010-10-05 21:28:08 +0000 |
1601 | +++ Zeitgeist/Zeitgeist.csproj 2010-10-07 15:32:44 +0000 |
1602 | @@ -41,7 +41,6 @@ |
1603 | </Reference> |
1604 | </ItemGroup> |
1605 | <ItemGroup> |
1606 | - <Compile Include="AssemblyInfo.cs" /> |
1607 | <Compile Include="Datamodel\Event.cs" /> |
1608 | <Compile Include="Datamodel\Subject.cs" /> |
1609 | <Compile Include="Datamodel\ResultType.cs" /> |
1610 | |
1611 | === modified file 'Zeitgeist/ZsUtils.cs' |
1612 | --- Zeitgeist/ZsUtils.cs 2010-10-02 05:20:40 +0000 |
1613 | +++ Zeitgeist/ZsUtils.cs 2010-10-07 15:32:44 +0000 |
1614 | @@ -190,8 +190,17 @@ |
1615 | |
1616 | return interfaceInst; |
1617 | } |
1618 | + |
1619 | + public static string GetStringAnchor(string str) |
1620 | + { |
1621 | + if(str != null) |
1622 | + { |
1623 | + int pos = str.IndexOf('#'); |
1624 | + return str.Substring(pos+1); |
1625 | + } |
1626 | + else |
1627 | + return null; |
1628 | + } |
1629 | } |
1630 | - |
1631 | - |
1632 | } |
1633 |
Cosmetic issues:
Empty Test.cs file
Serious issues: Datamodel/ Event.cs
in Zeitgeist/
1057 - private string[] _metadata;
1058 - private string[][] _subjects;
1059 - private byte[] _payload;
1060 + public string[] _metadata;
1061 + public string[][] _subjects;
1062 + public byte[] _payload;
Those fields would not be exposed in this way! Re-check if you need to expose those fields, if so add properties for them. Are they only needed for test-cases? That needs special handling then (internal accessor).
in Zeitgeist/ Datamodel/ TimeRange. cs
1492 + public Int64 _begin;
1493 +
1494 + public Int64 _end;
Fields should never be public, as there are public properties I guess this is a typo.
Unsure: Datamodel/ Subject. cs:
in Zeitgeist/
1385 + public Subject()
1386 + {
1387 + Uri = string.Empty;
1388 + Origin = string.Empty;
1389 + MimeType = string.Empty;
1390 + Text = string.Empty;
1391 + Storage = string.Empty;
1392 + Interpretation = new NameUri();
1393 + Manifestation = new NameUri();
1394 + }
Is the D-Bus API / Zeitgeist expecting empty strings in the case of "unset" / unspecified values? Because this is bad coding style to simply pre-init all fields for no good reason.