1 19 package org.netbeans.test.jsf; 20 21 import javax.swing.JComboBox ; 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 41 public class JsfPagesFromEntityClassTest extends JellyTestCase{ 42 public static final String PROJECT_NAME = "myjsfproject"; 43 44 public JsfPagesFromEntityClassTest(String 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 62 public static void main(java.lang.String [] args) { 63 junit.textui.TestRunner.run(suite()); 64 } 65 66 67 public void testCreateEntityClassAndPU(){ 68 NewFileWizardOperator entity = NewFileWizardOperator.invoke(); 69 String 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 )new JLabelOperator(persistenceDialog, "Data Source").getLabelFor()).selectItem("jdbc/sample"); 81 new JButtonOperator(persistenceDialog, "Create").push(); 82 83 locationOper.finish(); 84 } 85 86 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 109 } 110 } 111 112 | Popular Tags |