KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > java > queries > MultipleRootsUnitTestForSourceQueryImplementation


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 package org.netbeans.spi.java.queries;
20
21 import java.net.URL JavaDoc;
22 import org.openide.filesystems.FileObject;
23
24
25 /**
26  * Query to find Java package roots of unit tests for Java package root of
27  * sources and vice versa.
28  *
29  * <p>A default implementation is registered by the
30  * <code>org.netbeans.modules.java.project</code> module which looks up the
31  * project corresponding to the binary file and checks whether that
32  * project has an implementation of this interface in its lookup. If so, it
33  * delegates to that implementation. Therefore it is not generally necessary
34  * for a project type provider to register its own global implementation of
35  * this query, if it depends on the Java Project module and uses this style.</p>
36  *
37  * <p>This interface assumes following mapping pattern between source
38  * files and unit tests: <code>*.java -> *Test.java</code>. This mapping
39  * is used for example for unit test generation and for searching test for
40  * source. Usage of any other pattern will break this functionality.</p>
41  *
42  * @see <a HREF="@PROJECTS/PROJECTAPI/org/netbeans/api/project/Project.html#getLookup"><code>Project.getLookup()</code></a>
43  * @see org.netbeans.api.java.queries.UnitTestForSourceQuery
44  * @author Tomas Zezula
45  * @since org.netbeans.api.java/1 1.7
46  */

47 public interface MultipleRootsUnitTestForSourceQueryImplementation {
48
49     /**
50      * Returns the test roots for a given source root.
51      *
52      * @param source a Java package root with sources
53      * @return a corresponding Java package roots with unit tests. The
54      * returned URLs need not point to an existing folder. It can be null
55      * when no mapping from source to unit test is known.
56      */

57     public URL JavaDoc[] findUnitTests(FileObject source);
58
59     /**
60      * Returns the source roots for a given test root.
61      *
62      * @param unitTest a Java package roots with unit tests
63      * @return a corresponding Java package roots with sources. It can be null
64      * when no mapping from unit test to source is known.
65      */

66     public URL JavaDoc[] findSources(FileObject unitTest);
67
68 }
69
Popular Tags