KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > java > integrity > ForName


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

19
20 /*
21  * ForName.java
22  *
23  * Created on September 19, 2000, 1:39 PM
24  */

25
26
27 package org.netbeans.test.java.integrity.ForName;
28
29 import junit.textui.TestRunner;
30 import org.netbeans.test.java.LogTestCase;
31 import org.openide.filesystems.FileObject;
32 import org.openide.filesystems.FileUtil;
33 import org.openide.loaders.DataObject;
34 //import org.openide.src.ClassElement;
35

36 /** <B>Java Module Integrity API Test: ForName</B>
37  * <BR><BR><I>What it tests:</I><BR>
38  * Capability of module to search through mounted filesystems for specified Class.
39  * <BR><BR><I>What has to be set:</I><BR>
40  * testbase/testfs has to be mounted.
41  * <BR><BR><I>How it works:</I><BR>
42  * Test tries to find known classes using ClassElement.forName(ClassElement);
43  * <BR><BR><I>Output:</I><BR>
44  * Places, where were known classes found. This is compared with golden file.
45  * <BR><BR><I>Possible reasons of failure:</I><BR>
46  * <BR><BR><U>Some classes were not found</U><BR>
47  * See .diff file which ones.
48  * <BR><BR><U>Exception occured:</U><BR>
49  * See .out or .diff file for StackTrace
50  *
51  * @author Jan Becicka <Jan.Becicka@sun.com>
52  * @version
53  */

54
55
56 public class ForName extends LogTestCase {
57     
58     
59     public void testRun(){
60         try {
61             FileObject artefact=FileUtil.toFileObject(classPathWorkDir);
62             for (int i=0;i < Classes.length;i++){
63 // ClassElement ce = ClassElement.forName(Classes[i], artefact);
64
// if (ce == null){
65
// ref(Classes[i]+" not found!");
66
// } else {
67
// ref(Classes[i]+" found");// in "+ getFSName(ce));
68
// }
69
}
70         } catch (Exception JavaDoc e) {
71             e.printStackTrace(log);
72             assertTrue(e.toString(), false);
73         }
74     }
75         
76     public static void main(java.lang.String JavaDoc[] args) {
77         TestRunner.run(ForName.class);
78     }
79     
80     final String JavaDoc[] Classes = {
81         "TopLevelClassDefaultPackage",
82         "TopLevelClassDefaultPackage.InnerClass",
83         "TopLevelClassDefaultPackage$InnerClass",
84         "org.netbeans.test.java.testsources.TopLevelClass",
85         "org.netbeans.test.java.testsources.TopLevelClass.InnerClass",
86         "org.netbeans.test.java.testsources.TopLevelClass$InnerClass",
87         "org.netbeans.test.java.testsources.InTestFS",
88         "org.netbeans.test.java.testsources.InTestFS$InnerClass",
89         "org.netbeans.test.java.testsources.InTestFS.InnerClass",
90     };
91     
92     public ForName(java.lang.String JavaDoc testName) {
93         super(testName);
94     }
95     
96 }
97
Popular Tags