KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > freeform > FreeformProjectWebTest


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.web.freeform;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.Arrays JavaDoc;
24 import java.util.Collections JavaDoc;
25 import java.util.List JavaDoc;
26 import org.netbeans.api.project.ProjectInformation;
27 import org.netbeans.api.project.ProjectUtils;
28 import org.netbeans.api.project.SourceGroup;
29 import org.netbeans.api.project.Sources;
30 import org.netbeans.junit.NbTestCase;
31 import org.netbeans.spi.project.ActionProvider;
32 import org.netbeans.spi.project.support.ant.PropertyEvaluator;
33 import org.openide.util.Lookup;
34
35 // XXX testAuxiliaryConfiguration
36
// XXX testCacheProvider
37
// XXX testSubprojectProvider
38
// XXX testLogicalViewItems
39
// XXX testAntArtifact
40
// XXX testExternalSourceRoots
41

42 /**
43  * Test functionality of FreeformProject.
44  * This class just tests the basic functionality found in the "jakarta" project.
45  * @author Pavel Buzek
46  */

47 public class FreeformProjectWebTest extends TestBaseWeb {
48     
49     public FreeformProjectWebTest (String JavaDoc name) {
50         super(name);
51     }
52     
53     public void testPropertyEvaluation() throws Exception JavaDoc {
54         PropertyEvaluator eval = jakarta.evaluator();
55         assertEquals("right src.home", "src", eval.getProperty("src.home"));
56     }
57     
58     public void testProjectInformation() throws Exception JavaDoc {
59         ProjectInformation info = ProjectUtils.getInformation(jakarta);
60         assertEquals("correct name", "My_App", info.getName());
61         assertEquals("same display name", "My App", info.getDisplayName());
62     }
63     
64     public void testSources() throws Exception JavaDoc {
65         Sources s = ProjectUtils.getSources(jakarta);
66         SourceGroup[] groups = s.getSourceGroups(Sources.TYPE_GENERIC);
67         assertEquals("one generic group", 1, groups.length);
68         assertEquals("right root folder", jakarta.getProjectDirectory(), groups[0].getRootFolder());
69         assertEquals("right display name", "My App", groups[0].getDisplayName());
70         groups = s.getSourceGroups("java");
71         assertEquals("one Java group", 1, groups.length);
72         assertEquals("right root folder #1", jakarta.getProjectDirectory().getFileObject("src"), groups[0].getRootFolder());
73         assertEquals("right display name #1", "Web Module Sources", groups[0].getDisplayName());
74         groups = s.getSourceGroups("doc_root");
75         assertEquals("one doc root group", 1, groups.length);
76         assertEquals("right root folder #1", jakarta.getProjectDirectory().getFileObject("web"), groups[0].getRootFolder());
77         assertEquals("right display name #1", "Web Pages", groups[0].getDisplayName());
78     }
79     
80 }
81
Popular Tags