You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2009/10/23 10:25:30 UTC

svn commit: r828964 - in /directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui: ./ bots/

Author: seelmann
Date: Fri Oct 23 08:25:30 2009
New Revision: 828964

URL: http://svn.apache.org/viewvc?rev=828964&view=rev
Log:
Added more helper bots

Added:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java
Modified:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DialogBot.java

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java?rev=828964&r1=828963&r2=828964&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java Fri Oct 23 08:25:30 2009
@@ -22,6 +22,8 @@
 
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
 import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
 
 import javax.naming.directory.Attribute;
@@ -34,14 +36,11 @@
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.integ.SiRunner;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.NewEntryWizardBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -62,6 +61,7 @@
 
     private StudioBot studioBot;
     private ConnectionsViewBot connectionsViewBot;
+    private BrowserViewBot browserViewBot;
 
     private SWTWorkbenchBot bot;
 
@@ -90,6 +90,7 @@
         studioBot.resetLdapPerspective();
         connectionsViewBot = studioBot.getConnectionView();
         connectionsViewBot.createTestConnection( "NewEntryWizardTest", ldapServer.getPort() );
+        browserViewBot = studioBot.getBrowserView();
 
         bot = new SWTWorkbenchBot();
     }
@@ -112,54 +113,55 @@
     @Test
     public void testCreateOrganizationEntry() throws Exception
     {
-        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
 
-        // open "New Entry" wizard
-        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Entry..." );
+        NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
+        assertTrue( wizardBot.isVisible() );
 
-        // select entry creation method
-        bot.radio( "Create entry from scratch" ).click();
-        bot.button( "Next >" ).click();
-
-        // select object classes
-        bot.table( 0 ).select( "organization" );
-        bot.button( "Add" ).click();
-        bot.button( "Next >" ).click();
-
-        // specify DN
-        SWTBotCombo typeCombo = bot.comboBox( "" );
-        typeCombo.setText( "o" );
-        SWTBotText valueText = bot.text( "" );
-        valueText.setText( "testCreateOrganizationEntry" );
-        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return bot.tree( 0 ) != null;
-            }
+        wizardBot.selectCreateEntryFromScratch();
 
+        assertFalse( wizardBot.isBackButtonEnabled() );
+        assertTrue( wizardBot.isNextButtonEnabled() );
+        assertFalse( wizardBot.isFinishButtonEnabled() );
+        assertTrue( wizardBot.isCancelButtonEnabled() );
 
-            public String getFailureMessage()
-            {
-                return "Could not find widget";
-            }
-        } );
+        wizardBot.clickNextButton();
 
-        // click finish to create the entry
-        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=testCreateOrganizationEntry" );
-            }
+        assertTrue( wizardBot.isBackButtonEnabled() );
+        assertFalse( wizardBot.isNextButtonEnabled() );
+        assertFalse( wizardBot.isFinishButtonEnabled() );
+        assertTrue( wizardBot.isCancelButtonEnabled() );
+
+        wizardBot.addObjectClasses( "organization" );
+        assertTrue( wizardBot.isObjectClassSelected( "top" ) );
+        assertTrue( wizardBot.isObjectClassSelected( "organization" ) );
+
+        assertTrue( wizardBot.isBackButtonEnabled() );
+        assertTrue( wizardBot.isNextButtonEnabled() );
+        assertFalse( wizardBot.isFinishButtonEnabled() );
+        assertTrue( wizardBot.isCancelButtonEnabled() );
+
+        wizardBot.clickNextButton();
+
+        assertTrue( wizardBot.isBackButtonEnabled() );
+        assertFalse( wizardBot.isNextButtonEnabled() );
+        assertFalse( wizardBot.isFinishButtonEnabled() );
+        assertTrue( wizardBot.isCancelButtonEnabled() );
 
+        wizardBot.setRdnType( 1, "o" );
+        wizardBot.setRdnValue( 1, "testCreateOrganizationEntry" );
 
-            public String getFailureMessage()
-            {
-                return "Could not find 'o=testCreateOrganizationEntry'";
-            }
-        } );
+        assertTrue( wizardBot.isBackButtonEnabled() );
+        assertTrue( wizardBot.isNextButtonEnabled() );
+        assertFalse( wizardBot.isFinishButtonEnabled() );
+        assertTrue( wizardBot.isCancelButtonEnabled() );
+
+        wizardBot.clickNextButton();
+
+        wizardBot.clickFinishButton();
+
+        browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "o=testCreateOrganizationEntry" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "o=testCreateOrganizationEntry" );
     }
 
 
@@ -172,64 +174,25 @@
     @Test
     public void testCreatePersonEntry() throws Exception
     {
-        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
 
-        // open "New Entry" wizard
-        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Entry..." );
+        NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
 
-        // select entry creation method
-        bot.radio( "Create entry from scratch" ).click();
-        bot.button( "Next >" ).click();
-
-        // select object classes
-        bot.table( 0 ).select( "inetOrgPerson" );
-        bot.button( "Add" ).click();
-        bot.button( "Next >" ).click();
-
-        // specify DN
-        SWTBotCombo typeCombo = bot.comboBox( "" );
-        typeCombo.setText( "cn" );
-        SWTBotText valueText = bot.text( "" );
-        valueText.setText( "testCreatePersonEntry" );
-        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return bot.tree( 0 ) != null;
-            }
-
-
-            public String getFailureMessage()
-            {
-                return "Could not find widget";
-            }
-        } );
-
-        // enter sn value
-        SWTBotTree tree = bot.tree( 0 );
-        tree.getTreeItem( "sn" ).doubleClick();
-
-        SWTBotText text = bot.text( "" );
-        text.setText( "test" );
-        // click to finish editing of sn
-        SWTBotTreeItem snNode = tree.getTreeItem( "sn" );
-        snNode.click();
+        wizardBot.selectCreateEntryFromScratch();
+        wizardBot.clickNextButton();
 
-        // click finish to create the entry
-        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "cn=testCreatePersonEntry" );
-            }
+        wizardBot.addObjectClasses( "inetOrgPerson" );
+        wizardBot.clickNextButton();
+
+        wizardBot.setRdnType( 1, "cn" );
+        wizardBot.setRdnValue( 1, "testCreatePersonEntry" );
+        wizardBot.clickNextButton();
 
+        wizardBot.setAttributeValue( "sn", 1, "test" );
+        wizardBot.clickFinishButton();
 
-            public String getFailureMessage()
-            {
-                return "Could not find 'cn=testCreatePersonEntry'";
-            }
-        } );
+        browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=testCreatePersonEntry" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=testCreatePersonEntry" );
     }
 
 
@@ -245,108 +208,48 @@
     @Test
     public void testCreateUpperCaseOrganizationEntries() throws Exception
     {
-        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
 
-        // open "New Entry" wizard
-        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Entry..." );
-
-        // select entry creation method
-        bot.radio( "Create entry from scratch" ).click();
-        bot.button( "Next >" ).click();
-
-        // select object classes
-        bot.table( 0 ).select( "organization" );
-        bot.button( "Add" ).click();
-        bot.button( "Next >" ).click();
-
-        // specify DN
-        SWTBotCombo typeCombo = bot.comboBox( "" );
-        typeCombo.setText( "O" );
-        SWTBotText valueText = bot.text( "" );
-        valueText.setText( "testCreateOrganizationEntry" );
-        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return bot.tree( 0 ) != null;
-            }
+        NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
 
+        wizardBot.selectCreateEntryFromScratch();
+        wizardBot.clickNextButton();
 
-            public String getFailureMessage()
-            {
-                return "Could not find widget";
-            }
-        } );
+        wizardBot.addObjectClasses( "organization" );
+        wizardBot.clickNextButton();
 
-        // click finish to create the entry
-        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry" );
-            }
+        wizardBot.setRdnType( 1, "O" );
+        wizardBot.setRdnValue( 1, "testCreateOrganizationEntry" );
+        wizardBot.clickNextButton();
 
+        wizardBot.clickFinishButton();
 
-            public String getFailureMessage()
-            {
-                return "Could not find 'O=testCreateOrganizationEntry'";
-            }
-        } );
+        browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry" );
 
         // Now create a second entry under the previously created entry
         // to ensure that the selected parent is also upper case.
 
-        // open "New Entry" wizard
-        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Entry..." );
-
-        // select entry creation method
-        bot.radio( "Create entry from scratch" ).click();
-        bot.button( "Next >" ).click();
-
-        // select object classes
-        bot.table( 0 ).select( "organization" );
-        bot.button( "Add" ).click();
-        bot.button( "Next >" ).click();
-
-        // specify DN
-        typeCombo = bot.comboBox( "" );
-        typeCombo.setText( "O" );
-        valueText = bot.text( "" );
-        valueText.setText( "testCreateOrganizationEntry2" );
-
-        // check preview text
-        SWTBotText previewText = bot.text( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system" );
-        assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system", previewText.getText() );
-
-        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return bot.tree( 0 ) != null;
-            }
-
-
-            public String getFailureMessage()
-            {
-                return "Could not find widget";
-            }
-        } );
+        wizardBot = browserViewBot.openNewEntryWizard();
 
-        // click finish to create the entry
-        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry2" );
-            }
+        wizardBot.selectCreateEntryFromScratch();
+        wizardBot.clickNextButton();
 
+        wizardBot.addObjectClasses( "organization" );
+        wizardBot.clickNextButton();
 
-            public String getFailureMessage()
-            {
-                return "Could not find 'O=testCreateOrganizationEntry2'";
-            }
-        } );
+        wizardBot.setRdnType( 1, "O" );
+        wizardBot.setRdnValue( 1, "testCreateOrganizationEntry2" );
+        assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system", wizardBot
+            .getDnPreview() );
+        wizardBot.clickNextButton();
+
+        wizardBot.clickFinishButton();
+
+        browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry",
+            "O=testCreateOrganizationEntry2" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry",
+            "O=testCreateOrganizationEntry2" );
     }
 
 
@@ -361,74 +264,26 @@
     @Test
     public void testCreateEntryWithSlash() throws Exception
     {
-        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
 
-        // open "New Entry" wizard
-        ContextMenuHelper.clickContextMenu( browserTree, "New", "New Entry..." );
+        NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
 
-        // select entry creation method
-        bot.radio( "Create entry from scratch" ).click();
-        bot.button( "Next >" ).click();
-
-        // select object classes
-        bot.table( 0 ).select( "krb5Principal" );
-        bot.button( "Add" ).click();
-        bot.table( 0 ).select( "person" );
-        bot.button( "Add" ).click();
-        bot.button( "Next >" ).click();
-
-        // specify DN
-        SWTBotCombo typeCombo = bot.comboBox( "" );
-        typeCombo.setText( "krb5PrincipalName" );
-        SWTBotText valueText = bot.text( "" );
-        valueText.setText( "kadmin/changepw@DOMAIN" );
-        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return bot.tree( 0 ) != null;
-            }
-
-
-            public String getFailureMessage()
-            {
-                return "Could not find entry editor";
-            }
-        } );
-
-        SWTBotTree tree = bot.tree( 0 );
-        SWTBotTreeItem krbNode = tree.getTreeItem( "krb5PrincipalName" );
-        // click to cancel editing attribute when pages becomes visible
-        krbNode.click();
-
-        // enter cn value
-        tree.getTreeItem( "cn" ).doubleClick();
-        bot.text( "" ).setText( "test" );
-        // click to finish editing of cn
-        krbNode.click();
-
-        // enter sn value
-        tree.getTreeItem( "sn" ).doubleClick();
-        bot.text( "" ).setText( "test" );
-        // click to finish editing of sn
-        krbNode.click();
+        wizardBot.selectCreateEntryFromScratch();
+        wizardBot.clickNextButton();
 
-        // click finish to create the entry
-        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
-        {
-            public boolean test() throws Exception
-            {
-                return browserTree.selection().get( 0 ).get( 0 )
-                    .startsWith( "krb5PrincipalName=kadmin/changepw@DOMAIN" );
-            }
+        wizardBot.addObjectClasses( "krb5Principal", "person" );
+        wizardBot.clickNextButton();
+
+        wizardBot.setRdnType( 1, "krb5PrincipalName" );
+        wizardBot.setRdnValue( 1, "kadmin/changepw@DOMAIN" );
+        wizardBot.clickNextButton();
 
+        wizardBot.setAttributeValue( "cn", 1, "test" );
+        wizardBot.setAttributeValue( "sn", 1, "test" );
+        wizardBot.clickFinishButton();
 
-            public String getFailureMessage()
-            {
-                return "Could not find entry 'krb5Principal=kadmin/changepw@DOMAIN'";
-            }
-        } );
+        browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "krb5PrincipalName=kadmin/changepw@DOMAIN" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "krb5PrincipalName=kadmin/changepw@DOMAIN" );
     }
 
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java?rev=828964&r1=828963&r2=828964&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java Fri Oct 23 08:25:30 2009
@@ -21,16 +21,17 @@
 package org.apache.directory.studio.test.integration.ui;
 
 
+import static junit.framework.Assert.assertTrue;
+
 import org.apache.directory.server.core.integ.Level;
 import org.apache.directory.server.core.integ.annotations.ApplyLdifFiles;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.integ.SiRunner;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.RenameEntryDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -52,8 +53,7 @@
 
     private StudioBot studioBot;
     private ConnectionsViewBot connectionsViewBot;
-
-    private SWTWorkbenchBot bot;
+    private BrowserViewBot browserViewBot;
 
 
     @Before
@@ -63,8 +63,7 @@
         studioBot.resetLdapPerspective();
         connectionsViewBot = studioBot.getConnectionView();
         connectionsViewBot.createTestConnection( "RenameEntryDialogTest", ldapServer.getPort() );
-
-        bot = new SWTWorkbenchBot();
+        browserViewBot = studioBot.getBrowserView();
     }
 
 
@@ -72,7 +71,6 @@
     public void tearDown() throws Exception
     {
         connectionsViewBot.deleteTestConnections();
-        bot = null;
     }
 
 
@@ -87,22 +85,17 @@
     @Test
     public void testRenameMultiValuedRdn() throws Exception
     {
-        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-
-        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
-            "cn=Barbara Jensen+uid=bjensen" );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen+uid=bjensen" );
 
-        bot.sleep( 2000 );
-        SWTBotMenu contextMenu = browserTree.contextMenu( "Rename Entry..." );
-        contextMenu.click();
-
-        bot.text( "Barbara Jensen" ).setText( "Babs Jensen" );
-        bot.text( "bjensen" ).setText( "babsjens" );
-        bot.button( "OK" ).click();
-
-        // ensure that the entry with the new name exists
-        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
-            "cn=Babs Jensen+uid=babsjens" );
+        RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
+        assertTrue( renameDialogBot.isVisible() );
+        renameDialogBot.setRdnValue( 1, "Babs Jensen" );
+        renameDialogBot.setRdnValue( 2, "babsjens" );
+        renameDialogBot.clickOkButton();
+
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Babs Jensen+uid=babsjens" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Babs Jensen+uid=babsjens" );
     }
 
 
@@ -117,20 +110,17 @@
     @Test
     public void testRenameRdnWithEscapedCharacters() throws Exception
     {
-        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-
-        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
-            "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
-
-        SWTBotMenu contextMenu = browserTree.contextMenu( "Rename Entry..." );
-        contextMenu.click();
-
-        // ensure that the unescaped value is in the text field
-        bot.text( "#\\+, \"\u00F6\u00E9\"" ).setText( "#\\+, \"\u00F6\u00E9\"2" );
-        bot.button( "OK" ).click();
+        browserViewBot
+            .selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
 
-        // ensure that the entry with the new name exists
-        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+        RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
+        assertTrue( renameDialogBot.isVisible() );
+        renameDialogBot.setRdnValue( 1, "#\\+, \"\u00F6\u00E9\"2" );
+        renameDialogBot.clickOkButton();
+
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"2" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
             "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"2" );
     }
 

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java?rev=828964&r1=828963&r2=828964&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java Fri Oct 23 08:25:30 2009
@@ -24,8 +24,9 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.directory.studio.test.integration.ui.SWTBotUtils;
+import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
 import org.eclipse.swtbot.swt.finder.results.VoidResult;
@@ -89,9 +90,23 @@
     }
 
 
+    public NewEntryWizardBot openNewEntryWizard()
+    {
+        ContextMenuHelper.clickContextMenu( getBrowserTree(), "New", "New Entry..." );
+        return new NewEntryWizardBot();
+    }
+
+
+    public RenameEntryDialogBot openRenameDialog()
+    {
+        ContextMenuHelper.clickContextMenu( getBrowserTree(), "Rename Entry..." );
+        return new RenameEntryDialogBot();
+    }
+
+
     private SWTBotTreeItem getEntry( String... path )
     {
-        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotTree browserTree = getBrowserTree();
         List<String> pathList = new ArrayList<String>( Arrays.asList( path ) );
         SWTBotTreeItem entry = null;
 
@@ -142,15 +157,15 @@
             {
                 public boolean test() throws Exception
                 {
-//                    if ( nextNode != null )
-//                    {
-//                        String adjustedNodeName = nextNode != null ? adjustNodeName( entry, nextNode ) : null;
-//                        SWTBotTreeItem node = entry.getNode( adjustedNodeName );
-//                        if ( node == null )
-//                        {
-//                            return false;
-//                        }
-//                    }
+                    //                    if ( nextNode != null )
+                    //                    {
+                    //                        String adjustedNodeName = nextNode != null ? adjustNodeName( entry, nextNode ) : null;
+                    //                        SWTBotTreeItem node = entry.getNode( adjustedNodeName );
+                    //                        if ( node == null )
+                    //                        {
+                    //                            return false;
+                    //                        }
+                    //                    }
                     return !entry.getNodes().contains( "Fetching Entries..." )
                         && !entry.getNodes().contains( "Opening Connection..." );
                 }
@@ -200,4 +215,13 @@
         return nodeName;
     }
 
+
+    private SWTBotTree getBrowserTree()
+    {
+        SWTBotView view = bot.viewByTitle( "LDAP Browser" );
+        view.show();
+        SWTBotTree tree = view.bot().tree();
+        return tree;
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DialogBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DialogBot.java?rev=828964&r1=828963&r2=828964&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DialogBot.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DialogBot.java Fri Oct 23 08:25:30 2009
@@ -21,6 +21,9 @@
 
 
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
 
 
 public abstract class DialogBot
@@ -35,9 +38,32 @@
     }
 
 
-    protected void clickButton( String buttonTitle )
+    protected void clickButton( final String buttonTitle )
     {
-        bot.button( buttonTitle ).click();
+        final SWTBotButton button = bot.button( buttonTitle );
+        if ( !button.isEnabled() )
+        {
+            bot.waitUntil( new ICondition()
+            {
+
+                public boolean test() throws Exception
+                {
+                    return button.isEnabled();
+                }
+
+
+                public void init( SWTBot bot )
+                {
+                }
+
+
+                public String getFailureMessage()
+                {
+                    return "Button " + buttonTitle + " is not enabled!";
+                }
+            } );
+        }
+        button.click();
     }
 
 }

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java?rev=828964&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java (added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java Fri Oct 23 08:25:30 2009
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+
+public class NewEntryWizardBot extends WizardBot
+{
+
+    public boolean isVisible()
+    {
+        return isVisible( "New Entry" );
+    }
+
+
+    public void selectCreateEntryFromScratch()
+    {
+        bot.radio( "Create entry from scratch" ).click();
+    }
+
+
+    public void addObjectClasses( String... objectClasses )
+    {
+        bot.table( 0 ).select( objectClasses );
+        bot.button( "Add" ).click();
+    }
+
+
+    public boolean isObjectClassSelected( String objectClass )
+    {
+        return bot.table( 1 ).containsItem( objectClass );
+    }
+
+
+    public void setRdnValue( int number, String text )
+    {
+        int index = number - 1;
+        bot.text( index ).setText( text );
+    }
+
+
+    public void setRdnType( int number, String text )
+    {
+        int index = number - 1 + 1; // the parent field is also an combo box
+        bot.comboBox( index ).setText( text );
+    }
+
+
+    public void setAttributeValue( String type, int number, String value )
+    {
+        SWTBotTree tree = bot.tree( 0 );
+
+        // click to finish editing of value
+        tree.getTreeItem( type ).click();
+
+        tree.getTreeItem( type ).doubleClick();
+        SWTBotText text = bot.text( "" );
+        text.setText( value );
+
+        // click to finish editing of value
+        tree.getTreeItem( type ).click();
+    }
+
+
+    public String getDnPreview()
+    {
+        for ( int i = 0;; i++ )
+        {
+            String text = bot.text( 1 ).getText();
+            if ( LdapDN.isValid( text ) )
+            {
+                return text;
+            }
+        }
+    }
+
+}

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java?rev=828964&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java (added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java Fri Oct 23 08:25:30 2009
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+public class RenameEntryDialogBot extends DialogBot
+{
+
+    public boolean isVisible()
+    {
+        return super.isVisible( "Rename Entry" );
+    }
+
+
+    public void clickOkButton()
+    {
+        super.clickButton( "OK" );
+    }
+
+
+    public void setRdnValue( int number, String text )
+    {
+        int index = number - 1;
+        bot.text( index ).setText( text );
+    }
+
+
+    public void setRdnType( int number, String text )
+    {
+        int index = number - 1;
+        bot.comboBox( index ).setText( text );
+    }
+
+}