Java Code Examples for org.netbeans.jemmy.operators.JButtonOperator#push()

The following examples show how to use org.netbeans.jemmy.operators.JButtonOperator#push() . 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: IncrementalSearchTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testPrevButton() {
    openDefaultProject();
    openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
    EditorOperator editor = new EditorOperator("match.txt");
    editor.setCaretPosition(3, 1);
    SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
    JTextComponentOperator t = barOperator.findCombo();
    t.clearText();
    new EventTool().waitNoEvent(100);
    t.typeText("abc");
    JButtonOperator b = barOperator.prevButton();
    b.push();
    assertSelection(editor, 4, 7);
    b.push();
    assertSelection(editor, 0, 3);
    t.pushKey(KeyEvent.VK_ESCAPE);
    new EventTool().waitNoEvent(100);
    assertFalse("ToolBar not closed",barOperator.isVisible());
    editor.closeDiscard();        
}
 
Example 2
Source File: GeneralPHP.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setMethodParametersWrappingOptions(int state) {

        JDialogOperator window = selectPHPFromEditorOptions(1, getPlatform());

        //categories - check if they are all present
        JComboBoxOperator category = new JComboBoxOperator(window, 2);
        category.selectItem(5);

        JComboBoxOperator wrappingCombo = new JComboBoxOperator(window, 2);
        if (state == 0) {
            wrappingCombo.selectItem(2);
        }
        if (state == 1) {
            wrappingCombo.selectItem(0);
        }
        if (state == 2) {
            wrappingCombo.selectItem(1);
        }
        Sleep(10000);
        JButtonOperator jbOK = new JButtonOperator(window, "OK");
        jbOK.push();
        Sleep(1000);
        window.waitClosed();
    }
 
Example 3
Source File: JSpinnerDriver.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void scroll(ComponentOperator oper, ScrollAdjuster adj) {
    JButtonOperator increaseButton = ((JSpinnerOperator) oper).getIncreaseOperator();
    JButtonOperator decreaseButton = ((JSpinnerOperator) oper).getDecreaseOperator();
    if (adj.getScrollDirection() == ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION) {
        return;
    }
    int originalDirection = adj.getScrollDirection();
    while (adj.getScrollDirection() == originalDirection) {
        if (originalDirection == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
            increaseButton.push();
        } else {
            decreaseButton.push();
        }
    }
}
 
Example 4
Source File: OpenTempl_defaultPackTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void begin() throws InterruptedException {
    DeleteDir.delDir(workdirpath + System.getProperty("file.separator") + DATA_PROJECT_NAME);
    Thread.sleep(2000);
    mainWindow = MainWindowOperator.getDefault();
    NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();
    npwo.selectCategory(PROJECT_NAME);
    npwo.selectProject("Java Application");
    npwo.next();

    NewJavaProjectNameLocationStepOperator tfo_name = new NewJavaProjectNameLocationStepOperator();
    tfo_name.txtProjectName().setText(DATA_PROJECT_NAME);

    NewJavaProjectNameLocationStepOperator tfo1_location = new NewJavaProjectNameLocationStepOperator();
    tfo_name.txtLocation().setText(workdirpath);
    JButtonOperator bo = new JButtonOperator(npwo, "Finish");
    //bo.getSource().requestFocus();
    bo.push();

    log("Project " + DATA_PROJECT_NAME + " was created");
    Thread.sleep(2000);

}
 
Example 5
Source File: Autoupdate.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void CheckUpdated( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );

  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  jtTabs.setSelectedIndex( jtTabs.findPage( "Updated" ) );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example 6
Source File: IncrementalSearchTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testCloseButton() {
    openDefaultProject();
    openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
    EditorOperator editor = new EditorOperator("match.txt");
    editor.setCaretPosition(3, 1);
    SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
    JTextComponentOperator t = barOperator.findCombo();
    JButtonOperator b = barOperator.closeButton();
    b.push();
    new EventTool().waitNoEvent(250);        
    assertFalse("ToolBar not closed",barOperator.isVisible());
    editor.closeDiscard();
}
 
Example 7
Source File: CheckoutContentTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testCheckoutContent() throws Exception {
    try {
        MessageHandler mh = new MessageHandler("Checking out");
        log.addHandler(mh);

        comOperator = new Operator.DefaultStringComparator(true, true);
        oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
        Operator.setDefaultStringComparator(comOperator);
        CheckoutWizardOperator co = CheckoutWizardOperator.invoke();
        Operator.setDefaultStringComparator(oldOperator);
        RepositoryStepOperator rso = new RepositoryStepOperator();
        
        //create repository...
        File work = new File(TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis());
        new File(TMP_PATH).mkdirs();
        work.mkdirs();
        RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH));
        RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH);
        RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump");
        rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false));
        
        rso.next();
        WorkDirStepOperator wdso = new WorkDirStepOperator();
        wdso.setRepositoryFolder("trunk/JavaApp/src");
        wdso.checkCheckoutContentOnly(true);
        wdso.setLocalFolder(work.getCanonicalPath());
        wdso.finish();

        TestKit.waitText(mh);
        
        NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed");
        new JButtonOperator(nbdialog, "Create Project...");
        JButtonOperator close = new JButtonOperator(nbdialog, "Close");
        close.push();
    } catch (Exception e) {
        throw new Exception("Test failed: " + e);
    } finally {
        TestKit.closeProject(PROJECT_NAME);
    }    
}
 
Example 8
Source File: SyntaxHighlightTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void changeSetting(int category,int color) {
       OptionsOperator odop = OptionsOperator.invoke();
odop.selectFontAndColors();
JTabbedPaneOperator jtpo = new JTabbedPaneOperator(odop, "Syntax");
jtpo.selectPage(0);
JListOperator jlo = new JListOperator(jtpo, 0);
jlo.selectItem(category);
JComboBoxOperator jcbo = new JComboBoxOperator(jtpo, 1); //change FG
jcbo.selectItem(color); //select fg color
JButtonOperator okOperator = new JButtonOperator(odop, "OK");
okOperator.push(); //confirm OD
   }
 
Example 9
Source File: GeneralPHP.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void SetPhpVersion(String sProject, int version) {
    // Open project properties
    ProjectsTabOperator pto = new ProjectsTabOperator();
    ProjectRootNode prn = pto.getProjectRootNode(sProject);
    prn.select();
    prn.callPopup();
    JPopupMenuOperator popup = new JPopupMenuOperator();
    popup.pushMenuNoBlock("Properties");
    JDialogOperator jdProperties = new JDialogOperator("Project Properties - ");
    // Set support
    JComboBoxOperator box = new JComboBoxOperator(jdProperties, 1);
    switch (version) {
        case 2:
            box.selectItem(0);
            break;
        case 3:
            box.selectItem(1);
            break;
        case 4:
            box.selectItem(2);
            break;
        default:
            box.selectItem(2);
            break;
    }
    //Sleep( 10000 );
    // Close dialog
    JButtonOperator bOk = new JButtonOperator(jdProperties, "OK");
    bOk.push();
    jdProperties.waitClosed();
}
 
Example 10
Source File: TextFieldDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void dateTextField(JFrameOperator jfo) throws Exception {
    JTextFieldOperator jtfo = new JTextFieldOperator(jfo,
            new ByClassChooser(JFormattedTextField.class));
    ContainerOperator<?> containerOperator = new ContainerOperator<>(jtfo.getParent());
    JButtonOperator jbo = new JButtonOperator(containerOperator, GO);
    JLabelOperator dowLabel = new JLabelOperator(containerOperator);
    Calendar calendar = Calendar.getInstance(Locale.ENGLISH);

    // Check default date Day of the Week
    jbo.push();
    dowLabel.waitText(calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.ENGLISH));

    // Check Custom Day of the Week
    calendar.set(2012, 9, 11); // Represents "Oct 11, 2012"
    Date date = calendar.getTime();
    String dateString = jtfo.getQueueTool().invokeAndWait(
            new QueueTool.QueueAction<String>("Formatting the value using JFormattedTextField formatter") {

        @Override
        public String launch() throws Exception {
            return ((JFormattedTextField) jtfo.getSource()).getFormatter().valueToString(date);
        }
    });
    System.out.println("dateString = " + dateString);
    jtfo.enterText(dateString);

    jbo.push();
    dowLabel.waitText("Thursday");
}
 
Example 11
Source File: Autoupdate.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void CheckDownloaded( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );

  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  jtTabs.setSelectedIndex( jtTabs.findPage( "Downloaded" ) );

  // Check buttons
  JButtonOperator jbAdd = new JButtonOperator( jdPlugins, "Add Plugins..." );
  JButtonOperator jbInstall = new JButtonOperator( jdPlugins, "Install" );

  // Check table
  JTableOperator jtTable = new JTableOperator( jdPlugins, 0 );
  int iOriginalRows = jtTable.getRowCount( );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example 12
Source File: MergeUiTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testInvokeCloseMerge() throws Exception {
        try {
            MessageHandler mh = new MessageHandler("Checking out");
            log.addHandler(mh);
            TestKit.closeProject(PROJECT_NAME);
            if (TestKit.getOsName().indexOf("Mac") > -1)
                NewProjectWizardOperator.invoke().close();
            comOperator = new Operator.DefaultStringComparator(true, true);
            oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
            Operator.setDefaultStringComparator(comOperator);
            CheckoutWizardOperator.invoke();
            Operator.setDefaultStringComparator(oldOperator);
            RepositoryStepOperator rso = new RepositoryStepOperator();

            //create repository...
            File work = new File(TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis());
            new File(TMP_PATH).mkdirs();
            work.mkdirs();
            RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH));
            RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH);
            RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump");
            rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false));

            rso.next();
            WorkDirStepOperator wdso = new WorkDirStepOperator();
            wdso.setRepositoryFolder("trunk/" + PROJECT_NAME);
            wdso.setLocalFolder(work.getCanonicalPath());
            wdso.checkCheckoutContentOnly(false);

            wdso.finish();
            TestKit.waitText(mh);

            NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed");
            JButtonOperator open = new JButtonOperator(nbdialog, "Open Project");
            open.push();
            TestKit.waitForScanFinishedSimple();

            Node projNode = new Node(new ProjectsTabOperator().tree(), PROJECT_NAME);
            MergeOperator mo = MergeOperator.invoke(projNode);

            Thread.sleep(3000);
            //0. one repository operator
            mo.cboMergeFrom().selectItem(0);
            MergeOneRepoOperator moro = new MergeOneRepoOperator();
            moro.setRepositoryFolder("branches");
            assertEquals("Setting repository folder problem", "branches", moro.getRepositoryFolder());
//            moro.verify();
            moro.close();
//            RepositoryBrowserOperator rbo = moro.browseRepository();
            //moro.selectRepositoryFolder("ok");
            
            
////            assertEquals("Wrong folder selection!!!", "tags", moro.getRepositoryFolder());
//            moro.setRepositoryFolder("");
//            //1. two repository operator
//            moro.cboMergeFrom().selectItem(2);
//            MergeTwoRepoOperator mtro = new MergeTwoRepoOperator();
//            //mtro.verify();
//            rbo = mtro.browseRepositoryFolder1();
////            rbo.selectFolder("trunk");
////            rbo.selectFolder("branches");
////            rbo.selectFolder("tags");
//            rbo.ok();
//            assertEquals("Wrong folder selection!!!", "tags", mtro.getRepositoryFolder1());
//            mtro.setRepositoryFolder1("");
//            rbo = mtro.browseRepositoryFolder2();
////            rbo.selectFolder("tags");
////            rbo.selectFolder("branches");
////            rbo.selectFolder("trunk");
//            rbo.ok();
//            assertEquals("Wrong folder selection!!!", "trunk", mtro.getRepositoryFolder2());
//            mtro.setRepositoryFolder2("");
//
//            //2. two repository operator
//            moro.cboMergeFrom().selectItem(1);
//            MergeOriginOperator moo = new MergeOriginOperator();
//            //moo.verify();
//            rbo = moo.browseRepositoryFolder();
////            rbo.selectFolder("trunk");
////            rbo.selectFolder("branches");
////            rbo.selectFolder("tags");
        } catch (Exception e) {
            throw new Exception("Test failed: " + e);
        } finally {
            TestKit.closeProject(PROJECT_NAME);
        }
    }
 
Example 13
Source File: Autoupdate.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void CheckAvailablePlugins( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );

  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  jtTabs.setSelectedIndex( jtTabs.findPage( "Available Plugins" ) );

  Sleep( 1000 );

  // Check buttons
  JButtonOperator jbReload = new JButtonOperator( jdPlugins, "Reload Catalog" );
  JButtonOperator jbInstall = new JButtonOperator( jdPlugins, "Install" );

  // Check table
  JTableOperator jtTable = new JTableOperator( jdPlugins, 0 );
  int iOriginalRows = jtTable.getRowCount( );

  for( int i = 0; i < iOriginalRows; i++ )
  {
    // Check install disabled
    if( jbInstall.isEnabled( ) )
      fail( "Install button enabled without selection." );
    // Click first column
    jtTable.clickOnCell( i, 0 );
    // Check install enabled
    if( !jbInstall.isEnabled( ) )
      fail( "Install button disabled with selection." );

    // Check 
      // ToDo

    // Click first column
    jtTable.clickOnCell( i, 0 );
    // Check install disabled
    if( jbInstall.isEnabled( ) )
      fail( "Install button enabled without selection." );
  }

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );
  endTest( );
}
 
Example 14
Source File: Autoupdate.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void GeneralChecks( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );
  //try{ Dumper.dumpAll( "c:\\dump.txt" ); } catch( IOException ex ) { }

  // Wait for a while because tab selection might change.
  Sleep( 2000 );

  // Check tabs
  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  String[] asTabs =
  {
    "Updates",
    "Available Plugins",
    "Downloaded",
    "Installed",
    "Settings"
  };

  int iCount = jtTabs.getTabCount( );
  if( iCount != asTabs.length )
    fail( "Invalid number of tabs: " + iCount + ", expected: " + asTabs.length );
  for( int iIndex = 0; iIndex < asTabs.length; iIndex++ )
  {
    String sTitle = jtTabs.getTitleAt( iIndex );
    if( !sTitle.startsWith( asTabs[ iIndex ] ) )
      fail( "Invalid tab at index " + iIndex + ": \"" + sTitle + "\"" );
  }

  // Check buttons
  new JButtonOperator( jdPlugins, "Reload Catalog" );
  new JButtonOperator( jdPlugins, "Uninstall" );
  new JButtonOperator( jdPlugins, "Deactivate" );
  new JButtonOperator( jdPlugins, "Help" );

  // Check there is label
  new JLabelOperator( jdPlugins, "Search:" );

  // Check there is table operator
  new JTableOperator( jdPlugins, 0 );

  // Search text field
  JTextFieldOperator jtSearch = new JTextFieldOperator( jdPlugins, 0 );
  // Check does this field affect selection
  String sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  jtSearch.enterText( "java" );
  Sleep( 2000 );
  sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  if( !sSelected.matches( "Installed [(][0-9]+/[0-9]+[)]" ) )
    fail( "Invalid result of filtering." );
  jtSearch.enterText( "" );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example 15
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 16
Source File: RelocateTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void relocate() throws Exception {
    try {
        
        MessageHandler mh = new MessageHandler("Checking out");
        log.addHandler(mh);
        TestKit.closeProject(PROJECT_NAME);
        
        if (TestKit.getOsName().indexOf("Mac") > -1)
            NewProjectWizardOperator.invoke().close();

        comOperator = new Operator.DefaultStringComparator(true, true);
        oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
        Operator.setDefaultStringComparator(comOperator);
        CheckoutWizardOperator.invoke();
        Operator.setDefaultStringComparator(oldOperator);
        RepositoryStepOperator rso = new RepositoryStepOperator();

        //create repository...
        File work = new File(TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis());
        new File(TMP_PATH).mkdirs();
        work.mkdirs();
        RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH));
        RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH);
        RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump");
        rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false));

        rso.next();
        WorkDirStepOperator wdso = new WorkDirStepOperator();
        wdso.setRepositoryFolder("trunk/" + PROJECT_NAME);
        wdso.setLocalFolder(work.getCanonicalPath());
        wdso.checkCheckoutContentOnly(false);
        wdso.finish();

        //open project
        TestKit.waitText(mh);

        NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed");
        JButtonOperator open = new JButtonOperator(nbdialog, "Open Project");
        open.push();
        TestKit.waitForScanFinishedSimple();

        Node node = new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME);
        RelocateOperator ro = RelocateOperator.invoke(node);
        ro.verify();

        //empty New URL -> Relocate disabled
        ro.tfNewURL().typeText("");
        new EventTool().waitNoEvent(500);
        assertFalse(ro.btnRelocate().isEnabled());

        //fill New URL -> Relocate enabled
        ro.tfNewURL().typeText("http://repoURL/svn");
        new EventTool().waitNoEvent(500);
        assertTrue(ro.btnRelocate().isEnabled());

        ro.cancel();
        
    } catch (Exception e) {
        throw new Exception("Test failed: " + e);
    } finally {
        TestKit.closeProject(PROJECT_NAME);
    }
}
 
Example 17
Source File: CloseProjectPropertyTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ComponentOperator open(){
   JButtonOperator okButton = new JButtonOperator(jdo,"OK");
   okButton.push();
   return null;
}
 
Example 18
Source File: AcceptanceTestCase.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void CreateJAXBBindingInternal(
    String sBindingName,
    String sPackageName,
    String sApplicationName,
    String sBaseFile,
    boolean bSuppressInformation
  )
{
    // Create JAXB Binding
    NewFileWizardOperator opNewFileWizard = NewFileWizardOperator.invoke( );
    opNewFileWizard.selectCategory( JAXB_CATEGORY_NAME );
    opNewFileWizard.selectFileType( JAXB_COMPONENT_NAME );
    opNewFileWizard.next();

    JDialogOperator opCustomizer = new JDialogOperator( );
    new JTextFieldOperator( opCustomizer, 0 ).setText( sBindingName );

    new JButtonOperator( opCustomizer, 0 ).pushNoBlock( );
    JFileChooserOperator opFileChooser = new JFileChooserOperator( );
    opFileChooser.chooseFile( System.getProperty( "xtest.data" ) + File.separator + sBaseFile );

    if( bSuppressInformation )
    {
      JDialogOperator jinfo = new JDialogOperator( "Information" );
      JButtonOperator jbut = new JButtonOperator( jinfo, "OK" );
      jbut.push( );
      //jinfo.waitClose( );
    }

    new JTextFieldOperator( opCustomizer, 4 ).setText( sPackageName );

    new JCheckBoxOperator( opCustomizer, BUTTON_NAME_VERBOSE ).setSelected( true );

    // Ensure we will catch all with any slowness
    MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault( ).getStatusTextTracer( );
    stt.start( );

    opNewFileWizard.finish( );

    // Wait till JAXB really created
    int iWait = 2;
    while( true )
    {
      try
      {
        stt.waitText( "Finished building " + sApplicationName + " (jaxb-code-generation)." );
        break;
      }
      catch( JemmyException ex )
      {
        System.out.println( "--- ex" );
        if( 0 == --iWait )
          throw ex;
      }
    }
    stt.stop( );

    return;
}
 
Example 19
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." );

}
 
Example 20
Source File: SwitchUiTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testInvokeCloseSwitch() throws Exception {
       // try {
            MessageHandler mh = new MessageHandler("Checking out");
            log.addHandler(mh);
            TestKit.closeProject(PROJECT_NAME);
            if (TestKit.getOsName().indexOf("Mac") > -1)
                NewProjectWizardOperator.invoke().close();
            comOperator = new Operator.DefaultStringComparator(true, true);
            oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
            Operator.setDefaultStringComparator(comOperator);
            CheckoutWizardOperator.invoke();
            Operator.setDefaultStringComparator(oldOperator);
            RepositoryStepOperator rso = new RepositoryStepOperator();

            //create repository...
            File work = new File(TMP_PATH + File.separator + WORK_PATH + File.separator + "w" + System.currentTimeMillis());
            new File(TMP_PATH).mkdirs();
            work.mkdirs();
            RepositoryMaintenance.deleteFolder(new File(TMP_PATH + File.separator + REPO_PATH));
            RepositoryMaintenance.createRepository(TMP_PATH + File.separator + REPO_PATH);
            RepositoryMaintenance.loadRepositoryFromFile(TMP_PATH + File.separator + REPO_PATH, getDataDir().getCanonicalPath() + File.separator + "repo_dump");
            rso.setRepositoryURL(RepositoryStepOperator.ITEM_FILE + RepositoryMaintenance.changeFileSeparator(TMP_PATH + File.separator + REPO_PATH, false));

            rso.next();
            WorkDirStepOperator wdso = new WorkDirStepOperator();
            wdso.setRepositoryFolder("trunk/" + PROJECT_NAME);
            wdso.setLocalFolder(work.getCanonicalPath());
            wdso.checkCheckoutContentOnly(false);

            wdso.finish();
            TestKit.waitText(mh);

            NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed");
            JButtonOperator open = new JButtonOperator(nbdialog, "Open Project");
            open.push();
            TestKit.waitForScanFinishedSimple();
            
            Node projNode = new Node(new ProjectsTabOperator().tree(), PROJECT_NAME);
            Thread.sleep(2000);
            SwitchOperator so = SwitchOperator.invoke(projNode);
            Thread.sleep(2000);
            //only required nodes are expended - want to see all in browser
            so.setRepositoryFolder("");
//            RepositoryBrowserOperator rbo = so.browseRepositoryFolder();
            so.verify();
//            rbo.selectFolder("tags");
//            rbo.selectFolder("trunk");
//            rbo.selectFolder("branches");
//            rbo.ok();
//            assertEquals("Folder wasn't created", "branches", so.getRepositoryFolder());
            so.cancel();
        //} catch (Exception e) {
         //   throw new Exception("Test failed: " + e);
       // } finally {
            TestKit.closeProject(PROJECT_NAME);
       // }    
    }