KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > jsf > JsfPagesFromEntityClassTest


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.test.jsf;
20
21 import javax.swing.JComboBox JavaDoc;
22 import org.netbeans.jellytools.JellyTestCase;
23 import org.netbeans.jellytools.NewFileNameLocationStepOperator;
24 import org.netbeans.jellytools.NewFileWizardOperator;
25 import org.netbeans.jellytools.NbDialogOperator;
26 import org.netbeans.jellytools.NewFileNameLocationStepOperator;
27 import org.netbeans.jellytools.ProjectsTabOperator;
28 import org.netbeans.jellytools.modules.web.nodes.WebPagesNode;
29 import org.netbeans.jellytools.nodes.Node;
30 import org.netbeans.jemmy.operators.JButtonOperator;
31 import org.netbeans.jemmy.operators.JComboBoxOperator;
32 import org.netbeans.junit.NbTestSuite;
33 import org.netbeans.jemmy.operators.JLabelOperator;
34
35 /** Test creation of JSF pages from entity classes. We expect web application
36  * with JSF framework is created.
37  *
38  * @author Lukasz Grela
39  * @author Jiri Skrivanek
40  */

41 public class JsfPagesFromEntityClassTest extends JellyTestCase{
42     public static final String JavaDoc PROJECT_NAME = "myjsfproject";
43
44     public JsfPagesFromEntityClassTest(String JavaDoc s) {
45         super(s);
46     }
47     
48     public static NbTestSuite suite() {
49         NbTestSuite suite = new NbTestSuite();
50         suite.addTest(new JsfPagesFromEntityClassTest("testCreateEntityClassAndPU"));
51         suite.addTest(new JsfPagesFromEntityClassTest("testCreateJSFPagesFromEntityClass"));
52         return suite;
53     }
54     
55     public void setUp() {
56         System.out.println("### "+getName()+" ###");
57     }
58     
59     /** Use for internal test execution inside IDE
60      * @param args command line arguments
61      */

62     public static void main(java.lang.String JavaDoc[] args) {
63         junit.textui.TestRunner.run(suite());
64     }
65
66     /** Create Entity class and persistence unit. */
67     public void testCreateEntityClassAndPU(){
68         NewFileWizardOperator entity = NewFileWizardOperator.invoke();
69         String JavaDoc filetype = "Entity Class";
70         entity.selectProject(PROJECT_NAME);
71         entity.selectCategory("Persistence");
72         entity.selectFileType(filetype);
73         entity.next();
74         NewFileNameLocationStepOperator locationOper = new NewFileNameLocationStepOperator();
75         locationOper.setPackage("mypackage");
76         new JButtonOperator(locationOper, "Create Persistence Unit").pushNoBlock();
77         
78         NbDialogOperator persistenceDialog = new NbDialogOperator("Create Persistence Unit");
79         new JComboBoxOperator(
80                 (JComboBox JavaDoc)new JLabelOperator(persistenceDialog, "Data Source").getLabelFor()).selectItem("jdbc/sample");
81         new JButtonOperator(persistenceDialog, "Create").push();
82         
83         locationOper.finish();
84     }
85
86     /** Create JSF Pages from entity class. */
87     public void testCreateJSFPagesFromEntityClass(){
88         NewFileWizardOperator jsf_pages = NewFileWizardOperator.invoke();
89         jsf_pages.selectCategory("Persistence");
90         jsf_pages.selectFileType("JSF Pages from Entity Class");
91         jsf_pages.close();
92         // TODO - review next code when issue 91200 is fixed
93
/*
94         jsf_pages.next();
95         NbDialogOperator dialog = new NbDialogOperator("New JSF Pages from Entity Class");
96         new JButtonOperator(dialog,2).push();
97         new JButtonOperator(dialog,Bundle.getStringTrimmed("org.openide.Bundle", "CTL_NEXT")).push();
98         new JButtonOperator(dialog,Bundle.getStringTrimmed("org.openide.Bundle", "CTL_FINISH")).push();
99          
100         // verify
101         new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME);
102         WebPagesNode webPages = new WebPagesNode(PROJECT_NAME);
103         new Node(webPages, "newEntity|Detail.jsp");
104         new Node(webPages, "newEntity|Edit.jsp");
105         new Node(webPages, "newEntity|List.jsp");
106         new Node(webPages, "newEntity|New.jsp");
107
108          */

109     }
110 }
111
112
Popular Tags