directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r748537 [1/2] - /directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/
Date Fri, 27 Feb 2009 14:21:09 GMT
Author: seelmann
Date: Fri Feb 27 14:21:08 2009
New Revision: 748537

URL: http://svn.apache.org/viewvc?rev=748537&view=rev
Log:
Formatting

Modified:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
    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/ReferralDialogTest.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/SWTBotUtils.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java?rev=748537&r1=748536&r2=748537&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java Fri Feb 27 14:21:08 2009
@@ -20,48 +20,56 @@
 
 package org.apache.directory.studio.test.integration.ui;
 
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
 
+
 /**
  * Test suite to run all tests.
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache DirectoryProject</a>
  * @version $Rev$, $Date$
  */
-public class AutomatedSuite extends TestSuite {
+public class AutomatedSuite extends TestSuite
+{
 
-	public static Test suite() {
-		return new AutomatedSuite();
-	}
-
-	public AutomatedSuite() {
-		// Test Preparation: close welcome view
-		try {
-			SWTEclipseBot bot = new SWTEclipseBot();
-			bot.view("Welcome").close();
-		} catch (Exception e) {
-		}
-
-		// Test Connections view
-		addTest(new TestSuite(NewConnectionWizardTest.class));
-		
-		// Test Import/Export
-		addTest(new TestSuite(ImportExportTest.class));
-
-		// Test Browser view
-		addTest(new TestSuite(NewEntryWizardTest.class));
-		addTest(new TestSuite(RenameEntryDialogTest.class));
-		addTest(new TestSuite(ReferralDialogTest.class));
-
-		// Test Entry editor
-		addTest(new TestSuite(EntryEditorTest.class));
-
-		// Test allocated resources
-		// addTest( new TestSuite( SwtResourcesTest.class ) );
-	}
+    public static Test suite()
+    {
+        return new AutomatedSuite();
+    }
+
+
+    public AutomatedSuite()
+    {
+        // Test Preparation: close welcome view
+        try
+        {
+            SWTEclipseBot bot = new SWTEclipseBot();
+            bot.view( "Welcome" ).close();
+        }
+        catch ( Exception e )
+        {
+        }
+
+        // Test Connections view
+        addTest( new TestSuite( NewConnectionWizardTest.class ) );
+
+        // Test Import/Export
+        addTest( new TestSuite( ImportExportTest.class ) );
+
+        // Test Browser view
+        addTest( new TestSuite( NewEntryWizardTest.class ) );
+        addTest( new TestSuite( RenameEntryDialogTest.class ) );
+        addTest( new TestSuite( ReferralDialogTest.class ) );
+
+        // Test Entry editor
+        addTest( new TestSuite( EntryEditorTest.class ) );
+
+        // Test allocated resources
+        // addTest( new TestSuite( SwtResourcesTest.class ) );
+    }
 
 }
\ No newline at end of file

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java?rev=748537&r1=748536&r2=748537&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java Fri Feb 27 14:21:08 2009
@@ -20,185 +20,217 @@
 
 package org.apache.directory.studio.test.integration.ui;
 
+
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
 import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 
+
 /**
  * Tests the new entry wizard.
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class EntryEditorTest extends AbstractServerTest {
-	private SWTEclipseBot bot;
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		super.loadTestLdif(true);
-		bot = new SWTEclipseBot();
-		SWTBotUtils.openLdapPerspective(bot);
-		SWTBotUtils.createTestConnection(bot, "EntryEditorTest", ldapService
-				.getPort());
-	}
-
-	protected void tearDown() throws Exception {
-		SWTBotUtils.deleteTestConnections();
-		bot = null;
-		super.tearDown();
-	}
-
-	/**
-	 * Test to create a single organization entry.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testAddEditDeleteAttribute() throws Exception {
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(bot);
-		SWTBotUtils.selectEntry(bot, browserTree, false, "DIT", "Root DSE",
-				"ou=system", "ou=users", "cn=Barbara Jensen");
-
-		final SWTBotTree entryEditorTree = SWTBotUtils.getEntryEditorTree(bot);
-
-		// add description attribute
-		entryEditorTree.contextMenu("New Attribute...").click();
-		bot.comboBoxWithLabel("Attribute type:").setText("description");
-		SWTBotUtils.asyncClick(bot, bot.button("Finish"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.text("") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find empty description attribute";
-					}
-				});
-		bot.text("").setText("This is the 1st description.");
-		SWTBotUtils.asyncClick(bot, entryEditorTree.getTreeItem("objectClass"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return entryEditorTree.cell(6, 0).equals("description")
-								&& entryEditorTree.cell(6, 1).equals(
-										"This is the 1st description.");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find attribute 'description:This is the 1st description.'";
-					}
-				});
-
-		// add second value
-		entryEditorTree.getTreeItem("description").click();
-		SWTBotUtils.asyncClick(bot, entryEditorTree.contextMenu("New Value"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.text("") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find empty description attribute";
-					}
-				});
-		bot.text("").setText("This is the 2nd description.");
-		SWTBotUtils.asyncClick(bot, entryEditorTree.getTreeItem("objectClass"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return entryEditorTree.cell(7, 0).equals("description")
-								&& entryEditorTree.cell(7, 1).equals(
-										"This is the 2nd description.");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find attribute 'description:This is the 2nd description.'";
-					}
-				});
-
-		// edit second value
-		entryEditorTree.select(7);
-		SWTBotUtils.asyncClick(bot, entryEditorTree.contextMenu("Edit Value"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.text("This is the 2nd description.") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find description 'This is the 2nd description.'";
-					}
-				});
-		bot.text("This is the 2nd description.").setText(
-				"This is the 3rd description.");
-		SWTBotUtils.asyncClick(bot, entryEditorTree.getTreeItem("objectClass"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return entryEditorTree.cell(7, 0).equals("description")
-								&& entryEditorTree.cell(7, 1).equals(
-										"This is the 3rd description.");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find attribute 'description:This is the 3rd description.'";
-					}
-				});
-
-		// delete second value
-		entryEditorTree.select(7);
-		entryEditorTree.contextMenu("Delete Value").click();
-		SWTBotUtils.asyncClick(bot, bot.button("OK"), new DefaultCondition() {
-			public boolean test() throws Exception {
-				return !entryEditorTree.cell(7, 0).equals("description")
-						&& entryEditorTree.cell(6, 0).equals("description")
-						&& entryEditorTree.cell(6, 1).equals(
-								"This is the 1st description.");
-			}
-
-			public String getFailureMessage() {
-				return "Attribute 'description' is still there.";
-			}
-		});
-
-		// edit 1st value
-		entryEditorTree.select(6);
-		SWTBotUtils.asyncClick(bot, entryEditorTree.contextMenu("Edit Value"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.text("This is the 1st description.") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find description 'This is the 1st description.'";
-					}
-				});
-		bot.text("This is the 1st description.").setText(
-				"This is the final description.");
-		SWTBotUtils.asyncClick(bot, entryEditorTree.getTreeItem("objectClass"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return entryEditorTree.cell(6, 0).equals("description")
-								&& entryEditorTree.cell(6, 1).equals(
-										"This is the final description.");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find attribute 'description:This is the final description.'";
-					}
-				});
-
-		// delete 1st value/attribute
-		entryEditorTree.select(6);
-		entryEditorTree.contextMenu("Delete Value").click();
-		SWTBotUtils.asyncClick(bot, bot.button("OK"), new DefaultCondition() {
-			public boolean test() throws Exception {
-				return !entryEditorTree.cell(6, 0).equals("description");
-			}
-
-			public String getFailureMessage() {
-				return "Attribute 'description' is still there.";
-			}
-		});
+public class EntryEditorTest extends AbstractServerTest
+{
+    private SWTEclipseBot bot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        super.loadTestLdif( true );
+        bot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( bot );
+        SWTBotUtils.createTestConnection( bot, "EntryEditorTest", ldapService.getPort() );
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        bot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Test to create a single organization entry.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testAddEditDeleteAttribute() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Barbara Jensen" );
+
+        final SWTBotTree entryEditorTree = SWTBotUtils.getEntryEditorTree( bot );
+
+        // add description attribute
+        entryEditorTree.contextMenu( "New Attribute..." ).click();
+        bot.comboBoxWithLabel( "Attribute type:" ).setText( "description" );
+        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.text( "" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find empty description attribute";
+            }
+        } );
+        bot.text( "" ).setText( "This is the 1st description." );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return entryEditorTree.cell( 6, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 6, 1 ).equals( "This is the 1st description." );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find attribute 'description:This is the 1st description.'";
+            }
+        } );
+
+        // add second value
+        entryEditorTree.getTreeItem( "description" ).click();
+        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "New Value" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.text( "" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find empty description attribute";
+            }
+        } );
+        bot.text( "" ).setText( "This is the 2nd description." );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return entryEditorTree.cell( 7, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 7, 1 ).equals( "This is the 2nd description." );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find attribute 'description:This is the 2nd description.'";
+            }
+        } );
+
+        // edit second value
+        entryEditorTree.select( 7 );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "Edit Value" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.text( "This is the 2nd description." ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find description 'This is the 2nd description.'";
+            }
+        } );
+        bot.text( "This is the 2nd description." ).setText( "This is the 3rd description." );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return entryEditorTree.cell( 7, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 7, 1 ).equals( "This is the 3rd description." );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find attribute 'description:This is the 3rd description.'";
+            }
+        } );
+
+        // delete second value
+        entryEditorTree.select( 7 );
+        entryEditorTree.contextMenu( "Delete Value" ).click();
+        SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return !entryEditorTree.cell( 7, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 6, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 6, 1 ).equals( "This is the 1st description." );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Attribute 'description' is still there.";
+            }
+        } );
+
+        // edit 1st value
+        entryEditorTree.select( 6 );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "Edit Value" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.text( "This is the 1st description." ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find description 'This is the 1st description.'";
+            }
+        } );
+        bot.text( "This is the 1st description." ).setText( "This is the final description." );
+        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return entryEditorTree.cell( 6, 0 ).equals( "description" )
+                    && entryEditorTree.cell( 6, 1 ).equals( "This is the final description." );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find attribute 'description:This is the final description.'";
+            }
+        } );
+
+        // delete 1st value/attribute
+        entryEditorTree.select( 6 );
+        entryEditorTree.contextMenu( "Delete Value" ).click();
+        SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return !entryEditorTree.cell( 6, 0 ).equals( "description" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Attribute 'description' is still there.";
+            }
+        } );
 
-	}
+    }
 
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java?rev=748537&r1=748536&r2=748537&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java Fri Feb 27 14:21:08 2009
@@ -20,6 +20,7 @@
 
 package org.apache.directory.studio.test.integration.ui;
 
+
 import java.io.File;
 import java.net.URL;
 import java.util.List;
@@ -34,200 +35,231 @@
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 
+
 /**
  * Tests the import and export (LDIF, DSML).
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ImportExportTest extends AbstractServerTest {
-	private SWTEclipseBot eBot;
+public class ImportExportTest extends AbstractServerTest
+{
+    private SWTEclipseBot eBot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        super.loadTestLdif( false );
+        eBot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( eBot );
+        SWTBotUtils.createTestConnection( eBot, "ImportExportTest", ldapService.getPort() );
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        eBot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-395.
+     * 
+     * <li>export an entry with German umlaut in DN to LDIF</li> <li>verify that
+     * exported LDIF starts with the Base64 encoded DN</li> <li>delete the entry
+     * </li> <li>import the exported LDIF</li> <li>verify that entry with umlaut
+     * exists</li>
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testExportImportLdifWithGermanUmlautInDN() throws Exception
+    {
+        URL url = Platform.getInstanceLocation().getURL();
+        String file = url.getFile() + "ImportExportTest.ldif";
+
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
+
+        SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Wolfgang K\u00f6lbel" );
+
+        // export LDIF
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "LDIF Export..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "LDIF Export" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'LDIF Export'";
+            }
+        } );
+        eBot.button( "Next >" ).click();
+        eBot.comboBoxWithLabel( "LDIF File:" ).setText( file );
+        eBot.button( "Finish" ).click();
 
-	protected void setUp() throws Exception {
-		super.setUp();
-		super.loadTestLdif(false);
-		eBot = new SWTEclipseBot();
-		SWTBotUtils.openLdapPerspective(eBot);
-		SWTBotUtils.createTestConnection(eBot, "ImportExportTest", ldapService
-				.getPort());
-	}
-
-	protected void tearDown() throws Exception {
-		SWTBotUtils.deleteTestConnections();
-		eBot = null;
-		super.tearDown();
-	}
-
-	/**
-	 * Test for DIRSTUDIO-395.
-	 * 
-	 * <li>export an entry with German umlaut in DN to LDIF</li> <li>verify that
-	 * exported LDIF starts with the Base64 encoded DN</li> <li>delete the entry
-	 * </li> <li>import the exported LDIF</li> <li>verify that entry with umlaut
-	 * exists</li>
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testExportImportLdifWithGermanUmlautInDN() throws Exception {
-		URL url = Platform.getInstanceLocation().getURL();
-		String file = url.getFile() + "ImportExportTest.ldif";
-
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(eBot);
-
-		SWTBotUtils.selectEntry(eBot, browserTree, false, "DIT", "Root DSE",
-				"ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel");
-
-		// export LDIF
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("LDIF Export..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("LDIF Export") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'LDIF Export'";
-					}
-				});
-		eBot.button("Next >").click();
-		eBot.comboBoxWithLabel("LDIF File:").setText(file);
-		eBot.button("Finish").click();
-
-		// verify that exported LDIF starts with the Base64 encoded DN
-		eBot.sleep(2000);
-		String content = FileUtils.readFileToString(new File(file));
-		assertTrue(
-				"LDIF must start with Base64 encoded DN.",
-				content
-						.startsWith("dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0="));
-
-		// delete entry
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("Delete Entry"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("Delete Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'New Entry'";
-					}
-				});
-		SWTBotUtils.asyncClick(eBot, eBot.button("OK"), new DefaultCondition() {
-			public boolean test() throws Exception {
-				return browserTree.selection().get(0).get(0).startsWith(
-						"ou=users");
-			}
-
-			public String getFailureMessage() {
-				return "Could not select 'ou=system'";
-			}
-		});
-
-		// import LDIF
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("LDIF Import..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("LDIF Import") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'LDIF Import'";
-					}
-				});
-		eBot.comboBoxWithLabel("LDIF File:").setText(file);
-		eBot.button("Finish").click();
-
-		// verify that entry with umlaut exists
-		SWTBotUtils.selectEntry(eBot, browserTree, false, "DIT", "Root DSE",
-				"ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel");
-	}
-
-	/**
-	 * Test for DIRSTUDIO-395.
-	 * 
-	 * <li>export an entry with German umlaut in DN to DSML</li> <li>verify that
-	 * exported DSML starts with the Base64 encoded DN</li> <li>delete the entry
-	 * </li> <li>import the exported DSML</li> <li>verify that entry with umlaut
-	 * exists</li>
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testExportImportDsmlWithGermanUmlautInDN() throws Exception {
-		URL url = Platform.getInstanceLocation().getURL();
-		String file = url.getFile() + "ImportExportTest.dsml";
-
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(eBot);
-
-		SWTBotUtils.selectEntry(eBot, browserTree, false, "DIT", "Root DSE",
-				"ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel");
-		eBot.sleep(2000);
-
-		// export DSML
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("DSML Export..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("DSML Export") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'DSML Export'";
-					}
-				});
-		eBot.button("Next >").click();
-		eBot.comboBoxWithLabel("DSML File:").setText(file);
-		eBot.radio("DSML Request").click();
-		eBot.button("Finish").click();
-
-		// verify that exported DSML contains the Base64 encoded DN
-		eBot.sleep(2000);
-		String content = FileUtils.readFileToString(new File(file), "UTF-8");
-		assertTrue("DSML must contain DN with umlaut.", content
-				.contains("dn=\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\""));
-
-		// delete entry
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("Delete Entry"),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("Delete Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'New Entry'";
-					}
-				});
-		SWTBotUtils.asyncClick(eBot, eBot.button("OK"), new DefaultCondition() {
-			public boolean test() throws Exception {
-				return browserTree.selection().get(0).get(0).startsWith(
-						"ou=users");
-			}
-
-			public String getFailureMessage() {
-				return "Could not select 'ou=system'";
-			}
-		});
-
-		// import DSML
-		SWTBotUtils.asyncClick(eBot, browserTree.contextMenu("DSML Import..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("DSML Import") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'LDIF Import'";
-					}
-				});
-		eBot.comboBoxWithLabel("DSML File:").setText(file);
-		eBot.button("Finish").click();
-
-		// verify that entry with umlaut exists
-		SWTBotUtils.selectEntry(eBot, browserTree, false, "DIT", "Root DSE",
-				"ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel");
-	}
+        // verify that exported LDIF starts with the Base64 encoded DN
+        eBot.sleep( 2000 );
+        String content = FileUtils.readFileToString( new File( file ) );
+        assertTrue( "LDIF must start with Base64 encoded DN.", content
+            .startsWith( "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0=" ) );
 
-	/**
+        // delete entry
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "Delete Entry" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "Delete Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'New Entry'";
+            }
+        } );
+        SWTBotUtils.asyncClick( eBot, eBot.button( "OK" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "ou=users" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not select 'ou=system'";
+            }
+        } );
+
+        // import LDIF
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "LDIF Import..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "LDIF Import" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'LDIF Import'";
+            }
+        } );
+        eBot.comboBoxWithLabel( "LDIF File:" ).setText( file );
+        eBot.button( "Finish" ).click();
+
+        // verify that entry with umlaut exists
+        SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Wolfgang K\u00f6lbel" );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-395.
+     * 
+     * <li>export an entry with German umlaut in DN to DSML</li> <li>verify that
+     * exported DSML starts with the Base64 encoded DN</li> <li>delete the entry
+     * </li> <li>import the exported DSML</li> <li>verify that entry with umlaut
+     * exists</li>
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testExportImportDsmlWithGermanUmlautInDN() throws Exception
+    {
+        URL url = Platform.getInstanceLocation().getURL();
+        String file = url.getFile() + "ImportExportTest.dsml";
+
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
+
+        SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Wolfgang K\u00f6lbel" );
+        eBot.sleep( 2000 );
+
+        // export DSML
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "DSML Export..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "DSML Export" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'DSML Export'";
+            }
+        } );
+        eBot.button( "Next >" ).click();
+        eBot.comboBoxWithLabel( "DSML File:" ).setText( file );
+        eBot.radio( "DSML Request" ).click();
+        eBot.button( "Finish" ).click();
+
+        // verify that exported DSML contains the Base64 encoded DN
+        eBot.sleep( 2000 );
+        String content = FileUtils.readFileToString( new File( file ), "UTF-8" );
+        assertTrue( "DSML must contain DN with umlaut.", content
+            .contains( "dn=\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\"" ) );
+
+        // delete entry
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "Delete Entry" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "Delete Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'New Entry'";
+            }
+        } );
+        SWTBotUtils.asyncClick( eBot, eBot.button( "OK" ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "ou=users" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not select 'ou=system'";
+            }
+        } );
+
+        // import DSML
+        SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "DSML Import..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "DSML Import" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'LDIF Import'";
+            }
+        } );
+        eBot.comboBoxWithLabel( "DSML File:" ).setText( file );
+        eBot.button( "Finish" ).click();
+
+        // verify that entry with umlaut exists
+        SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Wolfgang K\u00f6lbel" );
+    }
+
+
+    /**
      * Test for DIRSTUDIO-465.
      * 
      * Import a new context entry must refresh the root DSE and 
@@ -301,5 +333,5 @@
         // ensure context entry is there now, without a manual refresh
         SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "dc=example,dc=com" );
     }
-	
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java?rev=748537&r1=748536&r2=748537&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java Fri Feb 27 14:21:08 2009
@@ -20,6 +20,7 @@
 
 package org.apache.directory.studio.test.integration.ui;
 
+
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
@@ -34,211 +35,221 @@
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 
+
 /**
  * Tests the new connection wizard.
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class NewConnectionWizardTest extends AbstractServerTest {
-	private SWTEclipseBot bot;
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		bot = new SWTEclipseBot();
-		SWTBotUtils.openLdapPerspective(bot);
-	}
-
-	protected void tearDown() throws Exception {
-		SWTBotUtils.deleteTestConnections();
-		bot = null;
-		super.tearDown();
-	}
-
-	/**
-	 * Creates a new connection using the new connection wizard.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCreateConnection() throws Exception {
-		// Select "Connections" view, ensure no connections exists yet
-		SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree(bot);
-		assertEquals(0, connectionsTree.rowCount());
-
-		// open "New Connection" wizard
-		SWTBotMenu newConnectionMenu = connectionsTree
-				.contextMenu("New Connection...");
-		newConnectionMenu.click();
-
-		// get buttons
-		SWTBotButton backButton = bot.button("< Back");
-		SWTBotButton nextButton = bot.button("Next >");
-		SWTBotButton finishButton = bot.button("Finish");
-
-		// ensure "Next >" and "Finish" buttons are disabled
-		assertFalse(backButton.isEnabled());
-		assertFalse(nextButton.isEnabled());
-		assertFalse(finishButton.isEnabled());
-
-		// enter connection parameter
-		SWTBotText connText = bot.textWithLabel("Connection name:");
-		connText.setText("NewConnectionWizardTest");
-		SWTBotCombo hostnameCombo = bot.comboBoxWithLabel("Hostname:");
-		hostnameCombo.setText("localhost");
-		SWTBotCombo portCombo = bot.comboBoxWithLabel("Port:");
-		portCombo.setText(Integer.toString(ldapService.getPort()));
-
-		// ensure "Next >" button is enabled, "Finish" button is disabled
-		assertFalse(backButton.isEnabled());
-		assertTrue(nextButton.isEnabled());
-		assertFalse(finishButton.isEnabled());
-
-		// jump to auth page
-		nextButton.click();
-
-		// ensure "< Back" is enabled, "Next >" button is disabled, "Finish"
-		// button is disabled
-		assertTrue(backButton.isEnabled());
-		assertFalse(nextButton.isEnabled());
-		assertFalse(finishButton.isEnabled());
-
-		// ensure "Simple Authentication" is the default
-		SWTBotCombo authMethodCombo = bot
-				.comboBoxInGroup("Authentication Method");
-		assertEquals("Simple Authentication", authMethodCombo.selection());
-
-		// enter authentication parameters
-		SWTBotCombo dnCombo = bot.comboBoxWithLabel("Bind DN or user:");
-		dnCombo.setText("uid=admin,ou=system");
-		SWTBotText passwordText = bot.textWithLabel("Bind password:");
-		passwordText.setText("secret");
-
-		// ensure "< Back" is enabled, "Next >" button is enabled, "Finish"
-		// button is enabled
-		assertTrue(backButton.isEnabled());
-		assertTrue(nextButton.isEnabled());
-		assertTrue(finishButton.isEnabled());
-
-		// finish dialog
-		finishButton.click();
-		bot.sleep(2000);
-
-		// ensure connection was created
-		ConnectionManager connectionManager = ConnectionCorePlugin.getDefault()
-				.getConnectionManager();
-		assertNotNull(connectionManager.getConnections());
-		assertEquals(1, connectionManager.getConnections().length);
-		Connection connection = connectionManager.getConnections()[0];
-		assertEquals("NewConnectionWizardTest", connection.getName());
-		assertEquals("localhost", connection.getHost());
-		assertEquals(ldapService.getPort(), connection.getPort());
-		assertEquals(AuthenticationMethod.SIMPLE, connection.getAuthMethod());
-		assertEquals("uid=admin,ou=system", connection.getBindPrincipal());
-		assertEquals("secret", connection.getBindPassword());
-
-		// ensure connection is visible in Connections view
-		assertEquals(1, connectionsTree.rowCount());
-
-		// close connection
-		connectionsTree.select("NewConnectionWizardTest");
-		SWTBotMenu contextMenu = connectionsTree
-				.contextMenu("Close Connection");
-		contextMenu.click();
-	}
-
-	/**
-	 * Tests the "Check Network Parameter" button.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCheckNetworkParameterButtonOK() throws Exception {
-		// Select "Connections" view, ensure no connections exists yet
-		SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree(bot);
-		assertEquals(0, connectionsTree.rowCount());
-
-		// open "New Connection" wizard
-		SWTBotMenu newConnectionMenu = connectionsTree
-				.contextMenu("New Connection...");
-		newConnectionMenu.click();
-
-		// enter connection parameter
-		SWTBotText connText = bot.textWithLabel("Connection name:");
-		connText.setText("NewConnectionWizardTest");
-		SWTBotCombo hostnameCombo = bot.comboBoxWithLabel("Hostname:");
-		hostnameCombo.setText("localhost");
-		SWTBotCombo portCombo = bot.comboBoxWithLabel("Port:");
-		portCombo.setText(Integer.toString(ldapService.getPort()));
-
-		// click "Check Network Parameter" button
-		SWTBotButton checkButton = bot.button("Check Network Parameter");
-		checkButton.click();
-		bot.sleep(1000);
-		bot.waitUntil(new DefaultCondition() {
-			public boolean test() throws Exception {
-				return bot.activeShell().getText().equals(
-						"Check Network Parameter")
-						&& bot.button("OK") != null;
-			}
-
-			public String getFailureMessage() {
-				return "Expected an dialog box 'Check Network Parameter' with an 'OK' button.";
-			}
-		});
-
-		bot.button("OK").click();
-		bot.button("Cancel").click();
-	}
-
-	/**
-	 * Tests the "Check Network Parameter" button.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCheckNetworkParameterButtonNOK() throws Exception {
-		// we expect the error dialog here, so set flag to false
-		boolean errorDialogAutomatedMode = ErrorDialog.AUTOMATED_MODE;
-		ErrorDialog.AUTOMATED_MODE = false;
-
-		// Select "Connections" view, ensure no connections exists yet
-		SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree(bot);
-		assertEquals(0, connectionsTree.rowCount());
-
-		// open "New Connection" wizard
-		SWTBotMenu newConnectionMenu = connectionsTree
-				.contextMenu("New Connection...");
-		newConnectionMenu.click();
-
-		// enter connection parameter
-		SWTBotText connText = bot.textWithLabel("Connection name:");
-		connText.setText("NewConnectionWizardTest");
-		SWTBotCombo hostnameCombo = bot.comboBoxWithLabel("Hostname:");
-		hostnameCombo.setText("localhost");
-		SWTBotCombo portCombo = bot.comboBoxWithLabel("Port:");
-		portCombo.setText(Integer.toString(ldapService.getPort() + 1));
-
-		// click "Check Network Parameter" button
-		SWTBotButton checkButton = bot.button("Check Network Parameter");
-		checkButton.click();
-		bot.sleep(1000);
-		bot.waitUntil(new DefaultCondition() {
-			public boolean test() throws Exception {
-				return bot.activeShell().getText().equals("Error")
-						&& bot.button("OK") != null;
-			}
-
-			public String getFailureMessage() {
-				return "Expected an dialog box 'Error' with an 'OK' button.";
-			}
-		});
-
-		bot.button("OK").click();
-		bot.button("Cancel").click();
-
-		// reset flag
-		ErrorDialog.AUTOMATED_MODE = errorDialogAutomatedMode;
-	}
+public class NewConnectionWizardTest extends AbstractServerTest
+{
+    private SWTEclipseBot bot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        bot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( bot );
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        bot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Creates a new connection using the new connection wizard.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCreateConnection() throws Exception
+    {
+        // Select "Connections" view, ensure no connections exists yet
+        SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot );
+        assertEquals( 0, connectionsTree.rowCount() );
+
+        // open "New Connection" wizard
+        SWTBotMenu newConnectionMenu = connectionsTree.contextMenu( "New Connection..." );
+        newConnectionMenu.click();
+
+        // get buttons
+        SWTBotButton backButton = bot.button( "< Back" );
+        SWTBotButton nextButton = bot.button( "Next >" );
+        SWTBotButton finishButton = bot.button( "Finish" );
+
+        // ensure "Next >" and "Finish" buttons are disabled
+        assertFalse( backButton.isEnabled() );
+        assertFalse( nextButton.isEnabled() );
+        assertFalse( finishButton.isEnabled() );
+
+        // enter connection parameter
+        SWTBotText connText = bot.textWithLabel( "Connection name:" );
+        connText.setText( "NewConnectionWizardTest" );
+        SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" );
+        hostnameCombo.setText( "localhost" );
+        SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" );
+        portCombo.setText( Integer.toString( ldapService.getPort() ) );
+
+        // ensure "Next >" button is enabled, "Finish" button is disabled
+        assertFalse( backButton.isEnabled() );
+        assertTrue( nextButton.isEnabled() );
+        assertFalse( finishButton.isEnabled() );
+
+        // jump to auth page
+        nextButton.click();
+
+        // ensure "< Back" is enabled, "Next >" button is disabled, "Finish"
+        // button is disabled
+        assertTrue( backButton.isEnabled() );
+        assertFalse( nextButton.isEnabled() );
+        assertFalse( finishButton.isEnabled() );
+
+        // ensure "Simple Authentication" is the default
+        SWTBotCombo authMethodCombo = bot.comboBoxInGroup( "Authentication Method" );
+        assertEquals( "Simple Authentication", authMethodCombo.selection() );
+
+        // enter authentication parameters
+        SWTBotCombo dnCombo = bot.comboBoxWithLabel( "Bind DN or user:" );
+        dnCombo.setText( "uid=admin,ou=system" );
+        SWTBotText passwordText = bot.textWithLabel( "Bind password:" );
+        passwordText.setText( "secret" );
+
+        // ensure "< Back" is enabled, "Next >" button is enabled, "Finish"
+        // button is enabled
+        assertTrue( backButton.isEnabled() );
+        assertTrue( nextButton.isEnabled() );
+        assertTrue( finishButton.isEnabled() );
+
+        // finish dialog
+        finishButton.click();
+        bot.sleep( 2000 );
+
+        // ensure connection was created
+        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
+        assertNotNull( connectionManager.getConnections() );
+        assertEquals( 1, connectionManager.getConnections().length );
+        Connection connection = connectionManager.getConnections()[0];
+        assertEquals( "NewConnectionWizardTest", connection.getName() );
+        assertEquals( "localhost", connection.getHost() );
+        assertEquals( ldapService.getPort(), connection.getPort() );
+        assertEquals( AuthenticationMethod.SIMPLE, connection.getAuthMethod() );
+        assertEquals( "uid=admin,ou=system", connection.getBindPrincipal() );
+        assertEquals( "secret", connection.getBindPassword() );
+
+        // ensure connection is visible in Connections view
+        assertEquals( 1, connectionsTree.rowCount() );
+
+        // close connection
+        connectionsTree.select( "NewConnectionWizardTest" );
+        SWTBotMenu contextMenu = connectionsTree.contextMenu( "Close Connection" );
+        contextMenu.click();
+    }
+
+
+    /**
+     * Tests the "Check Network Parameter" button.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCheckNetworkParameterButtonOK() throws Exception
+    {
+        // Select "Connections" view, ensure no connections exists yet
+        SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot );
+        assertEquals( 0, connectionsTree.rowCount() );
+
+        // open "New Connection" wizard
+        SWTBotMenu newConnectionMenu = connectionsTree.contextMenu( "New Connection..." );
+        newConnectionMenu.click();
+
+        // enter connection parameter
+        SWTBotText connText = bot.textWithLabel( "Connection name:" );
+        connText.setText( "NewConnectionWizardTest" );
+        SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" );
+        hostnameCombo.setText( "localhost" );
+        SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" );
+        portCombo.setText( Integer.toString( ldapService.getPort() ) );
+
+        // click "Check Network Parameter" button
+        SWTBotButton checkButton = bot.button( "Check Network Parameter" );
+        checkButton.click();
+        bot.sleep( 1000 );
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.activeShell().getText().equals( "Check Network Parameter" ) && bot.button( "OK" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Expected an dialog box 'Check Network Parameter' with an 'OK' button.";
+            }
+        } );
+
+        bot.button( "OK" ).click();
+        bot.button( "Cancel" ).click();
+    }
+
+
+    /**
+     * Tests the "Check Network Parameter" button.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCheckNetworkParameterButtonNOK() throws Exception
+    {
+        // we expect the error dialog here, so set flag to false
+        boolean errorDialogAutomatedMode = ErrorDialog.AUTOMATED_MODE;
+        ErrorDialog.AUTOMATED_MODE = false;
+
+        // Select "Connections" view, ensure no connections exists yet
+        SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot );
+        assertEquals( 0, connectionsTree.rowCount() );
+
+        // open "New Connection" wizard
+        SWTBotMenu newConnectionMenu = connectionsTree.contextMenu( "New Connection..." );
+        newConnectionMenu.click();
+
+        // enter connection parameter
+        SWTBotText connText = bot.textWithLabel( "Connection name:" );
+        connText.setText( "NewConnectionWizardTest" );
+        SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" );
+        hostnameCombo.setText( "localhost" );
+        SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" );
+        portCombo.setText( Integer.toString( ldapService.getPort() + 1 ) );
+
+        // click "Check Network Parameter" button
+        SWTBotButton checkButton = bot.button( "Check Network Parameter" );
+        checkButton.click();
+        bot.sleep( 1000 );
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.activeShell().getText().equals( "Error" ) && bot.button( "OK" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Expected an dialog box 'Error' with an 'OK' button.";
+            }
+        } );
+
+        bot.button( "OK" ).click();
+        bot.button( "Cancel" ).click();
+
+        // reset flag
+        ErrorDialog.AUTOMATED_MODE = errorDialogAutomatedMode;
+    }
 }

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=748537&r1=748536&r2=748537&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 Feb 27 14:21:08 2009
@@ -20,6 +20,7 @@
 
 package org.apache.directory.studio.test.integration.ui;
 
+
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
@@ -34,387 +35,430 @@
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 
+
 /**
  * Tests the new entry wizard.
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class NewEntryWizardTest extends AbstractServerTest {
-	private SWTEclipseBot bot;
-
-	protected void setUp() throws Exception {
-		super.setUp();
-
-		// check if krb5kdc is disabled
-		Attributes krb5kdcAttrs = schemaRoot.getAttributes("cn=Krb5kdc");
-		boolean isKrb5KdcDisabled = false;
-		if (krb5kdcAttrs.get("m-disabled") != null) {
-			isKrb5KdcDisabled = ((String) krb5kdcAttrs.get("m-disabled").get())
-					.equalsIgnoreCase("TRUE");
-		}
-		// if krb5kdc is disabled then enable it
-		if (isKrb5KdcDisabled) {
-			Attribute disabled = new BasicAttribute("m-disabled");
-			ModificationItem[] mods = new ModificationItem[] { new ModificationItem(
-					DirContext.REMOVE_ATTRIBUTE, disabled) };
-			schemaRoot.modifyAttributes("cn=Krb5kdc", mods);
-		}
-
-		bot = new SWTEclipseBot();
-		SWTBotUtils.openLdapPerspective(bot);
-		SWTBotUtils.createTestConnection(bot, "NewEntryWizardTest", ldapService
-				.getPort());
-	}
-
-	protected void tearDown() throws Exception {
-		SWTBotUtils.deleteTestConnections();
-		bot = null;
-		super.tearDown();
-	}
-
-	/**
-	 * Test to create a single organization entry.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCreateOrganizationEntry() throws Exception {
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(bot);
-		SWTBotUtils.selectEntry(bot, browserTree, true, "DIT", "Root DSE",
-				"ou=system");
-
-		// open "New Entry" wizard
-		SWTBotUtils.asyncClick(bot, browserTree.contextMenu("New Entry..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("New Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog '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;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find widget";
-					}
-				});
-
-		// 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");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find 'o=testCreateOrganizationEntry'";
-					}
-				});
-	}
-
-	/**
-	 * Test to create a single person entry.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCreatePersonEntry() throws Exception {
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(bot);
-		SWTBotUtils.selectEntry(bot, browserTree, true, "DIT", "Root DSE",
-				"ou=system");
-
-		// open "New Entry" wizard
-		SWTBotUtils.asyncClick(bot, browserTree.contextMenu("New Entry..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("New Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'New Entry'";
-					}
-				});
-
-		// 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.select("sn");
-		bot.text("").setText("test");
-		// click to finish editing of sn
-		SWTBotTreeItem snNode = tree.getTreeItem("sn");
-		snNode.click();
-
-		// 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");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find 'cn=testCreatePersonEntry'";
-					}
-				});
-	}
-
-	/**
-	 * Test for DIRSTUDIO-350.
-	 * 
-	 * Create entries with upper case attribute types and ensures that the
-	 * retrieved entries still are in upper case.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCreateUpperCaseOrganizationEntries() throws Exception {
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(bot);
-		SWTBotUtils.selectEntry(bot, browserTree, true, "DIT", "Root DSE",
-				"ou=system");
-
-		// open "New Entry" wizard
-		SWTBotUtils.asyncClick(bot, browserTree.contextMenu("New Entry..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("New Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog '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;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find widget";
-					}
-				});
-
-		// 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");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find '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
-		SWTBotUtils.asyncClick(bot, browserTree.contextMenu("New Entry..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("New Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog '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";
-					}
-				});
-
-		// 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");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find 'O=testCreateOrganizationEntry2'";
-					}
-				});
-	}
-
-	/**
-	 * Test for DIRSTUDIO-360.
-	 * 
-	 * Create entries with a slash '/' in the RDN value.
-	 * 
-	 * @throws Exception
-	 *             the exception
-	 */
-	public void testCreateEntryWithSlash() throws Exception {
-		final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree(bot);
-		SWTBotUtils.selectEntry(bot, browserTree, true, "DIT", "Root DSE",
-				"ou=system");
-
-		// open "New Entry" wizard
-		SWTBotUtils.asyncClick(bot, browserTree.contextMenu("New Entry..."),
-				new DefaultCondition() {
-					public boolean test() throws Exception {
-						return bot.shell("New Entry") != null;
-					}
-
-					public String getFailureMessage() {
-						return "Could not find dialog 'New Entry'";
-					}
-				});
-
-		// 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");
-
-		// enter cn value
-		tree.select("cn");
-		bot.text("").setText("test");
-		// click to finish editing of cn
-		krbNode.click();
-
-		// enter sn value
-		tree.select("sn");
-		bot.text("").setText("test");
-		// click to finish editing of sn
-		krbNode.click();
-
-		// 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");
-					}
-
-					public String getFailureMessage() {
-						return "Could not find entry 'krb5Principal=kadmin/changepw@DOMAIN'";
-					}
-				});
-	}
+public class NewEntryWizardTest extends AbstractServerTest
+{
+    private SWTEclipseBot bot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        // check if krb5kdc is disabled
+        Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=Krb5kdc" );
+        boolean isKrb5KdcDisabled = false;
+        if ( krb5kdcAttrs.get( "m-disabled" ) != null )
+        {
+            isKrb5KdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
+        }
+        // if krb5kdc is disabled then enable it
+        if ( isKrb5KdcDisabled )
+        {
+            Attribute disabled = new BasicAttribute( "m-disabled" );
+            ModificationItem[] mods = new ModificationItem[]
+                { new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
+            schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
+        }
+
+        bot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( bot );
+        SWTBotUtils.createTestConnection( bot, "NewEntryWizardTest", ldapService.getPort() );
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        bot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Test to create a single organization entry.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCreateOrganizationEntry() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+
+        // open "New Entry" wizard
+        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "New Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog '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;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+
+        // 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" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find 'o=testCreateOrganizationEntry'";
+            }
+        } );
+    }
+
+
+    /**
+     * Test to create a single person entry.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCreatePersonEntry() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+
+        // open "New Entry" wizard
+        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "New Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'New Entry'";
+            }
+        } );
+
+        // 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.select( "sn" );
+        bot.text( "" ).setText( "test" );
+        // click to finish editing of sn
+        SWTBotTreeItem snNode = tree.getTreeItem( "sn" );
+        snNode.click();
+
+        // 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" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find 'cn=testCreatePersonEntry'";
+            }
+        } );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-350.
+     * 
+     * Create entries with upper case attribute types and ensures that the
+     * retrieved entries still are in upper case.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCreateUpperCaseOrganizationEntries() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+
+        // open "New Entry" wizard
+        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "New Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog '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;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+
+        // 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" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find '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
+        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "New Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog '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";
+            }
+        } );
+
+        // 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" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find 'O=testCreateOrganizationEntry2'";
+            }
+        } );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-360.
+     * 
+     * Create entries with a slash '/' in the RDN value.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testCreateEntryWithSlash() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+
+        // open "New Entry" wizard
+        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.shell( "New Entry" ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find dialog 'New Entry'";
+            }
+        } );
+
+        // 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" );
+
+        // enter cn value
+        tree.select( "cn" );
+        bot.text( "" ).setText( "test" );
+        // click to finish editing of cn
+        krbNode.click();
+
+        // enter sn value
+        tree.select( "sn" );
+        bot.text( "" ).setText( "test" );
+        // click to finish editing of sn
+        krbNode.click();
+
+        // 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" );
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find entry 'krb5Principal=kadmin/changepw@DOMAIN'";
+            }
+        } );
+    }
 
 }



Mime
View raw message