~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to test/Tags/ServiceTagTest/.svn/text-base/ServiceTagTest.cs.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using System.Collections;
3
 
using System.Runtime;
4
 
using System.IO;
5
 
using System.Threading;
6
 
 
7
 
using Simias;
8
 
using Simias.Service;
9
 
using Simias.Storage;
10
 
using Simias.Tags;
11
 
 
12
 
namespace ServiceTagTest
13
 
{
14
 
        /// <summary>
15
 
        /// Simias tag testing
16
 
        /// </summary>
17
 
        public class Service : IThreadService
18
 
        {
19
 
                #region Class Members
20
 
                /// <summary>
21
 
                /// Used to log messages.
22
 
                /// </summary>
23
 
                private static readonly ISimiasLog log = 
24
 
                        SimiasLogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType );
25
 
 
26
 
                private AutoResetEvent testEvent = null;
27
 
                private Thread testThread = null;
28
 
 
29
 
                #endregion
30
 
 
31
 
                #region Constructor
32
 
                /// <summary>
33
 
                /// Initializes a new instance of the object class.
34
 
                /// </summary>
35
 
                public Service()
36
 
                {
37
 
                }
38
 
                #endregion
39
 
 
40
 
                #region IThreadService Members
41
 
                /// <summary>
42
 
                /// Starts the thread service.
43
 
                /// </summary>
44
 
                /// <param name="config">
45
 
                /// Configuration file object for the configured store 
46
 
                /// Store to use.
47
 
                /// </param>
48
 
                // public void Start( Configuration config )
49
 
                public void Start()
50
 
                {
51
 
                        log.Debug( "Start called" );
52
 
 
53
 
                        try
54
 
                        {
55
 
                                StartTestThread();
56
 
                        }
57
 
                        catch(Exception e)
58
 
                        {
59
 
                                log.Error( e.Message );
60
 
                                log.Error( e.StackTrace );
61
 
                        }
62
 
                }
63
 
 
64
 
                /// <summary>
65
 
                /// Resumes a paused service. 
66
 
                /// </summary>
67
 
                public void Resume()
68
 
                {
69
 
                }
70
 
 
71
 
                /// <summary>
72
 
                /// Pauses a service's execution.
73
 
                /// </summary>
74
 
                public void Pause()
75
 
                {
76
 
                }
77
 
 
78
 
                /// <summary>
79
 
                /// Custom.
80
 
                /// </summary>
81
 
                /// <param name="message"></param>
82
 
                /// <param name="data"></param>
83
 
                public int Custom(int message, string data)
84
 
                {
85
 
                        return 0;
86
 
                }
87
 
 
88
 
                /// <summary>
89
 
                /// Stops the service from executing.
90
 
                /// </summary>
91
 
                public void Stop()
92
 
                {
93
 
                        log.Debug( "Stop called" );
94
 
                        //StopTestThread();
95
 
                }
96
 
                #endregion
97
 
 
98
 
                #region Private Methods
99
 
                internal int StartTestThread()
100
 
                {
101
 
                        int status = 0;
102
 
 
103
 
                        try
104
 
                        {
105
 
                                testEvent = new AutoResetEvent( false );
106
 
                                testThread = new Thread( new ThreadStart( TestThread ) );
107
 
                                testThread.IsBackground = true;
108
 
                                testThread.Start();
109
 
                        }
110
 
                        catch( SimiasException e )
111
 
                        {
112
 
                                log.Error( e.Message );
113
 
                                log.Error( e.StackTrace );
114
 
                                status = -1;
115
 
                        }
116
 
 
117
 
                        return status;
118
 
                }
119
 
 
120
 
                private void TestThread()
121
 
                {
122
 
                        int testsPassed = 0;
123
 
                        int testsFailed = 0;
124
 
 
125
 
                        log.Debug( "Waiting a bit before we start the tests!" );
126
 
                        testEvent.WaitOne( 30000, false );
127
 
                        log.Debug( "Starting tag tests" );
128
 
 
129
 
                        if ( this.TestOne() == true )
130
 
                        {
131
 
                                testsPassed++;
132
 
                        }
133
 
                        else
134
 
                        {
135
 
                                testsFailed++;
136
 
                        }
137
 
 
138
 
                        if ( this.TestTwo() == true )
139
 
                        {
140
 
                                testsPassed++;
141
 
                        }
142
 
                        else
143
 
                        {
144
 
                                testsFailed++;
145
 
                        }
146
 
 
147
 
                        if ( this.TestThree() == true )
148
 
                        {
149
 
                                testsPassed++;
150
 
                        }
151
 
                        else
152
 
                        {
153
 
                                testsFailed++;
154
 
                        }
155
 
 
156
 
                        if ( this.TestFour() == true )
157
 
                        {
158
 
                                testsPassed++;
159
 
                        }
160
 
                        else
161
 
                        {
162
 
                                testsFailed++;
163
 
                        }
164
 
 
165
 
                        if ( this.TestFive() == true )
166
 
                        {
167
 
                                testsPassed++;
168
 
                        }
169
 
                        else
170
 
                        {
171
 
                                testsFailed++;
172
 
                        }
173
 
 
174
 
                        if ( this.TestSix() == true )
175
 
                        {
176
 
                                testsPassed++;
177
 
                        }
178
 
                        else
179
 
                        {
180
 
                                testsFailed++;
181
 
                        }
182
 
 
183
 
                        if ( this.TestSeven() == true )
184
 
                        {
185
 
                                testsPassed++;
186
 
                        }
187
 
                        else
188
 
                        {
189
 
                                testsFailed++;
190
 
                        }
191
 
 
192
 
                        log.Debug( "  Test Results" );
193
 
                        log.Debug( "    Passed: " + testsPassed.ToString() );
194
 
                        log.Debug( "    Failed: " + testsFailed.ToString() );
195
 
 
196
 
                        log.Debug( "Tests finished" );
197
 
                }
198
 
 
199
 
                private bool TestOne()
200
 
                {
201
 
                        bool passed = true;
202
 
                        log.Debug( "Starting TestOne" );
203
 
                        Store store = Store.GetStore();
204
 
                        Domain domain = store.GetDomain( store.LocalDomain );
205
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
206
 
 
207
 
                        log.Debug( "  creating two tags in the default domain" );
208
 
                        Tag greenTag = new Tag( "Green" );
209
 
                        Tag redTag = new Tag( "Red" );
210
 
 
211
 
                        try
212
 
                        {
213
 
                                greenTag.Add( domain.ID );
214
 
                                redTag.Add( domain.ID );
215
 
                        }
216
 
                        catch
217
 
                        {
218
 
                                passed = false;
219
 
                        }
220
 
 
221
 
                        log.Debug( "  querying for all tags on the default domain" );
222
 
                        ICSList tagList = Simias.Tags.Query.Tags( domain );
223
 
                        if ( tagList.Count >= 2 )
224
 
                        {
225
 
                                foreach( ShallowNode sn in tagList )
226
 
                                {
227
 
                                        Tag tag = new Tag( sn );
228
 
                                        log.Debug( "  Tag: " + tag.Name );
229
 
                                }
230
 
                        }
231
 
                        else
232
 
                        {
233
 
                                passed = false;
234
 
                        }
235
 
                
236
 
                        Node[] nodes = new Node[3];
237
 
                        log.Debug( "  creating three generic nodes" );
238
 
                        nodes[0] = new Node( "Node1" );
239
 
                        nodes[1] = new Node( "Node2" );
240
 
                        nodes[2] = new Node( "Node3" );
241
 
                        domain.Commit( nodes );
242
 
 
243
 
                        log.Debug( "  adding the green tag to node1" );
244
 
                        greenTag.TagNode( domain.ID, nodes[0] );
245
 
                        log.Debug( "  query for all nodes with the green tag - should find 1 node" );
246
 
                        ICSList results = Simias.Tags.Query.Nodes( domain.ID, greenTag );
247
 
                        log.Debug( "  found: " + results.Count.ToString() + " tag(s)" );
248
 
                        if ( results.Count == 1 )
249
 
                        {
250
 
                                foreach( ShallowNode sn in results )
251
 
                                {
252
 
                                        log.Debug( "  Node: " + sn.Name );
253
 
                                }
254
 
                        }
255
 
                        else
256
 
                        {
257
 
                                passed = false;
258
 
                        }
259
 
 
260
 
                        log.Debug( "  adding red tag to node2" );
261
 
                        redTag.TagNode( domain.ID, nodes[1] );
262
 
 
263
 
                        log.Debug( "  query for all nodes with the red and green tag - " );
264
 
                        log.Debug( "  should find two nodes" );
265
 
                        Simias.Tags.Query query = new Simias.Tags.Query( domain.ID );
266
 
                        query.AddTag( greenTag );
267
 
                        query.AddTag( redTag );
268
 
                        ICSList results2 = query.QueryNodes();
269
 
                        if ( results2.Count == 2 )
270
 
                        {
271
 
                                foreach( ShallowNode sn in results2 )
272
 
                                {
273
 
                                        log.Debug( "  Node: " + sn.Name );
274
 
                                }
275
 
                        }
276
 
                        else
277
 
                        {
278
 
                                passed = false;
279
 
                        }
280
 
 
281
 
                        log.Debug( "  adding red tag to node3" );
282
 
                        redTag.TagNode( domain.ID, nodes[2] );
283
 
 
284
 
                        log.Debug( "  query for all nodes with the red and green tag - should find 3 nodes" );
285
 
                        ICSList results3 = query.QueryNodes();
286
 
                        if ( results3.Count == 3 )
287
 
                        {
288
 
                                foreach( ShallowNode sn in results3 )
289
 
                                {
290
 
                                        log.Debug( "  Node: " + sn.Name );
291
 
                                }
292
 
                        }
293
 
                        else
294
 
                        {
295
 
                                passed = false;
296
 
                        }
297
 
 
298
 
                        log.Debug( "  cleaning up nodes and tags" );
299
 
                        domain.Commit( domain.Delete( nodes ) );
300
 
                        greenTag.Remove( domain.ID );
301
 
                        redTag.Remove( domain.ID );
302
 
 
303
 
                        log.Debug( "TestOne finished\n" );
304
 
                        return passed;
305
 
                }
306
 
 
307
 
                private bool TestTwo()
308
 
                {
309
 
                        bool passed = true;
310
 
                        log.Debug( "Starting TestTwo" );
311
 
                        Store store = Store.GetStore();
312
 
                        Domain domain = store.GetDomain( store.LocalDomain );
313
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
314
 
 
315
 
                        log.Debug( "  creating two tags in the default domain" );
316
 
                        Tag purpleTag = new Tag( "Purple" );
317
 
                        purpleTag.Add( domain.ID );
318
 
 
319
 
                        Tag whiteTag = new Tag( "White" );
320
 
                        whiteTag.Add( domain.ID );
321
 
 
322
 
                        // Can I read the tag back
323
 
                        Node whiteNode = domain.GetNodeByID( whiteTag.ID );
324
 
                        if ( whiteNode == null )
325
 
                        {
326
 
                                log.Debug( "  nope couldn't read the white tag" );
327
 
                        }
328
 
 
329
 
                        Node[] nodes = new Node[500];
330
 
                        log.Debug( "  creating five hundred generic nodes" );
331
 
 
332
 
                        // Cleanup any stragglers
333
 
                        for( int i = 0; i < 500; i++ )
334
 
                        {
335
 
                                Node node = domain.GetSingleNodeByName( "Node" + i.ToString() );
336
 
                                if ( node != null )
337
 
                                {
338
 
                                        domain.Commit( domain.Delete( node ) );
339
 
                                }
340
 
                        }
341
 
 
342
 
                        for( int i = 0; i < 500; i++ )
343
 
                        {
344
 
                                nodes[i] = new Node( "Node" + i.ToString() );
345
 
                        }
346
 
 
347
 
                        domain.Commit( nodes );
348
 
 
349
 
                        // Add purple to the first half
350
 
                        log.Debug( "  adding the purple tag to half the nodes" );
351
 
                        for( int i = 0; i < 250; i++ )
352
 
                        {
353
 
                                purpleTag.TagNode( domain.ID, nodes[i] );
354
 
                        }
355
 
 
356
 
                        log.Debug( "  adding the white tag to the last two nodes" );
357
 
                        whiteTag.TagNode( domain.ID, nodes[498] );
358
 
                        whiteTag.TagNode( domain.ID, nodes[499] );
359
 
 
360
 
                        log.Debug( "  query for all nodes with the purple tag - should find 250 nodes" );
361
 
                        ICSList results = Simias.Tags.Query.Nodes( domain.ID, purpleTag );
362
 
                        log.Debug( "  found: " + results.Count.ToString() );
363
 
                        foreach( ShallowNode sn in results )
364
 
                        {
365
 
                                log.Debug( "  Node: " + sn.Name );
366
 
                        }
367
 
 
368
 
                        log.Debug( "  query for all purple and white nodes - should find 252 nodes" );
369
 
                        Simias.Tags.Query query = new Simias.Tags.Query( domain.ID );
370
 
                        query.AddTag( whiteTag );
371
 
                        query.AddTag( purpleTag );
372
 
                        ICSList results2 = query.QueryNodes();
373
 
                        log.Debug( "  Found: " + results2.Count.ToString() );
374
 
                        foreach( ShallowNode sn in results2 )
375
 
                        {
376
 
                                log.Debug( "  Node: " + sn.Name );
377
 
                        }
378
 
 
379
 
                        log.Debug( "  cleaning up nodes and tags" );
380
 
                        domain.Commit( domain.Delete( nodes ) );
381
 
                        
382
 
                        purpleTag.Remove( domain.ID );
383
 
                        whiteTag.Remove( domain.ID );
384
 
 
385
 
                        log.Debug( "TestTwo finished\n" );
386
 
                        return passed;
387
 
                }
388
 
 
389
 
                private bool TestThree()
390
 
                {
391
 
                        bool passed = true;
392
 
                        log.Debug( "Starting TestThree" );
393
 
                        log.Debug( "Create a tag and a node and leave them in the store" );
394
 
 
395
 
                        Store store = Store.GetStore();
396
 
                        Domain domain = store.GetDomain( store.LocalDomain );
397
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
398
 
 
399
 
                        log.Debug( "  creating \"ThreeTag\" in the default domain" );
400
 
                        Tag threeTag = new Tag( "ThreeTag" );
401
 
                        try
402
 
                        {
403
 
                                threeTag.Add( domain.ID );
404
 
                        }
405
 
                        catch( ExistsException e )
406
 
                        {
407
 
                                log.Debug( "  ThreeTag already exists in the tags library" );
408
 
                        }
409
 
 
410
 
                        log.Debug( "  creating ThreeNode" );
411
 
                        Node threeNode = domain.GetSingleNodeByName( "ThreeNode" );
412
 
                        if ( threeNode == null )
413
 
                        {
414
 
                                threeNode = new Node( "ThreeNode" );
415
 
                                domain.Commit( threeNode );
416
 
                                threeTag.TagNode( domain.ID, threeNode );
417
 
                        }
418
 
                        log.Debug( "Finished TestThree\n" );
419
 
                        return passed;
420
 
                }
421
 
 
422
 
                private bool TestFour()
423
 
                {
424
 
                        bool passed = true;
425
 
                        log.Debug( "Starting TestFour" );
426
 
                        log.Debug( "Create a tag and then attempt to create the same tag again" );
427
 
 
428
 
                        Store store = Store.GetStore();
429
 
                        Domain domain = store.GetDomain( store.LocalDomain );
430
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
431
 
 
432
 
                        log.Debug( "  creating \"DuplicateTag\" in the default domain" );
433
 
                        Tag dupTag = new Tag( "DuplicateTag" );
434
 
                        try
435
 
                        {
436
 
                                dupTag.Add( domain.ID );
437
 
                        }
438
 
                        catch
439
 
                        {
440
 
                                log.Debug( "  failed creating tag" );
441
 
                                passed = false;
442
 
                        }
443
 
 
444
 
                        log.Debug( "  attempting to duplicate the same tag" );
445
 
                        Tag dup2Tag = new Tag( "DuplicateTag" );
446
 
                        try
447
 
                        {
448
 
                                dup2Tag.Add( domain.ID );
449
 
                                log.Debug( "  an \"ExistsException\" should have been thrown" );
450
 
                                passed = false;
451
 
                        }
452
 
                        catch( ExistsException e )
453
 
                        {
454
 
                                log.Debug( "  caught expected \"ExistsException\"" );
455
 
                        }
456
 
                        catch( Exception e2 )
457
 
                        {
458
 
                                log.Debug( "  An unexpected exception was caught" );
459
 
                                passed = false;
460
 
                        }
461
 
 
462
 
                        dupTag.Remove( domain.ID );
463
 
 
464
 
                        //domain.Commit( domain.Delete( dupTag ) );
465
 
                        log.Debug( "Finished TestFour\n" );
466
 
                        return passed;
467
 
                }
468
 
 
469
 
                private bool TestFive()
470
 
                {
471
 
                        bool passed = true;
472
 
                        log.Debug( "Starting TestFive" );
473
 
                        log.Debug( "Create two tags, assign them to a node then delete one of the tags and verify it was deleted from the node" );
474
 
 
475
 
                        Store store = Store.GetStore();
476
 
                        Domain domain = store.GetDomain( store.LocalDomain );
477
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
478
 
 
479
 
                        Tag tagFiveOne = new Tag( "TestFiveTagOne" );
480
 
                        Tag tagFiveTwo = new Tag( "TestFiveTagTwo" );
481
 
 
482
 
                        try
483
 
                        {
484
 
                                log.Debug( "  creating \"TestFiveTagOne\" in the default domain" );
485
 
                                tagFiveOne.Add( domain.ID );
486
 
                        }
487
 
                        catch
488
 
                        {
489
 
                                passed = false;
490
 
                                log.Debug( "  failed creating TestFiveTagOne" );
491
 
                        }
492
 
 
493
 
                        log.Debug( "  creating \"TestFiveTagTwo\" in the default domain" );
494
 
                        try
495
 
                        {
496
 
                                tagFiveTwo.Add( domain.ID );
497
 
                        }
498
 
                        catch( ExistsException e )
499
 
                        {
500
 
                                passed = false;
501
 
                                log.Debug( "  failed creating TestFiveTagTwo with ExistsException" );
502
 
                        }
503
 
                        catch
504
 
                        {
505
 
                                passed = false;
506
 
                                log.Debug( "  failed creating TestFiveTagTwo with an unknown exception" );
507
 
                        }
508
 
 
509
 
                        log.Debug( "  creating TestFiveNode" );
510
 
                        Node testFiveNode = new Node( "TestFiveNode" );
511
 
                        domain.Commit( testFiveNode );
512
 
 
513
 
                        try
514
 
                        {
515
 
                                log.Debug( "  tagging TestFiveNode with \"TestFiveTagOne\" and \"TestFiveTagTwo\"" );
516
 
                                tagFiveOne.TagNode( domain.ID, testFiveNode );
517
 
                                tagFiveTwo.TagNode( domain.ID, testFiveNode );
518
 
                        }
519
 
                        catch
520
 
                        {
521
 
                                log.Debug( "  failed tagging node" );
522
 
                                passed = false;
523
 
                        }
524
 
                        
525
 
                        try
526
 
                        {
527
 
                                log.Debug( "  deleting tag: \"TestFiveTagTwo\"" );
528
 
                                tagFiveTwo.Remove( domain.ID );
529
 
                        }
530
 
                        catch
531
 
                        {
532
 
                                log.Debug( "  failed removing TestFiveTagTwo from the library" );
533
 
                                passed = false;
534
 
                        }
535
 
 
536
 
                        log.Debug( "  deleting node: " + testFiveNode.Name );
537
 
                        domain.Commit( domain.Delete( testFiveNode ) );
538
 
 
539
 
                        try
540
 
                        {
541
 
                                log.Debug( "  deleting tag: " + tagFiveOne.Name );
542
 
                                tagFiveOne.Remove( domain.ID );
543
 
                        }
544
 
                        catch
545
 
                        {
546
 
                                log.Debug( "  failed removing TestFiveTagOne from the library" );
547
 
                                passed = false;
548
 
                        }
549
 
 
550
 
                        log.Debug( "Finished TestFive\n" );
551
 
                        return passed;
552
 
                }
553
 
 
554
 
                private bool TestSix()
555
 
                {
556
 
                        bool passed = true;
557
 
                        int numberTags = 1000;
558
 
 
559
 
                        log.Debug( "Starting TestSix" );
560
 
                        log.Debug( "Create " + numberTags.ToString() + " tags, issue a query to retrieve them, then verify them" );
561
 
 
562
 
                        Store store = Store.GetStore();
563
 
                        Domain domain = store.GetDomain( store.LocalDomain );
564
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
565
 
 
566
 
                        Hashtable tagTable = new Hashtable( numberTags );
567
 
                        Tag[] tags = new Tag[ numberTags ];
568
 
                        log.Debug( "  creating " + numberTags.ToString() + " tags." );
569
 
                        for( int i = 0; i < numberTags; i++)
570
 
                        {
571
 
                                tags[i] = new Tag( "TestSixTag" + i.ToString() );
572
 
                                tagTable.Add( tags[i].Name, tags[i] );
573
 
                        }
574
 
 
575
 
                        try 
576
 
                        {
577
 
                                Simias.Tags.Tag.Add( domain, tags );
578
 
                        }
579
 
                        catch( Exception e )
580
 
                        {
581
 
                                log.Debug( "  failed to create all tags!" );
582
 
                                passed = false;
583
 
                        }
584
 
 
585
 
                        if ( passed == true )
586
 
                        {
587
 
                                int verified = 0;
588
 
                                ICSList results = Simias.Tags.Query.Tags( domain );
589
 
                                if ( results.Count > 0 )
590
 
                                {
591
 
                                        foreach( ShallowNode sn in results )
592
 
                                        {
593
 
                                                if ( tagTable.Contains( sn.Name ) == true )
594
 
                                                {
595
 
                                                        verified++;
596
 
                                                }
597
 
                                        }
598
 
                                }
599
 
 
600
 
                                if ( verified == numberTags )
601
 
                                {
602
 
                                        log.Debug( "  verified all " + verified.ToString() + " tags." );
603
 
                                }
604
 
                                else
605
 
                                {
606
 
                                        log.Debug( "  failed verifying all the tags.  verified: " + verified.ToString() + " of the " + numberTags.ToString() + " created" );
607
 
                                        passed = false;
608
 
                                }
609
 
                        }
610
 
 
611
 
                        // Remove all the previously created tags
612
 
                        log.Debug( "  removing tags from the collection" );
613
 
                        Simias.Tags.Tag.Remove( domain, tags );
614
 
                        log.Debug( "Finished TestSix\n" );
615
 
                        return passed;
616
 
                }
617
 
 
618
 
                private bool TestSeven()
619
 
                {
620
 
                        bool passed = true;
621
 
                        log.Debug( "Starting TestSeven" );
622
 
                        log.Debug( "Test the TagNode and UntagNode methods of the framework" );
623
 
 
624
 
                        Store store = Store.GetStore();
625
 
                        Domain domain = store.GetDomain( store.LocalDomain );
626
 
                        log.Debug( "  retrieved the default domain: " + domain.Name );
627
 
 
628
 
                        Tag tagOne = new Tag( "TestSevenTagOne" );
629
 
                        Tag tagTwo = new Tag( "TestSevenTagTwo" );
630
 
                        try
631
 
                        {
632
 
                                log.Debug( "  creating tag: " + tagOne.Name );
633
 
                                tagOne.Add( domain.ID );
634
 
 
635
 
                                log.Debug( "  creating tag: " + tagTwo.Name );
636
 
                                tagTwo.Add( domain.ID );
637
 
                        }
638
 
                        catch
639
 
                        {
640
 
                                log.Debug( "  failed creating tags" );
641
 
                                passed = false;
642
 
                        }
643
 
 
644
 
                        Node node = new Node( "TestSevenNode" );
645
 
                        log.Debug( "  creating node: " + node.Name );
646
 
                        domain.Commit( node );
647
 
 
648
 
                        try
649
 
                        {
650
 
                                log.Debug( "  tagging node \"" + node.Name + "\" with tag \"" + tagOne.Name + "\"" );
651
 
                                tagOne.TagNode( domain.ID, node );
652
 
 
653
 
                                log.Debug( "  tagging node \"" + node.Name + "\" with tag \"" + tagTwo.Name + "\"" );
654
 
                                tagTwo.TagNode( domain.ID, node );
655
 
 
656
 
                                log.Debug( "  untagging node \"" + node.Name + "\" from tag \"" + tagOne.Name + "\"" );
657
 
                                tagOne.UntagNode( domain.ID, node );
658
 
                        }
659
 
                        catch
660
 
                        {
661
 
                                log.Debug( "  failed tagging/untagging node" );
662
 
                                passed = false;
663
 
                        }
664
 
 
665
 
                        log.Debug( "  deleting nodes and tags" );
666
 
                        domain.Commit( domain.Delete( node ) );
667
 
                        tagOne.Remove( domain.ID );
668
 
                        tagTwo.Remove( domain.ID );
669
 
                        log.Debug( "Finished TestSeven\n" );
670
 
                        return passed;
671
 
                }
672
 
                #endregion
673
 
        }
674
 
}