1 19 20 package gui.updatecenterwizard; 21 22 import gui.updatecenterwizard.settings.CatalogDataValues; 23 import org.netbeans.jellytools.Bundle; 24 import org.netbeans.jellytools.NbDialogOperator; 25 import org.netbeans.jellytools.WizardOperator; 26 import org.netbeans.jemmy.JemmyException; 27 import org.netbeans.jemmy.JemmyProperties; 28 import org.netbeans.jemmy.operators.JButtonOperator; 29 import org.netbeans.jemmy.operators.JCheckBoxOperator; 30 import org.netbeans.jemmy.operators.JLabelOperator; 31 import org.netbeans.jemmy.operators.JTextFieldOperator; 32 import org.netbeans.junit.NbTestSuite; 33 34 38 39 public class R_RemoteServerUpdateCenterWizardTests extends UpdateCenterWizardTests { 40 41 CatalogDataValues dataValues = null; 42 43 public R_RemoteServerUpdateCenterWizardTests(String name) { 44 super(name); 45 } 46 public void setUp() { 47 System.out.println("######## "+getName()+" #######"); 48 dataValues = readDataValues("R_remote_settings.xml"); 49 } 50 51 public static NbTestSuite suite() { 52 NbTestSuite suite = new NbTestSuite(); 53 suite.addTest(new N_RemoteServerUpdateCenterWizardTests("testUnsuccessfulConnection")); 54 suite.addTest(new N_RemoteServerUpdateCenterWizardTests("testSuccessfulConnection")); 55 return suite; 56 } 57 58 63 public void testUnsuccessfulConnection() { 64 65 66 WizardOperator ucwizard = null; 67 68 try { 69 ucwizard = openUpdateCenterWizard(); 70 71 setAllAUtypesSelected(false); 73 String devUC = Bundle.getString("org.netbeans.modules.updatecenters.resources.Bundle","Services/AutoupdateType/autoupdate_xml_type.settings"); 74 setAUtypeSelected(devUC, true); 75 76 String buttonProxyConfLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "BNT_Proxy"); new JButtonOperator(ucwizard, buttonProxyConfLabel).pushNoBlock(); 80 String proxyConfDialogTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_ProxyDialog_Title"); NbDialogOperator proxyDialog = new NbDialogOperator(proxyConfDialogTitle); 83 new JCheckBoxOperator(proxyDialog).setSelected(true); 85 new JTextFieldOperator(proxyDialog, 0).setText("nonexisting.cache"); new JTextFieldOperator(proxyDialog, 1).setText("80809999999999999999"); proxyDialog.ok(); 90 ucwizard.btNext().pushNoBlock(); 92 String connectingTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Connecting_Title"); 95 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", 60000); 97 new NbDialogOperator(connectingTitle).waitClosed(); 98 String errorTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Error"); 100 new NbDialogOperator(errorTitle).close(); 101 ucwizard.close(); 102 103 } catch (JemmyException e) { 104 if(ucwizard != null) { 106 ucwizard.close(); 107 } 108 throw e; 109 } 110 111 } 112 116 public void testSuccessfulConnection() { 117 118 WizardOperator ucwizard = null; 119 try { 120 ucwizard = openUpdateCenterWizard(); 121 122 setAllAUtypesSelected(false); 124 String myUC = dataValues.getUcName(); 125 setAUtypeSelected(myUC, true); 126 127 String buttonProxyConfLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "BNT_Proxy"); new JButtonOperator(ucwizard, buttonProxyConfLabel).pushNoBlock(); String proxyConfDialogTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_ProxyDialog_Title"); NbDialogOperator proxyDialog = new NbDialogOperator(proxyConfDialogTitle); new JCheckBoxOperator(proxyDialog).setSelected(true); new JTextFieldOperator(proxyDialog, 0).setText(dataValues.getProxyHost()); new JTextFieldOperator(proxyDialog, 1).setText(dataValues.getProxyPort()); proxyDialog.ok(); ucwizard.btNext().pushNoBlock(); 143 String connectingTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Connecting_Title"); 146 JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", 60000); 148 new NbDialogOperator(connectingTitle).waitClosed(); 149 String secondStep = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "LAB_221"); new JLabelOperator(ucwizard, secondStep); 152 ucwizard.close(); 154 155 } catch (JemmyException e) { 156 if(ucwizard != null) { 158 ucwizard.close(); 159 } 160 throw e; 161 } 162 163 } 164 165 public static void main(java.lang.String [] args) { 166 junit.textui.TestRunner.run(suite()); 169 } 170 171 172 173 } 174 | Popular Tags |