Java Code Examples for org.netbeans.jemmy.operators.JTextFieldOperator#setText()

The following examples show how to use org.netbeans.jemmy.operators.JTextFieldOperator#setText() . 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: actionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void createForm(String formType, String name) throws InterruptedException {
    NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
    nfwo.selectProject(DATA_PROJECT_NAME);
    Thread.sleep(3000);
    nfwo.selectCategory("Swing GUI Forms");
    nfwo.selectFileType(formType);
    nfwo.next();
    JTextFieldOperator form_name = new JTextFieldOperator(nfwo, 0);
    form_name.setText(name);
    JComboBoxOperator jcb_package = new JComboBoxOperator(nfwo, 1);
    jcb_package.selectItem("data");
    Thread.sleep(3000);

    if (formType.equals("Bean Form")) {
        nfwo.next();
        JTextFieldOperator class_name = new JTextFieldOperator(nfwo);
        class_name.setText("javax.swing.JButton");
        nfwo.finish();
        log(formType + " is created correctly");
    } else {
        nfwo.finish();
        log(formType + " is created correctly");
        Thread.sleep(3000);
    }

}
 
Example 2
Source File: TemplateTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void openTemplate(String templateName, String category) throws InterruptedException {

        NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
        nfwo.selectProject(DATA_PROJECT_NAME);
        Thread.sleep(3000);
        nfwo.selectCategory(category);
        nfwo.selectFileType(templateName);
        nfwo.next();
        JComboBoxOperator jcb_package = new JComboBoxOperator(nfwo, 1);
        jcb_package.clearText();
       // jcb_package.enterText("data");
        Thread.sleep(1000);
        
        if (templateName.equals("Bean Form")) {
            nfwo.next();
            JTextFieldOperator class_name = new JTextFieldOperator(nfwo);
            class_name.setText("javax.swing.JButton");
            //nfwo.finish();

        } 
        nfwo.finish();
        Thread.sleep(2000);
        log(templateName + " is created correctly");

    }
 
Example 3
Source File: OpenTempl_defaultPackTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void openTemplate(String templateName, String category) throws InterruptedException {

        NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
        nfwo.selectProject(DATA_PROJECT_NAME);
        Thread.sleep(3000);
        nfwo.selectCategory(category);
        nfwo.selectFileType(templateName);
        nfwo.next();
        JComboBoxOperator jcb_package = new JComboBoxOperator(nfwo, 1);
        jcb_package.clearText();
        Thread.sleep(1000);

        if (templateName.equals("Bean Form")) {
            nfwo.next();
            JTextFieldOperator class_name = new JTextFieldOperator(nfwo);
            class_name.setText("javax.swing.JButton");
            nfwo.finish();
            log(templateName + " is created correctly");
        } else {
            nfwo.finish();
            log(templateName + " is created correctly");
            Thread.sleep(1000);
        }
        
    }
 
Example 4
Source File: CreateTestTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
     * Test creation accessed from popup menu
     * Without public methods and w/o protected methods and w/o friendly
     * should allow to create anything -- OK should be disabled
     */
    public void testCreateTestByPopup4() {
        //necessary to delete created tests from testCreateTestByPopup3
        Utilities.deleteNode(Utilities.TEST_PACKAGES_PATH +
                "|" + TEST_PACKAGE_NAME);
        
        Node n = Utilities.openFile(Utilities.SRC_PACKAGES_PATH +
                "|" + TEST_PACKAGE_NAME + "|" + Utilities.TEST_CLASS_NAME);
//        Utilities.pushCreateTestsPopup(n);
        n.performPopupActionNoBlock("Tools|Create/Update Tests");
        
        NbDialogOperator ndo = new NbDialogOperator(CREATE_TESTS_DIALOG);
        JCheckBoxOperator jbo = new JCheckBoxOperator(ndo, 3);//friendly methods
        System.out.println(jbo.getText());
        jbo.push();
        JTextFieldOperator tfo = new JTextFieldOperator(ndo);
        tfo.setText(tfo.getText() + ".");
        Utilities.takeANap(Utilities.ACTION_TIMEOUT);
        assertFalse(ndo.btOK().isEnabled()); // OK button should be disabled
        ndo.btCancel().push(); //cancel the dialog
    }
 
Example 5
Source File: AddingNewKeyAndValuesTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCreateNewBundle() {

        //open default project
        openDefaultProject();

        //Create new properties file
        NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
        nfwo.selectProject(DEFAULT_PROJECT_NAME);
        nfwo.selectCategory(WIZARD_CATEGORY_FILE);
        nfwo.selectFileType(WIZARD_FILE_TYPE);
        nfwo.next();

        NewJavaFileNameLocationStepOperator nfnlso = new NewJavaFileNameLocationStepOperator();
        nfnlso.setObjectName(BUNDLE_NAME);
        JTextFieldOperator jtfo = new JTextFieldOperator(nfnlso, 2);
        jtfo.setText("src/" + WORKING_PACKAGE);
        nfnlso.finish();

        //Check that bundle was created
        if (!existsFileInEditor(BUNDLE_NAME)) {
            fail("File " + BUNDLE_NAME + " not found in Editor window");
        }
        if (!existsFileInExplorer(WORKING_PACKAGE, BUNDLE_NAME + ".properties")) {
            fail("File " + BUNDLE_NAME + " not found in explorer");
        }
    }
 
Example 6
Source File: testNavigation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void GoToLine( int iLineToGo, int iLineToCome )
{
  EditorOperator eoPHP = new EditorOperator( "EmptyPHPWebPage.php" );
  eoPHP.clickForPopup( );
  JPopupMenuOperator menu = new JPopupMenuOperator( );
  eoPHP.typeKey('g', InputEvent.CTRL_MASK);
  JDialogOperator jdGoto = new JDialogOperator( "Go to Line or Bookmark" );
  JComboBoxOperator jcLine = new JComboBoxOperator( jdGoto, 0 );
  JTextFieldOperator jtTemp = jcLine.getTextField( );
  jtTemp.setText( "" + iLineToGo );
  JButtonOperator jbGoto = new JButtonOperator( jdGoto, "Go To" );
  jbGoto.push( );
  jdGoto.waitClosed( );
  int iLine = eoPHP.getLineNumber( );
  if( iLineToCome != iLine )
  {
    fail( "Navigate go to line came to incorrect one. Found: " + iLine + ", expected: " + iLineToCome );
  }
}
 
Example 7
Source File: WebProjectValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCreateTLD() {
    NewFileWizardOperator newFileWizard = NewFileWizardOperator.invoke();
    // prevent NPE when initializing tooltip (path selection)
    new EventTool().waitNoEvent(1000);
    newFileWizard.selectProject(PROJECT_NAME);
    newFileWizard.selectCategory("Web");
    newFileWizard.selectFileType("Tag Library Descriptor");
    newFileWizard.next();
    NewJavaFileNameLocationStepOperator nameAndLocationOper = new NewJavaFileNameLocationStepOperator();
    nameAndLocationOper.setObjectName("MyTags");
    nameAndLocationOper.cboLocation().selectItem("Web Pages");
    JLabelOperator jle = new JLabelOperator(nameAndLocationOper, "Folder");
    JTextFieldOperator folder = new JTextFieldOperator((JTextField) jle.getLabelFor());
    folder.setText("WEB-INF/tlds");
    nameAndLocationOper.finish();
    Node node = new Node(new WebPagesNode(PROJECT_NAME), "WEB-INF|tlds|MyTags.tld");
    // check class is opened in Editor and then close it
    new EditorOperator("MyTags.tld").close();
}
 
Example 8
Source File: ManageProfilesDialogOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void Duplicate(String profileNameOrig, String profileNameNew) {
        System.out.println("[TEST_DEBUG] Attempting to duplicate profile: " + profileNameOrig);
        new JListOperator(this).selectItem(profileNameOrig);
        new JButtonOperator(this, "Duplicate").push();
        NbDialogOperator confirmDupl = new NbDialogOperator("Create New Profile Dialog");
        JTextFieldOperator newName = new JTextFieldOperator(confirmDupl);
        newName.setText(profileNameNew);
        new JButtonOperator(confirmDupl, "OK").push();
        System.out.println("[TEST_DEBUG] Profile duplicated: " + profileNameOrig);
}
 
Example 9
Source File: ImportStandaloneProject.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void selectSingleProject(WizardOperator wizz, String workspace, String prjName) {
       JRadioButtonOperator importMode = new JRadioButtonOperator(wizz, 1);
       importMode.pushNoBlock();
       JTextFieldOperator txtProjectLocation = new JTextFieldOperator(wizz, 1);
       JTextFieldOperator txtImportLocation = new JTextFieldOperator(wizz, 2);
       String projectPath = getDataDir().getAbsolutePath() + File.separatorChar + workspace+ File.separatorChar +prjName;
log("Project Path = "+projectPath);
       txtProjectLocation.setText(projectPath);
       txtImportLocation.setText(projectPath);

   }
 
Example 10
Source File: ProjectImporterTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void selectProjectFromWS(WizardOperator wizz, String workspace, String projectToImport) {
    JTextFieldOperator txtWorkspaceLocation = new JTextFieldOperator(wizz, 0);
    String workspacePath = getDataDir().getAbsolutePath() + File.separatorChar + workspace;
    txtWorkspaceLocation.setText(workspacePath);
    wizz.next();
    JTableOperator projectsTable = new JTableOperator(wizz);
    TableModel model = projectsTable.getModel();
    selectProjectByName(model, projectToImport);
}
 
Example 11
Source File: InternationalizationTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void createNewPropertiesFile(Node node, String packageName, String fileName) {
    try {
        NewFileWizardOperator newWizard = NewFileWizardOperator.invoke(node, "Other", "Properties File");
        NewFileNameLocationStepOperator nfnlso = new NewFileNameLocationStepOperator();
        nfnlso.setObjectName(fileName);
        JTextFieldOperator jtfo = new JTextFieldOperator(nfnlso, 2);
        jtfo.setText(DEF_DIR + SEP + packageName);
        newWizard.finish();
        log("Properties file was correctly created");
    } catch (TimeoutExpiredException ex) {
        log("Creating of new properties file failed !!!");
    }

}
 
Example 12
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 13
Source File: MavenWebProjectValidation.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testNewMavenWebProject() throws IOException {
    runAndCancelUpdateIndex("central");
    runAndCancelUpdateIndex("Local");
    NewProjectWizardOperator projectWizard = NewProjectWizardOperator.invoke();
    projectWizard.selectCategory("Maven");
    projectWizard.selectProject("Web Application");
    projectWizard.next();
    WizardOperator mavenWebAppWizardOperator = new WizardOperator(projectWizard.getTitle());
    Component pnComp = new JLabelOperator(mavenWebAppWizardOperator, "Project Name").getLabelFor();
    JTextFieldOperator projectName = new JTextFieldOperator((JTextField) pnComp);
    projectName.setText(PROJECT_NAME);

    Component plComp = new JLabelOperator(mavenWebAppWizardOperator, "Project Location").getLabelFor();
    JTextFieldOperator projectLocation = new JTextFieldOperator((JTextField) plComp);
    projectLocation.setText(PROJECT_LOCATION);
    mavenWebAppWizardOperator.next();
    NewWebProjectServerSettingsStepOperator serverStep = new NewWebProjectServerSettingsStepOperator();
    if (JAVA_EE_5.equals(getEEVersion())) {
        serverStep.cboJavaEEVersion().selectItem("1.5");
    } else if (JAVA_EE_6.equals(getEEVersion())) {
        serverStep.cboJavaEEVersion().selectItem("1.6-web");
    } else if (JAVA_EE_7.equals(getEEVersion())) {
        serverStep.cboJavaEEVersion().selectItem("1.7-web");
    } else if (JAVA_EE_8.equals(getEEVersion())) {
        serverStep.cboJavaEEVersion().selectItem("1.8-web");
    }
    serverStep.finish();
    // need to increase time to wait for project node
    long oldTimeout = JemmyProperties.getCurrentTimeout("ComponentOperator.WaitComponentTimeout");
    JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 240000);
    try {
        if (JAVA_EE_7.equals(getEEVersion())) {
            verifyWebPagesNode("index.html");
        } else {
            verifyWebPagesNode("index.jsp");
        }
    } finally {
        JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", oldTimeout);
    }
    // disable compile on save
    new ActionNoBlock(null, "Properties").perform(new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME));
    // "Project Properties"
    NbDialogOperator propertiesDialogOper = new NbDialogOperator("Project Properties");
    // select "Build|Compile" category
    new Node(new JTreeOperator(propertiesDialogOper), "Build|Compile").select();
    // untick checkbox
    JCheckBoxOperator cosCheckBox = new JCheckBoxOperator(propertiesDialogOper,
            Bundle.getStringTrimmed("org.netbeans.modules.maven.customizer.Bundle",
                    "CompilePanel.cbCompileOnSave.text"));
    cosCheckBox.doClick();
    // not display browser on run
    new Node(new JTreeOperator(propertiesDialogOper),
            Bundle.getString("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_Config_Run")).select();
    new JCheckBoxOperator(propertiesDialogOper,
            Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle",
                    "LBL_CustomizeRun_DisplayBrowser_JCheckBox")).setSelected(false);
    // confirm properties dialog
    propertiesDialogOper.ok();
    waitScanFinished();
}
 
Example 14
Source File: ExportDiffPatchTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testInvokeExportDiffPatch() throws Exception {
    try {
        if (TestKit.getOsName().indexOf("Mac") > -1) {
            NewProjectWizardOperator.invoke().close();
        }
        NbDialogOperator dialog;
        
        TestKit.showStatusLabels();
        
        stream = new PrintStream(new File(getWorkDir(), getName() + ".log"));
        TestKit.prepareGitProject(TestKit.PROJECT_CATEGORY, TestKit.PROJECT_TYPE, TestKit.PROJECT_NAME);
        new EventTool().waitNoEvent(2000);

        while (IndexingBridge.getInstance().isIndexingInProgress()) {
            Thread.sleep(3000);
        }

        Node node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|Main.java");
        node.performPopupAction("Git|Show Changes");
        new EventTool().waitNoEvent(2000);
        
        //modify file
        node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|Main.java");
        node.performPopupAction("Open");
        EditorOperator eo = new EditorOperator("Main.java");
        eo.deleteLine(2);
        eo.insert(" insert", 10, 18);
        eo.insert("\tSystem.out.println(\"\");\n", 19, 1);
        eo.save();
        
        new EventTool().waitNoEvent(2000);
        VersioningOperator vo = VersioningOperator.invoke();
        vo = VersioningOperator.invoke();
        new EventTool().waitNoEvent(8000);
        //Save action should change the file annotations
        org.openide.nodes.Node nodeIDE = (org.openide.nodes.Node) node.getOpenideNode();
        String color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
        String status = TestKit.getStatus(nodeIDE.getHtmlDisplayName());
        assertEquals("Wrong color of node - file color should be new!!!", TestKit.MODIFIED_COLOR, color.toUpperCase());
        assertEquals("Wrong annotation of node - file status should be new!!!", TestKit.MODIFIED_STATUS, status);
        assertEquals("Wrong number of records in Versioning view!!!", 1, vo.tabFiles().getRowCount());
        
        new EventTool().waitNoEvent(2000);
        
        node.performMenuActionNoBlock("Team|Patches|Export Uncommitted Changes...");
        //Operator.setDefaultStringComparator(oldOperator);
        
        dialog = new NbDialogOperator("Export Diff Patch");
        JButtonOperator btn = new JButtonOperator(dialog, "OK");


        JRadioButtonOperator rbtno = new JRadioButtonOperator(dialog, "Save as File");
        rbtno.push();

        JTextFieldOperator tf = new JTextFieldOperator(dialog, 2);

        String patchFile = "/tmp/patch" + System.currentTimeMillis() + ".patch";
        File file = new File(patchFile);
        tf.setText(file.getCanonicalFile().toString()); 

        btn.push();

        new EventTool().waitNoEvent(3000);

        BufferedReader br = new BufferedReader(new FileReader(file));
        String line = br.readLine();
        boolean generated = false;
        if (line != null) {
            generated = line.indexOf("diff --git") != -1 ? true : false;
        }
        
        br.close();
        assertTrue("Diff Patch file is empty!", generated);
        
        new EventTool().waitNoEvent(2000);
        stream.flush();
        stream.close();
        TestKit.closeProject(PROJECT_NAME);
    } catch (Exception e) {
        TestKit.closeProject(PROJECT_NAME);
        throw new Exception("Test failed: " + e);
    }
}
 
Example 15
Source File: CreatingPropertiesFileFromMainWindow1Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * This method contains body of test
 * @return void
 */
public void testCreatingPropertiesFileFromMainWindow1() {

    // open project
    openDefaultProject();

    /*
     * 1st step of testcase ( here is used toolbar's icon for opening wizard )
     * There will be opened New Wizard from Main Window Toolbar ( icon 'New' from toolbar 'System' )
     */

    MainWindowOperator mainWindowOp = MainWindowOperator.getDefault();
    mainWindowOp.menuBar().pushMenuNoBlock("File" + menuSeparator + "New File...", menuSeparator);

    /*
     * 2nd step of testcase
     * Select from wizard Other|Properties File and click next button.
     */
    NewFileWizardOperator newWizard = new NewFileWizardOperator();
    newWizard.selectCategory(WIZARD_CATEGORY_FILE);
    newWizard.selectFileType(WIZARD_FILE_TYPE);
    newWizard.next();


    /*
     * 3rd step of testcase
     * (here is nothing happen)
     * There is set default name and package. Do not change these values
     * ( package must be added because autotemed tests add jars and mount file-
     * systems witch are don't have deterministic order
     */
    // it must be selected a Folder to place the file ( is this a bug ? )
    NewJavaFileNameLocationStepOperator nameStepOper = new NewJavaFileNameLocationStepOperator();
    JTextFieldOperator jtfo = new JTextFieldOperator(nameStepOper, 2);
    jtfo.setText("src");

    /*
     * 4th step of testcase
     * Confirm wizard
     */
    newWizard.finish();


    /*
     *  Result
     * Should be added new properties file (with default name) to adequate place in
     * explorer and opened in editor.
     */
    if (!existsFileInEditor(WIZARD_DEFAULT_PROPERTIES_FILE_NAME)) {
        fail("File " + WIZARD_DEFAULT_PROPERTIES_FILE_NAME + " not found in Editor window");
    }
    if (!existsFileInExplorer("<default package>", WIZARD_DEFAULT_PROPERTIES_FILE_NAME + ".properties")) {
        fail("File " + WIZARD_DEFAULT_PROPERTIES_FILE_NAME + " not found in explorer");
    }

}
 
Example 16
Source File: CreatingPropertiesFileFromMainWindow2Test.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * This method contain body of test
 * @return void
 */
public void testCreatingPropertiesFileFromMainWindow2() {

    // open project
    openProject(PROJECT_NAME);
    //openDefaultProject();


    /*
     * 1st step of testcase ( here is used toolbar's icon for opening wizard )
     * There will be opened New Wizard from Main Window Toolbar ( icon 'New File...' from toolbar 'System' )
     */
    MainWindowOperator mainWindowOp = MainWindowOperator.getDefault();
    mainWindowOp.getToolbarButton(mainWindowOp.getToolbar("File"), "New File...").pushNoBlock();


    /*
     * 2nd step of testcase
     * Select from wizard Other|Properties File and click next button.
     */
    NewFileWizardOperator nwo = new NewFileWizardOperator();
    nwo.selectProject(PROJECT_NAME);
    nwo.selectCategory(WIZARD_CATEGORY_FILE);
    nwo.selectFileType(WIZARD_FILE_TYPE);
    nwo.next();

    /*
     * 3rd step of testcase
     * Type name and select directory.
     */
    NewJavaFileNameLocationStepOperator nfnlsp = new NewJavaFileNameLocationStepOperator();
    nfnlsp.setObjectName(FILE_NAME);
    JTextFieldOperator jtfo = new JTextFieldOperator(nfnlsp, 2);
    jtfo.setText("src" + File.separator + "examples");



    /*
     * 4th step of testcase
     * Confirm wizard
     */
    nfnlsp.finish();


    /*
     *  Result
     * Should be added new properties file to adequate place in explorer and opened in editor
     */
    if (!existsFileInEditor(FILE_NAME)) {
        fail("File " + FILE_NAME + " not found in Editor window");
    }
    if (!existsFileInExplorer("examples", FILE_NAME)) {
        fail("File " + FILE_NAME + " not found in explorer");
    }


}
 
Example 17
Source File: AcceptanceTestCaseXSD.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void AddItInternal(
    int iColumn,
    String sItName,
    String sMenuToAdd,
    String sRadioName,
    String sTypePath,
    String sAddedName
  )
{
  // Swicth to Schema view
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("View|Editors|Schema");

  // Select first column, Attributes
  SchemaMultiView opMultiView = new SchemaMultiView( JAXB_PACKAGE_NAME + ".xsd" );
  opMultiView.switchToSchema( );
  opMultiView.switchToSchemaColumns( );
  JListOperator opList = opMultiView.getColumnListOperator( iColumn );
  opList.selectItem( sItName );

  // Right click on Reference Schemas
  int iIndex = opList.findItemIndex( sItName );
  Point pt = opList.getClickPoint( iIndex );
  opList.clickForPopup( pt.x, pt.y );

  // Click Add Attribute...
  JPopupMenuOperator popup = new JPopupMenuOperator( );
  popup.pushMenuNoBlock( sMenuToAdd + "..." );

  // Get dialog
  JDialogOperator jadd = new JDialogOperator( sMenuToAdd.replace( "|", " " ) );

  // Set unique name
  JTextFieldOperator txt = new JTextFieldOperator( jadd, 0 );
  txt.setText( sAddedName );

  // Use existing definition
  if( null != sRadioName )
  {
    JRadioButtonOperator jex = new JRadioButtonOperator( jadd, sRadioName );
    jex.setSelected( true );
  }

  // Get tree
  if( null != sTypePath )
  {
    JTreeOperator jtree = new JTreeOperator( jadd, 0 );
    TreePath path = jtree.findPath( sTypePath );
  
    jtree.selectPath( path );
    jtree.clickOnPath( path );
  }

  // Close
  JButtonOperator jOK = new JButtonOperator( jadd, "OK" ); // TODO : OK
  jOK.push( );
  jadd.waitClosed( );

  // Check attribute was added successfully
  opList = opMultiView.getColumnListOperator( iColumn + 1 );
  iIndex = opList.findItemIndex( sAddedName );
  if( -1 == iIndex )
    fail( "It was not added." );

}