Java Code Examples for org.netbeans.jemmy.operators.JComboBoxOperator#typeText()

The following examples show how to use org.netbeans.jemmy.operators.JComboBoxOperator#typeText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloseProjectPropertyTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void prepare(){

      Node pNode = new ProjectsTabOperator().getProjectRootNode(testProjectName);
      pNode.select();
      pNode.performPopupAction("Properties");
       
     jdo = new NbDialogOperator(testProjectName);
     JTreeOperator cattree = new JTreeOperator(jdo);       
     Node cNode = new Node(cattree,"Abilities") ;
     cNode.select();
      
     JButtonOperator addButton = new JButtonOperator(jdo,"Add");
     addButton.pushNoBlock();

     NbDialogOperator add_abil = new NbDialogOperator("Add Ability");
     JComboBoxOperator abilityCombo = new JComboBoxOperator(add_abil); 
     abilityCombo.clearText();
     abilityCombo.typeText("Ability_"+System.currentTimeMillis());
     JButtonOperator abil_okButton = new JButtonOperator(add_abil,"OK");
     abil_okButton.push();
     
  }
 
Example 2
Source File: WsValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Tests Call Web Service Operation action in a servlet
 */
public void testCallWsOperationInServlet() {
    assertServerRunning();
    //create a servlet
    //Web
    String webLabel = Bundle.getStringTrimmed("org.netbeans.modules.web.core.Bundle", "Templates/JSP_Servlet");
    //Servlet
    String servletLabel = Bundle.getStringTrimmed("org.netbeans.modules.web.core.Bundle", "Templates/JSP_Servlet/Servlet.java");
    createNewFile(getWsClientProject(), webLabel, servletLabel);
    NewJavaFileNameLocationStepOperator op = new NewJavaFileNameLocationStepOperator();
    JComboBoxOperator jcbo = new JComboBoxOperator(op, 1);
    jcbo.typeText("org.mycompany.servlets"); //NOI18N
    op.finish();
    //edit code in the servlet
    EditorOperator eo = new EditorOperator("NewServlet"); //NOI18N
    // add new line and select it
    eo.setCaretPosition("\"</h1>\");", false); //NOI18N
    eo.insert("\n//xxx"); //NOI18N
    eo.select("//xxx"); //NOI18N
    callWsOperation(eo, "myIntMethod", eo.getLineNumber()); //NOI18N
    assertTrue("@WebServiceRef has not been found", eo.contains("@WebServiceRef")); //NOI18N
    eo.close(true);
}
 
Example 3
Source File: ManageInspectionsOperatot.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void createNewConfiguration(String s) {
    JComboBoxOperator comboBox = new JComboBoxOperator(this, 1);
    comboBox.pushKey(KeyEvent.VK_N);
    new EventTool().waitNoEvent(500);
    for (int i = 0; i < 10; i++) {
        comboBox.pushKey(KeyEvent.VK_BACK_SPACE);
        new EventTool().waitNoEvent(100);
    }
    new EventTool().waitNoEvent(100);
    comboBox.typeText(s);
    comboBox.pushKey(KeyEvent.VK_ENTER);
}
 
Example 4
Source File: CreateNewIndexedProperty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** testType method */
public void testType() {
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_IDXPROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewIdxProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);

    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);       
    jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);        
    
    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.typeText(TYPE_WRONG);
    
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);

    new NbDialogOperator("Error").ok();
                          
    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_INDEX_PROPERTY);
    jComboBoxOperator.clearText();
    jComboBoxOperator.setSelectedItem("Double");
                   
    nbDialogOperator.ok();

    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();                       
}
 
Example 5
Source File: CreateNewNonIndexedProperty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** testType method */ 
public void testType() {

    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    
    
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.openide.src.nodes.Bundle", "LAB_Add")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "MENU_CREATE_PROPERTY"));
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_NewProperty");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);

    JTextFieldOperator jTextFieldOperator = new JTextFieldOperator(nbDialogOperator, 0);       
    jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
    
    JComboBoxOperator jComboBoxOperator = new JComboBoxOperator(nbDialogOperator, 0);
    jComboBoxOperator.typeText(TYPE_WRONG);
    nbDialogOperator.ok();

    new EventTool().waitNoEvent(3000);
    new NbDialogOperator("Error").ok();

    jTextFieldOperator.clearText();
    jTextFieldOperator.typeText(NAME_NON_INDEX_PROPERTY);
    jComboBoxOperator.clearText();
    jComboBoxOperator.setSelectedItem("Double");
                   
    nbDialogOperator.ok();
    new JavaNode(repositoryRootNode, sampleDir + "|" + NAME_TEST_FILE).open();

    EditorOperator eo = new EditorOperator(NAME_TEST_FILE);
    ref(eo.getText());
    compareReferenceFiles();                               
                                   
}
 
Example 6
Source File: FromDBTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testFromDB() throws IOException {
    createPU();
    copyDBSchema();
    //RESTful Web Services from Database
    String restLabel = Bundle.getStringTrimmed("org.netbeans.modules.websvc.rest.wizard.Bundle", "Templates/WebServices/RestServicesFromDatabase");
    NewFileWizardOperator nfwo = createNewWSFile(getProject(), restLabel);
    //Entity Classes from Database
    WizardOperator wo = prepareEntityClasses(nfwo, false);
    wo.next();
    JComboBoxOperator jcbo = new JComboBoxOperator(wo, 1);
    jcbo.clearText();
    jcbo.typeText(getRestPackage() + ".service"); //NOI18N
    // sometimes Finish button not enabled
    new EventTool().waitNoEvent(1500);
    wo.btFinish().pushNoBlock();
    wo.waitClosed();
    String generationTitle = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.persistence.wizard.fromdb.Bundle", "TXT_EntityClassesGeneration");
    waitDialogClosed(generationTitle, 180000); // wait 3 minutes
    new EventTool().waitNoEvent(1500);
    waitScanFinished();
    String packageName = getRestPackage() + ".service";
    Set<File> files = getFiles(packageName);
    if (!getJavaEEversion().equals(JavaEEVersion.JAVAEE5)) { // see http://netbeans.org/bugzilla/show_bug.cgi?id=189723
        assertEquals("Missing files in package " + packageName, 9, files.size()); //NOI18N
    } else {
        // Java EE 5 - see http://netbeans.org/bugzilla/show_bug.cgi?id=189723
        assertEquals("Missing files in package " + packageName, 8, files.size()); //NOI18N
        packageName = getRestPackage() + ".controller"; //NOI18N
        files = getFiles(packageName);
        assertEquals("Missing files in package " + packageName, 7, files.size()); //NOI18N
        packageName = getRestPackage() + ".controller.exceptions"; //NOI18N
        files = getFiles(packageName);
        assertEquals("Missing files in package " + packageName, 4, files.size()); //NOI18N
    }
    //make sure all REST services nodes are visible in project log. view
    waitRestNodeChildren(7);
}
 
Example 7
Source File: WebProjectValidation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Test new servlet wizard.
 * - open New File wizard from main menu (File|New File)
 * - select sample project as target
 * - select Web|Servlet file type
 * - in the next panel type name
 * - finish the wizard
 * - check file is open in editor and close it
 */
public void testNewServlet() throws IOException {
    // create a new package
    new ActionNoBlock("File|New File", null).perform();
    NewFileWizardOperator newFileWizard = new NewFileWizardOperator("New File");
    newFileWizard.selectProject(PROJECT_NAME);
    newFileWizard.selectCategory("Web");
    newFileWizard.selectFileType("Servlet");
    newFileWizard.next();
    JTextFieldOperator txtPackageName = new JTextFieldOperator(newFileWizard);
    // clear text field
    txtPackageName.setText("");
    txtPackageName.typeText("Servlet1");
    JComboBoxOperator txtPackage = new JComboBoxOperator(newFileWizard, 1);
    // clear text field
    txtPackage.clearText();
    txtPackage.typeText("test1");
    newFileWizard.next();
    new EventTool().waitNoEvent(300);
    if (JCheckBoxOperator.findJCheckBox((Container) newFileWizard.getSource(), "", false, false) != null) {
        // Add information to deployment descriptor (web.xml)
        new JCheckBoxOperator(newFileWizard).setSelected(true);
    }
    newFileWizard.finish();
    // check class is opened in Editor and close it
    new EditorOperator("Servlet1.java").close();
    // check the servlet is specified in web.xml
    if (J2EE_4.equals(getEEVersion()) && !PROJECT_NAME.equals("WebModuleNB36")) {
        WebPagesNode webPages = new WebPagesNode(PROJECT_NAME);
        webPages.setComparator(new Operator.DefaultStringComparator(true, true));
        Node webXml = new Node(webPages, "WEB-INF|web.xml");
        new EditAction().performPopup(webXml);
        String xmlText = new EditorOperator("web.xml").getText();
        new EditorOperator("web.xml").closeAllDocuments();
        String[] content = new String[]{
            "<servlet-name>Servlet1</servlet-name>",
            "<servlet-class>test1.Servlet1</servlet-class>",
            "<url-pattern>/Servlet1</url-pattern>"
        };
        for (int i = 0; i < content.length; i++) {
            assertTrue("Servlet is not correctly specifeid in web.xml."
                    + " Following line is missing in the web.xml:\n" + content[i],
                    xmlText.indexOf(content[i]) != -1);
        }
    }
}
 
Example 8
Source File: BasicSearchAndReplaceTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** bug 103067 */
public void testFindAndReplace() throws InterruptedException{
    
    ProjectsTabOperator pto = new ProjectsTabOperator();
    /** Create new Sample project - Java Application */
    String project = Utilities.createNewProject(PROJECT_NAME, DATA_PROJECT_NAME , workdirpath);
    
    /** open class main method in editor */
    Utilities.openFile("Source Packages|" + project + "|" + "main.java", project);
    
    
    /** write some code in main method */
    Utilities.takeANap(1000);
    sourceEdit();
    Utilities.takeANap(1000);
    
    /**
     * invoke search and replace dialog
     */
    
    //firstly Project root node should be selected
    ProjectRootNode prn = pto.getProjectRootNode(DATA_PROJECT_NAME);
    prn.select();
    
    //open find/replace dialog
    NbDialogOperator ndo = Utilities.getFindAndReplaceMainMenu();
    
    // Select selection radio button in scope section
    Utilities.scopeSelection(ndo, "selection");
    Utilities.takeANap(1000);
    
    // fill string Hello in search combobox
    JComboBoxOperator jcbo = new JComboBoxOperator(ndo, 0);
    jcbo.clearText();
    jcbo.typeText("Hello");
    Utilities.takeANap(100);
    
    // fill string "Hello World" which should replace Hello
    JComboBoxOperator jcbor = new JComboBoxOperator(ndo, 1);
    jcbor.enterText("Hello World");
    
    SearchResultsOperator sro = new SearchResultsOperator();
    assertTrue("Junit Output window should be visible", sro.isVisible());
    System.out.println("Search Window is visible");
    
    Utilities.takeANap(100);
    JButtonOperator replace = new JButtonOperator(sro, "Replace");
    replace.push();
    Utilities.takeANap(100);
    
    NbDialogOperator omyl = new NbDialogOperator("Question");
    JButtonOperator rescan = new JButtonOperator(omyl,"rescan");
    rescan.push();
    Utilities.takeANap(100);
    replace.push();
    
    // Close Find/Replace dialog
    Utilities.takeANap(100);
    sro.close();
    
    
    //check, if required string really replace previous one
    Utilities.openFile("Source Packages|" + project + "|" + "main.java", project);
    assertTrue("check in Editor 9b",Utilities.checkEditor("Hello World"));
    Utilities.takeANap(100);
    Utilities.checkEditor(project);
    
    /** delete already created project */;
    deleteProject();
    
    
}