/* * testForImports.java * * Created on 23 July 2004, 14:43 */ package gui.updatecenterwizard; /** * * @author lukas.hasik */ public class testForImports { /** Creates a new instance of testForImports */ public testForImports(String name) { super(name); } public static NbTestSuite suite() { NbTestSuite suite = new NbTestSuite(); suite.addTest(new IDEValidation("testMainMenu")); suite.addTest(new IDEValidation("testHelp")); suite.addTest(new IDEValidation("testOptions")); suite.addTest(new IDEValidation("testNewProject")); // sample project must exist before testShortcuts suite.addTest(new IDEValidation("testShortcuts")); suite.addTest(new IDEValidation("testNewFile")); suite.addTest(new IDEValidation("testCVS")); suite.addTest(new IDEValidation("testProjectsView")); suite.addTest(new IDEValidation("testFilesView")); suite.addTest(new IDEValidation("testEditor")); suite.addTest(new IDEValidation("testBuildAndRun")); suite.addTest(new IDEValidation("testDebugging")); suite.addTest(new IDEValidation("testXML")); suite.addTest(new IDEValidation("testUpdateCenter")); suite.addTest(new IDEValidation("testDb")); return suite; } /** Use for execution inside IDE */ public static void main(java.lang.String[] args) { // run whole suite TestRunner.run(suite()); // run only selected test case //junit.textui.TestRunner.run(new IDEValidation("testMainMenu")); } public void setUp() { System.out.println("######## "+getName()+" #######"); } public void tearDown() { } /** Test Update Center * - open Update Center Wizard from main menu Tools|Update Center * - set proxy and go next * - wait until connection dialog dismiss * - in modules tree select "Development Update Center|Web|Applet" node * - click right arrow button and go next * - accept license dialog * - wait until download is finished and finish the wizard */ public void testUpdateCenter() { // "Tools" String toolsItem = Bundle.getStringTrimmed("org.netbeans.core.Bundle", "Menu/Tools"); // NOI18N WizardOperator updateCenterWizardOper = null; long oldWaitStateTime = JemmyProperties.getCurrentTimeout("ComponentOperator.WaitStateTimeout"); try { // "Update Center" String updateCenterItem = Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.Bundle", "CTL_Update"); new Action(toolsItem+"|"+updateCenterItem, null).perform(); // "Update Center Wizard" String updateCenterTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Wizard"); updateCenterWizardOper = new WizardOperator(updateCenterTitle); // disable Forte for Java Update Center if any JTableOperator oper = new JTableOperator(updateCenterWizardOper); // check each row for(int i=0;i-1 && ((Boolean)oper.getValueAt(i, 0)).booleanValue()) { // NOI18N oper.clickOnCell(i, 0); } // if Update Center matches "Sun ONE Studio" and it is enabled/checked then click to uncheck if(oper.getValueAt(i, 1).toString().indexOf("Sun")>-1 && ((Boolean)oper.getValueAt(i, 0)).booleanValue()) { // NOI18N oper.clickOnCell(i, 0); } } // set proxy // Proxy Configuration... String buttonProxyConfLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "BNT_Proxy"); // NOI18N new JButtonOperator(updateCenterWizardOper, buttonProxyConfLabel).pushNoBlock(); // Proxy Configuration String proxyConfDialogTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_ProxyDialog_Title"); // NOI18N NbDialogOperator proxyDialog = new NbDialogOperator(proxyConfDialogTitle); // Use Proxy check box new JCheckBoxOperator(proxyDialog).setSelected(true); // Proxy Host: text field new JTextFieldOperator(proxyDialog, 0).setText("webcache"); // NOI18N // Proxy Port: text field new JTextFieldOperator(proxyDialog, 1).setText("8080"); // NOI18N proxyDialog.ok(); // "Next >" updateCenterWizardOper.btNext().pushNoBlock(); // wait connecting dialog appears // "Connecting" String connectingTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Connecting_Title"); // wait at most 60 second until connecting dialog dismiss JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", 60000); new NbDialogOperator(connectingTitle).waitClosed(); // wait JTree generated on next page new EventTool().waitNoEvent(500); // select Web|Applet module JTreeOperator tree = new JTreeOperator(updateCenterWizardOper); // "Development Update Center String devUCLabel = Bundle.getString("org.netbeans.modules.updatecenters.resources.Bundle", "Services/AutoupdateType/autoupdate_xml_type.settings"); new Node(tree, devUCLabel+"|Web|Applet").select(); // NOI18N // add to right panel (push button with tooltip "Add") new JButtonOperator(updateCenterWizardOper, new ComponentChooser() { final String addLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "HINT_Add"); // NOI18N public boolean checkComponent(Component comp) { String tooltip = ((JComponent)comp).getToolTipText(); if(tooltip != null) { return tooltip.equals(addLabel); } else { return false; } } public String getDescription() { return "JButton with tooltip equals "+addLabel; } }).push(); // push "Next" button updateCenterWizardOper.btNext().pushNoBlock(); // accept license agreement // "License Agreement" String licenceTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Licence_Title"); // "Accept" String acceptLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Licence_Accept"); new JButtonOperator(new NbDialogOperator(licenceTitle), acceptLabel).push(); // wait 30 s until download is done JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 30000); // NOI18N // "Done." String doneLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "DownloadProgressPanel.jLabel1.doneText"); new JLabelOperator(updateCenterWizardOper, doneLabel); updateCenterWizardOper.next(); // accept certificate if requested if(!updateCenterWizardOper.btFinish().isEnabled()) { // "View Certificate..." String viewCertificateLable = Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.Bundle", "BTN_View"); new JButtonOperator(updateCenterWizardOper, viewCertificateLable).pushNoBlock(); // click on "Accept" button in dialog String acceptCertificateLabel = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Certificate_Accept"); // "Module Certificate" String certificateTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Certificate_Title"); new JButtonOperator(new JDialogOperator(certificateTitle), acceptCertificateLabel).push(); } // "Finish" updateCenterWizardOper.btFinish().push(); } catch (JemmyException e) { // close possible error dialog // "Error" String errorTitle = Bundle.getString("org.netbeans.modules.autoupdate.Bundle", "CTL_Error"); if(JDialogOperator.findJDialog(errorTitle, true, true) != null) { new NbDialogOperator(errorTitle).close(); } // close Update center dialog if(updateCenterWizardOper != null) { updateCenterWizardOper.close(); } throw e; } finally { // restore default timeout JemmyProperties.setCurrentTimeout("ComponentOperator.WaitStateTimeout", oldWaitStateTime); } } }