KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > enode > ExtensibleIconsTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Nokia. Portions Copyright 2003 Nokia.
17  * All Rights Reserved.
18  */

19
20 package org.netbeans.modules.enode;
21
22 import javax.swing.Action JavaDoc;
23
24 import junit.textui.TestRunner;
25
26 import org.netbeans.junit.NbTestCase;
27 import org.netbeans.junit.NbTestSuite;
28
29 import org.openide.ErrorManager;
30 import org.openide.modules.ModuleInfo;
31 import org.openide.nodes.Node;
32 import org.openide.util.Lookup;
33
34 import org.netbeans.api.enode.ExtensibleNode;
35 import org.netbeans.api.registry.*;
36
37 /**
38  * This class should test the setting icons in the
39  * ExtensibleNode.
40  * @author David Strupl
41  */

42 public class ExtensibleIconsTest extends NbTestCase {
43     /** root Context */
44     private Context root;
45
46     public ExtensibleIconsTest(String JavaDoc name) {
47         super(name);
48     }
49     
50     
51     public static void main(String JavaDoc[] args) {
52         TestRunner.run(new NbTestSuite(ExtensibleIconsTest.class));
53     }
54     
55     /**
56      * Sets up the testing environment by creating testing folders
57      * on the system file system.
58      */

59     protected void setUp () throws Exception JavaDoc {
60         Lookup.getDefault().lookup(ModuleInfo.class);
61         String JavaDoc baseFolder = ExtensibleNode.E_NODE_ICONS.substring(1, ExtensibleNode.E_NODE_ICONS.length()-1);
62         root = Context.getDefault().createSubcontext(baseFolder);
63     }
64     
65     /**
66      * Deletes the folders created in method setUp().
67      */

68     protected void tearDown() throws Exception JavaDoc {
69     }
70
71     /**
72      */

73     public void test1() throws Exception JavaDoc {
74         ExtensibleNode en1 = new ExtensibleNode("a/b/c", true);
75         java.lang.reflect.Method JavaDoc getIconManagerMethod = ExtensibleNode.class.getDeclaredMethod("getIconManager", new Class JavaDoc[0]);
76         getIconManagerMethod.setAccessible(true);
77         Object JavaDoc iconMan = getIconManagerMethod.invoke(en1, new Object JavaDoc[0]);
78         
79         Context b = root.createSubcontext("a/b");
80         Context c = root.createSubcontext("a/b/c");
81         
82 // b.putObject("i1", base1);
83

84         root.destroySubcontext("a");
85     }
86 }
87
Popular Tags