KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > settings > EnvTest


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 Sun Microsystems, Inc. Portions Copyright 2002 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.settings;
21
22 import org.netbeans.junit.NbTestCase;
23 import org.openide.filesystems.FileObject;
24
25 import org.openide.filesystems.FileSystem;
26 import org.openide.modules.ModuleInfo;
27 import org.openide.util.Lookup;
28
29 /**
30  *
31  * @author Jan Pokorsky
32  */

33 public class EnvTest extends NbTestCase {
34     FileSystem fs;
35
36     /** Creates a new instance of EnvTest */
37     public EnvTest(String JavaDoc name) {
38         super(name);
39     }
40
41     protected void setUp() throws Exception JavaDoc {
42         super.setUp();
43
44         Lookup.getDefault().lookup(ModuleInfo.class);
45         fs = org.openide.filesystems.Repository.getDefault().getDefaultFileSystem();
46     }
47     
48     public void testFindEntityRegistration() throws Exception JavaDoc {
49         String JavaDoc provider = "xml/lookups/NetBeans_org_netbeans_modules_settings_xtest/DTD_XML_FooSetting_1_0.instance";
50         FileObject fo = fs.findResource(provider);
51         assertNotNull("provider registration not found: " + provider, fo);
52         assertNotNull("entity registration not found for " + provider, Env.findEntityRegistration(fo));
53     }
54     
55     public void testFindProvider() throws Exception JavaDoc {
56         Class JavaDoc clazz = org.netbeans.modules.settings.convertors.FooSetting.class;
57         FileObject fo = Env.findProvider(clazz);
58         assertNotNull("xml/memory registration not found: " + clazz.getName(), fo);
59     }
60     
61     public void testFindProviderFromSuperClass() throws Exception JavaDoc {
62         Class JavaDoc clazz = org.netbeans.modules.settings.convertors.Bar3Setting.class;
63         FileObject fo = Env.findProvider(clazz);
64         assertNotNull("xml/memory registration not found: " + clazz.getName(), fo);
65     }
66     
67     public void testFindProviderFromSuperClass2() throws Exception JavaDoc {
68         Class JavaDoc clazz = org.netbeans.modules.settings.convertors.Bar4Setting.class;
69         FileObject fo = Env.findProvider(clazz);
70         assertNull("xml/memory registration found: " + clazz.getName(), fo);
71     }
72 }
73
Popular Tags