KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > config > test > InternalNodeTest


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.config.test;
19
20 import junit.extensions.ActiveTestSuite;
21 import junit.framework.Test;
22 import junit.framework.TestCase;
23 import junit.framework.TestSuite;
24
25 import org.sape.carbon.core.config.Config;
26 import org.sape.carbon.core.config.Configuration;
27 import org.sape.carbon.core.config.ConfigurationException;
28 import org.sape.carbon.core.config.ConfigurationNotFoundException;
29 import org.sape.carbon.core.config.format.ConfigurationFormatException;
30 import org.sape.carbon.core.config.format.DefaultConfigurationFormatService;
31 import org.sape.carbon.core.config.node.ConfigurationDocument;
32 import org.sape.carbon.core.config.node.Folder;
33 import org.sape.carbon.core.config.node.NestedConfigurationDocument;
34 import org.sape.carbon.core.config.node.Node;
35 import org.sape.carbon.core.config.node.NodeCreationException;
36 import org.sape.carbon.core.config.node.NodeException;
37 import org.sape.carbon.core.config.node.NodeNotFoundException;
38 import org.sape.carbon.core.config.node.NodeRemovedException;
39 import org.sape.carbon.core.config.node.link.GenericLinkNodeConfiguration;
40 import org.sape.carbon.core.config.node.link.GenericLinkNodeFactory;
41 import org.sape.carbon.core.exception.ExceptionUtility;
42 import org.sape.carbon.core.exception.InvalidParameterException;
43
44 /**
45  * Copyright 2002 Sapient
46  * Template for junit test harness. Change this description to reflect what this class is testing.
47  * @since carbon 1.0
48  * @author Douglas Voet, March 2002
49  * @version $Revision: 1.23 $($Author: dvoet $ / $Date: 2003/11/14 14:15:52 $)
50  */

51 public class InternalNodeTest extends TestCase {
52     protected Folder root;
53
54     public static final String JavaDoc FOLDER_NAME = "foo";
55     public static final String JavaDoc DOCUMENT_NAME = "bar";
56     private static final String JavaDoc NESTED_DOCUMENT_NAME = "splat";
57     private static final String JavaDoc TEST_VALUE = "-|-|-|-";
58     private static String JavaDoc TEST_CONFIG_NAME = "/core/config/test/DeadlockTest";
59     private static String JavaDoc TEST_LINK_NAME = "DeadlockTestLink";
60     private static String JavaDoc TEST_LINK_PARENT_NAME = "/core/config/test";
61     
62     private static Throwable JavaDoc threadFailureCause = null;
63     
64     public InternalNodeTest(String JavaDoc name) {
65         super(name);
66     }
67
68     public void testAddSubFolder() {
69         try {
70             this.root.addSubFolder(FOLDER_NAME);
71         } catch (Exception JavaDoc e) {
72             TestCase.fail(
73                 "Caught exception: "
74                     + ExceptionUtility.printStackTracesToString(e));
75         }
76     }
77
78     public void testAddConfigurationDocument() {
79         try {
80             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
81
82             TestConfiguration testConfig = (TestConfiguration)
83                 Config.getInstance().createConfiguration(TestConfiguration.class);
84
85             subFolder.addConfigurationDocument(DOCUMENT_NAME, testConfig);
86         } catch (NodeException ne) {
87             TestCase.fail(
88                 "Caught unexpected NodeException: "
89                     + ExceptionUtility.printStackTracesToString(ne));
90         }
91     }
92
93     public void testWriteConfiguration() {
94         try {
95             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
96             ConfigurationDocument doc =
97                 (ConfigurationDocument) subFolder.fetchChild(DOCUMENT_NAME);
98
99             DefaultConfigurationFormatService formatService =
100                 new DefaultConfigurationFormatService();
101
102             Configuration config =
103                 formatService.newConfiguration(TestConfiguration.class);
104
105             ((TestConfiguration) config).setTestValue(TEST_VALUE);
106
107             doc.writeConfiguration(config);
108         } catch (NodeException ne) {
109             TestCase.fail(
110                 "Caught unexpected NodeException: "
111                     + ExceptionUtility.printStackTracesToString(ne));
112         } catch (ConfigurationFormatException cfe) {
113             TestCase.fail(
114                 "Caught unexpected "
115                     + "ConfigurationFormatException: "
116                     + ExceptionUtility.printStackTracesToString(cfe));
117         }
118     }
119
120     public void testReadConfiguration() {
121         try {
122             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
123             ConfigurationDocument doc =
124                 (ConfigurationDocument) subFolder.fetchChild(DOCUMENT_NAME);
125
126             TestConfiguration config =
127                 (TestConfiguration) doc.readConfiguration();
128
129             if (!TEST_VALUE.equals(config.getTestValue())) {
130                 TestCase.fail(
131                     "Configuration value not as expected. "
132                         + "Actual: ["
133                         + config.getTestValue()
134                         + "], "
135                         + "Expected: ["
136                         + TEST_VALUE
137                         + "]");
138             }
139         } catch (NodeException ne) {
140             TestCase.fail(
141                 "Caught unexpected NodeException: "
142                     + ExceptionUtility.printStackTracesToString(ne));
143         } catch (ConfigurationFormatException cfe) {
144             TestCase.fail(
145                 "Caught unexpected "
146                     + "ConfigurationFormatException: "
147                     + ExceptionUtility.printStackTracesToString(cfe));
148         }
149     }
150
151     public void testNodeAttributes() {
152         try {
153             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
154             ConfigurationDocument doc =
155                 (ConfigurationDocument) subFolder.fetchChild(DOCUMENT_NAME);
156
157             final String JavaDoc ABSOLUTE_NAME = getTestNodeAttributesAbsoluteName();
158
159             if (!ABSOLUTE_NAME.equals(doc.getAbsoluteName())) {
160                 TestCase.fail(
161                     "Absolute name not as expected. "
162                         + "Actual: ["
163                         + doc.getAbsoluteName()
164                         + "], "
165                         + "Expected: ["
166                         + ABSOLUTE_NAME
167                         + "]");
168             }
169             if (!DOCUMENT_NAME.equals(doc.getName())) {
170                 TestCase.fail(
171                     "Name not as expected. "
172                         + "Actual: ["
173                         + doc.getName()
174                         + "], "
175                         + "Expected: ["
176                         + DOCUMENT_NAME
177                         + "]");
178             }
179             if (doc.getParent() != subFolder) {
180                 TestCase.fail("Reference to parent not as expected.");
181             }
182
183         } catch (NodeException ne) {
184             TestCase.fail(
185                 "Caught unexpected NodeException: "
186                     + ExceptionUtility.printStackTracesToString(ne));
187         }
188     }
189
190     protected String JavaDoc getTestNodeAttributesAbsoluteName() {
191         return "/" + FOLDER_NAME + Node.DELIMITER + DOCUMENT_NAME;
192     }
193
194     public void testFetchChildren() {
195         Folder subFolder = null;
196         try {
197             subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
198             subFolder.addSubFolder(FOLDER_NAME);
199         } catch (NodeException ne) {
200             TestCase.fail("Caught unexpected NodeException: " + ne);
201         }
202
203         Node[] children = subFolder.fetchChildren();
204
205         if (children.length != 2) {
206             TestCase.fail(
207                 "fetchChildren did not return expected number "
208                     + "of children. Expected [2], found ["
209                     + children.length
210                     + "]");
211         }
212
213         if (!((children[0].getName().equals(FOLDER_NAME)
214             && children[1].getName().equals(DOCUMENT_NAME))
215             || (children[0].getName().equals(DOCUMENT_NAME)
216                 && children[1].getName().equals(FOLDER_NAME)))) {
217
218             TestCase.fail("fetchChildren did not return expected children");
219         }
220     }
221
222     public void testAddDuplicateConfigurationDocument() {
223         try {
224             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
225             TestConfiguration testConfig = (TestConfiguration)
226                 Config.getInstance().createConfiguration(TestConfiguration.class);
227             subFolder.addConfigurationDocument(DOCUMENT_NAME, testConfig);
228             TestCase.fail("Did not catch expected NodeCreationException");
229         } catch (NodeNotFoundException nnfe) {
230             TestCase.fail(
231                 "Caught unexpected NodeNotFoundException: "
232                     + ExceptionUtility.printStackTracesToString(nnfe));
233         } catch (NodeCreationException nce) {
234             // expected
235
}
236     }
237
238     public void testAddDuplicateSubFolder() {
239         try {
240             this.root.addSubFolder(FOLDER_NAME);
241             TestCase.fail("Did not catch expected NodeCreationException");
242         } catch (NodeCreationException nce) {
243             // expected
244
}
245     }
246
247     public void testNodeRemoval() {
248         try {
249             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
250             int removedNodes = subFolder.remove();
251
252             assertTrue(
253                 "Unexpected number of nodes removed, expected [4], actual [" +
254                     removedNodes + "]",
255                 removedNodes == 4);
256
257             try {
258                 TestConfiguration testConfig = (TestConfiguration)
259                     Config.getInstance().createConfiguration(TestConfiguration.class);
260                 subFolder.addConfigurationDocument(DOCUMENT_NAME, testConfig);
261                 TestCase.fail("Did not encounter NodeRemovedException");
262             } catch (NodeRemovedException nre) {
263                 // expected
264
}
265
266             try {
267                 subFolder.fetchChild(DOCUMENT_NAME);
268                 TestCase.fail("Did not encounter NodeRemovedException");
269             } catch (NodeRemovedException nre) {
270                 // expected
271
}
272         } catch (NodeException ne) {
273             TestCase.fail(
274                 "Caught unexpected NodeException: "
275                     + ExceptionUtility.printStackTracesToString(ne));
276         }
277     }
278
279     public void testFetchRemovedNode() {
280         try {
281             Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
282
283             TestCase.fail("Did not catch expected NodeNotFoundException");
284         } catch (NodeNotFoundException e) {
285             // expected
286
}
287     }
288
289     public void testNullParameters() {
290         try {
291             try {
292                 this.root.addConfigurationDocument(null, null);
293                 TestCase.fail(
294                     "Did not catch expected NullPointerException "
295                         + "in addConfigurationDocument");
296             } catch (InvalidParameterException ipe) {
297                 // expected
298
}
299             try {
300                 this.root.addSubFolder(null);
301                 TestCase.fail(
302                     "Did not catch expected NullPointerException "
303                         + "in addSubFolder");
304             } catch (InvalidParameterException ipe) {
305                 // expected
306
}
307             try {
308                 this.root.fetchChild(null);
309                 TestCase.fail(
310                     "Did not catch expected InvalidParameterException "
311                         + "in fetchChild");
312             } catch (InvalidParameterException ipe) {
313                 // expected
314
}
315         } catch (NodeException ne) {
316             TestCase.fail(
317                 "caught NodeException when NullPointerException "
318                     + "expected: "
319                     + ExceptionUtility.printStackTracesToString(ne));
320         }
321     }
322
323     public void testLinkFolder() {
324         try {
325             Folder f1 = (Folder) this.root.fetchChild("core");
326             Folder f2 = (Folder) f1.fetchChild("test");
327             // this is the link
328
Folder f3 = (Folder) f2.fetchChild("testFolderLink");
329             ConfigurationDocument doc =
330                 (ConfigurationDocument) f3.fetchChild("TestComponent");
331         } catch (NodeNotFoundException nnfe) {
332             TestCase.fail(
333                 "Caught node not found exception: "
334                     + ExceptionUtility.printStackTracesToString(nnfe));
335         }
336     }
337
338     public void testLinkDoc() {
339         try {
340             Folder f1 = (Folder) this.root.fetchChild("core");
341             Folder f2 = (Folder) f1.fetchChild("test");
342             // this is the link
343
ConfigurationDocument doc =
344                 (ConfigurationDocument) f2.fetchChild("testConfigDocLink");
345         } catch (NodeNotFoundException nnfe) {
346             TestCase.fail(
347                 "Caught node not found exception: "
348                     + ExceptionUtility.printStackTracesToString(nnfe));
349         }
350     }
351
352     public void testAddNestedConfiguration() throws ConfigurationException{
353         Folder subFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
354         ConfigurationDocument doc =
355             (ConfigurationDocument) subFolder.fetchChild(DOCUMENT_NAME);
356
357         TestConfiguration config =
358             (TestConfiguration) Config.getInstance().createConfiguration(
359                 TestConfiguration.class);
360
361         config.setTestValue(TEST_VALUE);
362         ConfigurationDocument nested =
363             doc.addNestedConfigurationDocument(NESTED_DOCUMENT_NAME, config);
364
365         if (!(nested instanceof NestedConfigurationDocument)) {
366             fail("Nested configuration doc was of an unexpected type, expected: "
367                 + NestedConfigurationDocument.class.getName()
368                 + ", actual: "
369                 + nested.getClass().getName());
370         }
371
372         subFolder.addConfigurationDocument(DOCUMENT_NAME + DOCUMENT_NAME, config);
373         config = (TestConfiguration) ((ConfigurationDocument) subFolder.fetchChild(DOCUMENT_NAME)).readConfiguration();
374
375         // test 2 levels of nesting
376
ConfigurationDocument doubleNested =
377             nested.addNestedConfigurationDocument(NESTED_DOCUMENT_NAME, config);
378
379         if (doubleNested == null ||
380             doubleNested instanceof NestedConfigurationDocument) {
381
382             fail("Nested configuration doc was null or of type "
383                 + NestedConfigurationDocument.class.getName()
384                 + " and should not have been");
385         }
386
387     }
388
389     public void testNestedReferenceWrite() {
390         final String JavaDoc DOCUMENT_NAME_2 = DOCUMENT_NAME + "2";
391
392         try {
393             Folder parentFolder = (Folder) this.root.fetchChild(FOLDER_NAME);
394
395             TestConfiguration refConfig =
396                 (TestConfiguration) Config.getInstance().createConfiguration(
397                     TestConfiguration.class);
398             refConfig.setTestValue("foobar");
399
400             ConfigurationDocument refDoc =
401                 parentFolder.addConfigurationDocument(DOCUMENT_NAME_2, refConfig);
402
403             refConfig =
404                 (TestConfiguration) ((ConfigurationDocument) parentFolder
405                     .fetchChild(DOCUMENT_NAME_2))
406                     .readConfiguration();
407
408             refConfig.setTestValue("barfoo");
409             ConfigurationDocument parentDoc =
410                 (ConfigurationDocument) parentFolder.fetchChild(DOCUMENT_NAME);
411             TestConfiguration parentConfig =
412                 (TestConfiguration) parentDoc.readConfiguration();
413             parentConfig.setSubConfig(refConfig);
414             parentDoc.writeConfiguration(parentConfig);
415
416             refConfig = (TestConfiguration) refDoc.readConfiguration();
417
418             assertTrue(
419                 "Referenced child configuration was not written "
420                     + "expected test value [barfoo], actual test value ["
421                     + refConfig.getTestValue()
422                     + "]",
423                 refConfig.getTestValue().equals("barfoo"));
424
425         } catch (NodeException ne) {
426             TestCase.fail(
427                 "Caught unexpected NodeException: "
428                     + ExceptionUtility.printStackTracesToString(ne));
429         } catch (ConfigurationFormatException cfe) {
430             TestCase.fail(
431                 "Caught unexpected "
432                     + "ConfigurationFormatException: "
433                     + ExceptionUtility.printStackTracesToString(cfe));
434         }
435     }
436
437     public void testReadNestedConfiguration() {
438         try {
439             ConfigurationDocument nestedDoc =
440                 (ConfigurationDocument) this
441                     .root
442                     .fetchChild(FOLDER_NAME)
443                     .fetchChild(DOCUMENT_NAME)
444                     .fetchChild(NESTED_DOCUMENT_NAME);
445
446             TestConfiguration config =
447                 (TestConfiguration) nestedDoc.readConfiguration();
448             assertTrue(
449                 "Unexpected config value, expected ["
450                     + TEST_VALUE
451                     + "], actual ["
452                     + config.getTestValue()
453                     + "]",
454                 config.getTestValue().equals(TEST_VALUE));
455
456         } catch (NodeException ne) {
457             TestCase.fail(
458                 "Caught unexpected NodeException: "
459                     + ExceptionUtility.printStackTracesToString(ne));
460         } catch (ConfigurationFormatException cfe) {
461             TestCase.fail(
462                 "Caught unexpected "
463                     + "ConfigurationFormatException: "
464                     + ExceptionUtility.printStackTracesToString(cfe));
465         }
466     }
467
468     public void testRemoveNestedConfiguration() {
469         try {
470             ConfigurationDocument nestedDoc =
471                 (ConfigurationDocument) this
472                     .root
473                     .fetchChild(FOLDER_NAME)
474                     .fetchChild(DOCUMENT_NAME)
475                     .fetchChild(NESTED_DOCUMENT_NAME);
476
477             nestedDoc.remove();
478         } catch (NodeException ne) {
479             TestCase.fail(
480                 "Caught unexpected NodeException: "
481                     + ExceptionUtility.printStackTracesToString(ne));
482         }
483
484         try {
485             ConfigurationDocument nestedDoc =
486                 (ConfigurationDocument) this
487                     .root
488                     .fetchChild(FOLDER_NAME)
489                     .fetchChild(DOCUMENT_NAME)
490                     .fetchChild(NESTED_DOCUMENT_NAME);
491
492             fail("Nested node was not removed");
493         } catch (NodeNotFoundException nfge) {
494             // expected
495
}
496     }
497
498     private static synchronized void setThreadFailureCause(Throwable JavaDoc t) {
499         if (threadFailureCause == null) {
500             threadFailureCause = t;
501         }
502     }
503
504     private static synchronized Throwable JavaDoc getThreadFailureCause() {
505         return threadFailureCause;
506     }
507
508     public void testDeadlock() throws Throwable JavaDoc {
509         Thread JavaDoc linkCreator = new Thread JavaDoc(new LinkCreator(), "LinkCreator");
510         Thread JavaDoc nodeTraverser = new Thread JavaDoc(new NodeTraverser(), "NodeTraverser");
511         
512         linkCreator.start();
513         nodeTraverser.start();
514         
515         nodeTraverser.join(20000);
516         
517         if (getThreadFailureCause() != null) {
518             throw getThreadFailureCause();
519         }
520         
521         if (linkCreator.isAlive() || nodeTraverser.isAlive()) {
522             fail("Threads did not complete in alotted time, deadlock suspected");
523         }
524         
525     }
526     
527     static class LinkCreator implements Runnable JavaDoc {
528         public void run() {
529             try {
530                 Folder linkParent;
531                 GenericLinkNodeConfiguration linkConfig;
532                 
533                 linkParent =
534                     (Folder) Config.getInstance().fetchNode(TEST_LINK_PARENT_NAME);
535                 
536                 linkConfig = (GenericLinkNodeConfiguration)
537                     Config.getInstance().createConfiguration(GenericLinkNodeConfiguration.class);
538                 
539                 linkConfig.setLinkNodeFactoryClass(GenericLinkNodeFactory.class);
540                 linkConfig.setTargetNodeName(TEST_CONFIG_NAME);
541                 
542                 if (linkParent.containsChild(TEST_LINK_NAME)) {
543                     linkParent.fetchChild(TEST_LINK_NAME).remove();
544                 }
545
546                 for (int count = 1; count<=20; count++) {
547                     linkParent.addLink(TEST_LINK_NAME, linkConfig);
548                     linkParent.fetchChild(TEST_LINK_NAME).remove();
549                 }
550             } catch (Throwable JavaDoc t) {
551                 setThreadFailureCause(t);
552             }
553         }
554     }
555     
556     static class NodeTraverser implements Runnable JavaDoc {
557         public void run() {
558             for (int count = 1; count<=1000; count++) {
559                 try {
560                     TestConfiguration config = (TestConfiguration)
561                         Config.getInstance().fetchConfiguration(
562                         TEST_LINK_PARENT_NAME + Node.DELIMITER + TEST_LINK_NAME);
563                         
564                     config.getTestValue();
565                     Thread.yield();
566                 } catch (ConfigurationNotFoundException cnfe) {
567                     // this may happen during the test and is normal... eat it
568
} catch (Throwable JavaDoc t) {
569                     setThreadFailureCause(t);
570                 }
571             }
572
573         }
574     }
575     /**
576      * Method called by jUnit to get all the tests in this test case.
577      * @return Test the suite of tests in this test case
578      */

579     public static Test suite() {
580         TestSuite masterSuite = new TestSuite();
581         // add single threaded tests
582
Test singleThreadedTests = getSingleThreadedTests();
583         if (singleThreadedTests != null) {
584             masterSuite.addTest(singleThreadedTests);
585         }
586         // add multi threaded tests
587
Test multiThreadedTests = getMultiThreadedTests();
588         if (multiThreadedTests != null) {
589             masterSuite.addTest(multiThreadedTests);
590         }
591         return masterSuite;
592     }
593
594     /**
595      * This method is used within the suite method to get all of the single threaded tests.
596      * Add all your single threaded tests in this method with a line like:
597      * suite.addTest(new InternalNodeTest("testFunction1"));
598      * @return Test the suite of single threaded tests in this test case
599      */

600     private static Test getSingleThreadedTests() {
601         TestSuite suite = new TestSuite();
602
603         suite.addTest(new InternalNodeTest("testAddSubFolder"));
604         suite.addTest(new InternalNodeTest("testAddConfigurationDocument"));
605         suite.addTest(new InternalNodeTest("testWriteConfiguration"));
606         suite.addTest(new InternalNodeTest("testReadConfiguration"));
607         suite.addTest(new InternalNodeTest("testNodeAttributes"));
608         suite.addTest(new InternalNodeTest("testFetchChildren"));
609         suite.addTest(
610             new InternalNodeTest("testAddDuplicateConfigurationDocument"));
611         suite.addTest(new InternalNodeTest("testAddDuplicateSubFolder"));
612         suite.addTest(new InternalNodeTest("testAddNestedConfiguration"));
613         suite.addTest(new InternalNodeTest("testReadNestedConfiguration"));
614         suite.addTest(new InternalNodeTest("testRemoveNestedConfiguration"));
615 // suite.addTest(new InternalNodeTest("testNestedReferenceWrite"));
616
suite.addTest(new InternalNodeTest("testNodeRemoval"));
617         suite.addTest(new InternalNodeTest("testFetchRemovedNode"));
618         suite.addTest(new InternalNodeTest("testNullParameters"));
619         suite.addTest(new InternalNodeTest("testLinkFolder"));
620         suite.addTest(new InternalNodeTest("testLinkDoc"));
621         suite.addTest(new InternalNodeTest("testDeadlock"));
622
623         return suite;
624     }
625
626     /**
627      * This method is used within the suite method to get all of the multi threaded tests.
628      * Add all your multi threaded tests in this method with a line like: addTest(suite, "testFunction1", 5);
629      * @return Test the suite of multi-threaded tests in this test case
630      */

631     private static Test getMultiThreadedTests() {
632         TestSuite suite = new ActiveTestSuite();
633
634         /*
635          * add your tests here following these examples:
636          *
637          * addTest(suite, "testFunction1", 5);
638          * addTest(suite, "testFunction2", 10);
639          */

640
641         return suite;
642     }
643
644     /**
645      * This method will add the give test to the give suite the specified
646      * number of times. This is best used for multi-threaded tests where
647      * suite is an instance of ActiveTestSuite and you want to run the same test in multiple threads.
648      * @param suite the suite to add the test to.
649      * @param testName the name of the test to add.
650      * @param number the number of times to add the test to the suite
651      */

652     private static void addTest(TestSuite suite, String JavaDoc testName, int number) {
653         for (int count = 0; count < number; count++) {
654             suite.addTest(new InternalNodeTest(testName));
655         }
656     }
657     /*
658      * @see TestCase#setUp()
659      */

660     protected void setUp() throws Exception JavaDoc {
661         this.root =
662             (Folder) Config.getInstance().fetchNode(Config.ROOT_NODE_NAME);
663     }
664
665 }
666
Popular Tags