KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > apisupport > project > NbModuleProviderTest


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.apisupport.project;
21
22 import org.netbeans.modules.apisupport.project.spi.NbModuleProvider;
23 import org.netbeans.api.project.Project;
24 import org.netbeans.api.project.ProjectManager;
25 import org.openide.filesystems.FileObject;
26
27 /**
28  * Test if an NbModuleProject provides an NbModuleProvider in their lookup.
29  *
30  * @author Martin Krauskopf
31  */

32 public class NbModuleProviderTest extends TestBase {
33
34     public NbModuleProviderTest(String JavaDoc name) {
35         super(name);
36     }
37
38     public void testNbModuleProvider() throws Exception JavaDoc {
39         FileObject dir = nbCVSRoot().getFileObject("java/project");
40         assertNotNull("have java/project checked out", dir);
41         Project p = ProjectManager.getDefault().findProject(dir);
42         NbModuleProvider nmtp = (NbModuleProvider) p.getLookup().lookup(NbModuleProvider.class);
43         assertNotNull("has NbModuleProvider", nmtp);
44         assertSame("is netbeans.org modules", NbModuleProvider.NETBEANS_ORG, nmtp.getModuleType());
45         
46         FileObject suite1 = resolveEEP("suite1");
47         FileObject action = suite1.getFileObject("action-project");
48         p = ProjectManager.getDefault().findProject(action);
49         nmtp = (NbModuleProvider) p.getLookup().lookup(NbModuleProvider.class);
50         assertNotNull("has NbModuleProvider", nmtp);
51         assertSame("is suite-component module", NbModuleProvider.SUITE_COMPONENT, nmtp.getModuleType());
52         
53         FileObject suite3 = resolveEEP("suite3");
54         FileObject dummy = suite3.getFileObject("dummy-project");
55         p = ProjectManager.getDefault().findProject(dummy);
56         nmtp = (NbModuleProvider) p.getLookup().lookup(NbModuleProvider.class);
57         assertNotNull("has NbModuleProvider", nmtp);
58         assertSame("is standalone modules", NbModuleProvider.STANDALONE, nmtp.getModuleType());
59     }
60     
61 }
62
Popular Tags