KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > junit > JUnitPluginTrampoline


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 package org.netbeans.modules.junit;
21
22 import java.util.Map JavaDoc;
23 import org.netbeans.modules.junit.plugin.JUnitPlugin;
24 import org.netbeans.modules.junit.plugin.JUnitPlugin.CreateTestParam;
25 import org.netbeans.modules.junit.plugin.JUnitPlugin.Location;
26 import org.openide.filesystems.FileObject;
27
28 /**
29  *
30  * @author Marian Petras
31  */

32 public abstract class JUnitPluginTrampoline {
33
34     /** the trampoline singleton, defined by {@link JUnitPlugin} */
35     public static JUnitPluginTrampoline DEFAULT;
36
37     /**
38      * Provokes initialization of class JUnitPlugin.
39      */

40     {
41         Class JavaDoc c = JUnitPlugin.class;
42         try {
43             Class.forName(c.getName(), true, c.getClassLoader());
44         } catch (ClassNotFoundException JavaDoc ex) {
45             ex.printStackTrace();
46         }
47     }
48     
49     /** Used by {@link JUnitPlugin}. */
50     public JUnitPluginTrampoline() {}
51     
52     /**
53      * Returns a specification of a Java element or file representing test
54      * for the given source Java element or file.
55      *
56      * @param sourceLocation specification of a Java element or file
57      * @return specification of a corresponding test Java element or file,
58      * or {@code null} if no corresponding test Java file is available
59      */

60     public abstract Location getTestLocation(
61             JUnitPlugin plugin,
62             Location sourceLocation);
63     
64     /**
65      * Returns a specification of a Java element or file that is tested
66      * by the given test Java element or test file.
67      *
68      * @param testLocation specification of a Java element or file
69      * @return specification of a Java element or file that is tested
70      * by the given Java element or file.
71      */

72     public abstract Location getTestedLocation(
73             JUnitPlugin plugin,
74             Location testLocation);
75     
76     /**
77      * Creates test classes for given source classes.
78      *
79      * @param filesToTest source files for which test classes should be
80      * created
81      * @param targetRoot root folder of the target source root
82      * @param params parameters of creating test class
83      * - each key is an {@code Integer} whose value is equal
84      * to some of the constants defined in the class;
85      * the value is either
86      * a {@code String} (for key with value {@code CLASS_NAME})
87      * or a {@code Boolean} (for other keys)
88      * @return created test files
89      */

90     public abstract FileObject[] createTests(
91             JUnitPlugin plugin,
92             FileObject[] filesToTest,
93             FileObject targetRoot,
94             Map JavaDoc<CreateTestParam, Object JavaDoc> params);
95
96 }
97
Popular Tags