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/06/02 18:53:42 UTC
svn commit: r781080 [3/3] - in /directory/studio/trunk: ./ aciitemeditor/
apacheds/ ldapbrowser-common/ repository/org/eclipse/swtbot/eclipse/finder/
repository/org/eclipse/swtbot/eclipse/finder/2.0.0.329-dev/
repository/org/eclipse/swtbot/swt/finder/ ...
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=781080&r1=781079&r2=781080&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 Tue Jun 2 16:53:39 2009
@@ -21,6 +21,10 @@
package org.apache.directory.studio.test.integration.ui;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
import java.io.File;
import java.io.InputStream;
import java.net.URL;
@@ -28,15 +32,22 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+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.core.partition.Partition;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.unit.AbstractServerTest;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
-import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
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;
+import org.junit.runner.RunWith;
/**
@@ -45,26 +56,31 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class ImportExportTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+@ApplyLdifFiles(
+ { "ImportExportTest.ldif" })
+public class ImportExportTest
{
- private SWTEclipseBot eBot;
+ public static LdapService ldapService;
+
+ private SWTWorkbenchBot eBot;
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- super.loadTestLdif( false );
- eBot = new SWTEclipseBot();
+ eBot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( eBot );
SWTBotUtils.createTestConnection( eBot, "ImportExportTest", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
eBot = null;
- super.tearDown();
}
@@ -79,6 +95,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testExportImportLdifWithGermanUmlautInDN() throws Exception
{
URL url = Platform.getInstanceLocation().getURL();
@@ -90,24 +107,12 @@
"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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Export", "LDIF Export..." );
+ eBot.shell( "LDIF Export" );
eBot.button( "Next >" ).click();
eBot.comboBoxWithLabel( "LDIF File:" ).setText( file );
eBot.button( "Finish" ).click();
- eBot.sleep( 2000 );
List<String> lines = FileUtils.readLines( new File( file ) );
// verify that the first line of exported LDIF is "version: 1"
assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
@@ -116,47 +121,12 @@
"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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Delete Entry" );
+ eBot.button( "OK" ).click();
// 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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Import", "LDIF Import..." );
+ eBot.shell( "LDIF Import" );
eBot.comboBoxWithLabel( "LDIF File:" ).setText( file );
eBot.button( "Finish" ).click();
@@ -177,6 +147,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testExportImportDsmlWithGermanUmlautInDN() throws Exception
{
URL url = Platform.getInstanceLocation().getURL();
@@ -186,75 +157,27 @@
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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Export", "DSML Export..." );
+ eBot.shell( "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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Delete Entry" );
+ eBot.button( "OK" ).click();
// 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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Import", "DSML Import..." );
+ eBot.shell( "DSML Import" );
eBot.comboBoxWithLabel( "DSML File:" ).setText( file );
eBot.button( "Finish" ).click();
@@ -273,6 +196,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testImportContextEntryRefreshesRootDSE() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
@@ -281,27 +205,11 @@
Partition partition = new JdbmPartition();
partition.setId( "example" );
partition.setSuffix( "dc=example,dc=com" );
- directoryService.addPartition( partition );
+ ldapService.getDirectoryService().addPartition( partition );
// refresh root DSE and ensure that the partition is in root DSE
SWTBotTreeItem rootDSE = SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE" );
- SWTBotUtils.asyncClick( eBot, browserTree.contextMenu( "Reload Entry" ),
- new DefaultCondition()
- {
- public boolean test() throws Exception
- {
- SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE" );
- final SWTBotTree entryEditorTree = SWTBotUtils.getEntryEditorTree( eBot );
- String text = entryEditorTree.cell( 2, 1 );
- return "dc=example,dc=com".equals( text );
- }
-
-
- public String getFailureMessage()
- {
- return "New partition 'dc=example,dc=com' not found in Root DSE entry";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Reload Entry" );
// ensure context entry is not there
rootDSE = SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE" );
@@ -319,19 +227,8 @@
String file = url.getFile() + "ImportContextEntry.ldif";
String data = "dn:dc=example,dc=com\nobjectClass:top\nobjectClass:domain\ndc:example\n\n";
FileUtils.writeStringToFile( new File( file ), data );
- 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'";
- }
- } );
+ ContextMenuHelper.clickContextMenu( browserTree, "Import", "LDIF Import..." );
+ eBot.shell( "LDIF Import" );
eBot.comboBoxWithLabel( "LDIF File:" ).setText( file );
eBot.button( "Finish" ).click();
@@ -347,6 +244,7 @@
*
* @throws Exception
*/
+ @Test
public void testImportDontUptateUI() throws Exception
{
URL url = Platform.getInstanceLocation().getURL();
@@ -361,7 +259,7 @@
long fireCount0 = EventRegistry.getFireCount();
// import the LDIF
- browserTree.contextMenu( "LDIF Import..." ).click();
+ ContextMenuHelper.clickContextMenu( browserTree, "Import", "LDIF Import..." );
eBot.shell( "LDIF Import" );
eBot.comboBoxWithLabel( "LDIF File:" ).setText( destFile );
eBot.button( "Finish" ).click();
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=781080&r1=781079&r2=781080&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 Tue Jun 2 16:53:39 2009
@@ -21,19 +21,31 @@
package org.apache.directory.studio.test.integration.ui;
-import org.apache.directory.server.unit.AbstractServerTest;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -42,24 +54,28 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class NewConnectionWizardTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+public class NewConnectionWizardTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+ private SWTWorkbenchBot bot;
- protected void setUp() throws Exception
+
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -69,6 +85,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCreateConnection() throws Exception
{
// Select "Connections" view, ensure no connections exists yet
@@ -159,6 +176,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCheckNetworkParameterButtonOK() throws Exception
{
// Select "Connections" view, ensure no connections exists yet
@@ -206,6 +224,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCheckNetworkParameterButtonNOK() throws Exception
{
// we expect the error dialog here, so set flag to false
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=781080&r1=781079&r2=781080&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 Tue Jun 2 16:53:39 2009
@@ -21,19 +21,29 @@
package org.apache.directory.studio.test.integration.ui;
+import static junit.framework.Assert.assertEquals;
+import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
+
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
-import org.apache.directory.server.unit.AbstractServerTest;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
+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;
+import org.junit.runner.RunWith;
/**
@@ -42,16 +52,20 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class NewEntryWizardTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+public class NewEntryWizardTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+ private SWTWorkbenchBot bot;
- protected void setUp() throws Exception
- {
- super.setUp();
+ @Before
+ public void setUp() throws Exception
+ {
// check if krb5kdc is disabled
+ DirContext schemaRoot = ( DirContext ) getWiredContext( ldapService ).lookup( "ou=schema" );
Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=Krb5kdc" );
boolean isKrb5KdcDisabled = false;
if ( krb5kdcAttrs.get( "m-disabled" ) != null )
@@ -67,17 +81,17 @@
schemaRoot.modifyAttributes( "cn=Krb5kdc", mods );
}
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
SWTBotUtils.createTestConnection( bot, "NewEntryWizardTest", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -87,6 +101,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCreateOrganizationEntry() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -158,6 +173,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCreatePersonEntry() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -208,8 +224,10 @@
// enter sn value
SWTBotTree tree = bot.tree( 0 );
- tree.select( "sn" );
- bot.text( "" ).setText( "test" );
+ tree.getTreeItem( "sn" ).doubleClick();
+
+ SWTBotText text = bot.text( "" );
+ text.setText( "test" );
// click to finish editing of sn
SWTBotTreeItem snNode = tree.getTreeItem( "sn" );
snNode.click();
@@ -240,6 +258,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCreateUpperCaseOrganizationEntries() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -379,6 +398,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testCreateEntryWithSlash() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -435,13 +455,13 @@
krbNode.click();
// enter cn value
- tree.select( "cn" );
+ tree.getTreeItem( "cn" ).doubleClick();
bot.text( "" ).setText( "test" );
// click to finish editing of cn
krbNode.click();
// enter sn value
- tree.select( "sn" );
+ tree.getTreeItem( "sn" ).doubleClick();
bot.text( "" ).setText( "test" );
// click to finish editing of sn
krbNode.click();
Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java?rev=781080&r1=781079&r2=781080&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java Tue Jun 2 16:53:39 2009
@@ -21,19 +21,30 @@
package org.apache.directory.studio.test.integration.ui;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.unit.AbstractServerTest;
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
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;
+import org.junit.runner.RunWith;
/**
@@ -42,26 +53,30 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class ReferralDialogTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+public class ReferralDialogTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+
+ private SWTWorkbenchBot bot;
private Connection connection;
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
connection = SWTBotUtils.createTestConnection( bot, "ReferralDialogTest", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -73,6 +88,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testBrowseAndFollowContinuationReference() throws Exception
{
// ensure that referrals handling method is FOLLOW
@@ -123,6 +139,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testBrowseAndCancelFollowingContinuationReference() throws Exception
{
// ensure that referrals handling method is FOLLOW
@@ -174,6 +191,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testBrowseAndIgnoreReferral() throws Exception
{
// ensure that referrals handling method is IGNORE
@@ -221,6 +239,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testBrowseAndManageReferralEntry() throws Exception
{
// ensure that referrals handling method is MANAGE
@@ -247,11 +266,11 @@
private void createReferralEntry() throws Exception
{
- ServerEntry entry = new DefaultServerEntry( rootDSE.getDirectoryService().getRegistries() );
+ ServerEntry entry = new DefaultServerEntry( ldapService.getDirectoryService().getRegistries() );
entry.setDn( new LdapDN( "cn=referralDialogTest,ou=system" ) );
entry.add( "objectClass", "top", "referral", "extensibleObject" );
entry.add( "cn", "referralDialogTest" );
entry.add( "ref", "ldap://localhost:" + ldapService.getPort() + "/ou=users,ou=system" );
- rootDSE.add( entry );
+ ldapService.getDirectoryService().getAdminSession().add( entry );
}
}
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=781080&r1=781079&r2=781080&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 Tue Jun 2 16:53:39 2009
@@ -21,10 +21,18 @@
package org.apache.directory.studio.test.integration.ui;
-import org.apache.directory.server.unit.AbstractServerTest;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+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.LdapService;
+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;
+import org.junit.runner.RunWith;
/**
@@ -33,26 +41,30 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class RenameEntryDialogTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+@ApplyLdifFiles("RenameEntryDialogTest.ldif")
+public class RenameEntryDialogTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+ private SWTWorkbenchBot bot;
- protected void setUp() throws Exception
+
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- super.loadTestLdif( false );
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
SWTBotUtils.createTestConnection( bot, "RenameEntryDialogTest", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -64,6 +76,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testRenameMultiValuedRdn() throws Exception
{
final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -93,6 +106,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testRenameRdnWithEscapedCharacters() throws Exception
{
SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java?rev=781080&r1=781079&r2=781080&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java Tue Jun 2 16:53:39 2009
@@ -41,7 +41,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Widget;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
@@ -82,12 +82,12 @@
* @throws Exception
* the exception
*/
- public static void openLdapPerspective( final SWTEclipseBot eBot ) throws Exception
+ public static void openLdapPerspective( final SWTWorkbenchBot eBot ) throws Exception
{
// optimization: only open LDAP perspective if not yet opened
try
{
- if ( eBot.view( "Connections" ) != null )
+ if ( eBot.viewByTitle( "Connections" ) != null )
{
// LDAP perspective already opened
return;
@@ -119,7 +119,7 @@
{
public boolean test() throws Exception
{
- return eBot.view( "Connections" ) != null;
+ return eBot.viewByTitle( "Connections" ) != null;
}
@@ -132,7 +132,7 @@
// close welcome view, if it is there
try
{
- eBot.view( "Welcome" ).close();
+ eBot.viewByTitle( "Welcome" ).close();
}
catch ( Exception e )
{
@@ -155,7 +155,7 @@
* @throws Exception
* the exception
*/
- public static Connection createTestConnection( SWTEclipseBot bot, String name, int port ) throws Exception
+ public static Connection createTestConnection( SWTWorkbenchBot bot, String name, int port ) throws Exception
{
SWTBotTree connectionsTree = getConnectionsTree( bot );
@@ -208,9 +208,9 @@
* @throws Exception
* the exception
*/
- public static SWTBotTree getConnectionsTree( SWTEclipseBot bot ) throws Exception
+ public static SWTBotTree getConnectionsTree( SWTWorkbenchBot bot ) throws Exception
{
- SWTBotView view = bot.view( "Connections" );
+ SWTBotView view = bot.viewByTitle( "Connections" );
view.show();
Tree tree = ( Tree ) bot.widget( widgetOfType( Tree.class ), view.getWidget() );
@@ -229,9 +229,9 @@
* @throws Exception
* the exception
*/
- public static SWTBotTree getLdapBrowserTree( SWTEclipseBot bot ) throws Exception
+ public static SWTBotTree getLdapBrowserTree( SWTWorkbenchBot bot ) throws Exception
{
- SWTBotView view = bot.view( "LDAP Browser" );
+ SWTBotView view = bot.viewByTitle( "LDAP Browser" );
view.show();
Tree tree = ( Tree ) bot.widget( widgetOfType( Tree.class ), view.getWidget() );
return new SWTBotTree( tree );
@@ -249,9 +249,9 @@
* @throws Exception
* the exception
*/
- public static SWTBotStyledText getSearchLogsText( SWTEclipseBot bot ) throws Exception
+ public static SWTBotStyledText getSearchLogsText( SWTWorkbenchBot bot ) throws Exception
{
- SWTBotView view = bot.view( "Search Logs" );
+ SWTBotView view = bot.viewByTitle( "Search Logs" );
view.show();
view.toolbarButton( "Refresh" ).click();
StyledText styledText = ( StyledText ) bot.widget( widgetOfType( StyledText.class ), view.getWidget() );
@@ -270,9 +270,9 @@
* @throws Exception
* the exception
*/
- public static SWTBotStyledText getModificationLogsText( SWTEclipseBot bot ) throws Exception
+ public static SWTBotStyledText getModificationLogsText( SWTWorkbenchBot bot ) throws Exception
{
- SWTBotView view = bot.view( "Modification Logs" );
+ SWTBotView view = bot.viewByTitle( "Modification Logs" );
view.show();
view.toolbarButton( "Refresh" ).click();
StyledText styledText = ( StyledText ) bot.widget( widgetOfType( StyledText.class ), view.getWidget() );
@@ -291,7 +291,7 @@
* @throws Exception
* the exception
*/
- public static SWTBotTree getEntryEditorTree( final SWTEclipseBot bot ) throws Exception
+ public static SWTBotTree getEntryEditorTree( final SWTWorkbenchBot bot ) throws Exception
{
Tree tree = UIThreadRunnable.syncExec( new WidgetResult<Tree>()
{
@@ -327,7 +327,7 @@
public Widget widget;
- public DummyEditor( IEditorReference editorReference, SWTEclipseBot bot )
+ public DummyEditor( IEditorReference editorReference, SWTWorkbenchBot bot )
{
super( editorReference, bot );
widget = findWidget( anything() );
@@ -366,7 +366,7 @@
*
* @throws TimeoutException
*/
- public static void asyncClick( final SWTEclipseBot bot, final SWTBotButton button, final ICondition waitCondition )
+ public static void asyncClick( final SWTWorkbenchBot bot, final SWTBotButton button, final ICondition waitCondition )
throws TimeoutException
{
bot.waitUntil( new DefaultCondition()
@@ -411,7 +411,7 @@
*
* @throws TimeoutException
*/
- public static void asyncClick( final SWTEclipseBot bot, final SWTBotMenu menu, final ICondition waitCondition )
+ public static void asyncClick( final SWTWorkbenchBot bot, final SWTBotMenu menu, final ICondition waitCondition )
throws TimeoutException
{
UIThreadRunnable.asyncExec( bot.getDisplay(), new VoidResult()
@@ -443,7 +443,7 @@
* @throws TimeoutException
* the timeout exception
*/
- public static void asyncClick( final SWTEclipseBot bot, final SWTBotTreeItem item, final ICondition waitCondition )
+ public static void asyncClick( final SWTWorkbenchBot bot, final SWTBotTreeItem item, final ICondition waitCondition )
throws TimeoutException
{
UIThreadRunnable.asyncExec( bot.getDisplay(), new VoidResult()
@@ -481,7 +481,7 @@
* @throws Exception
* the exception
*/
- public static SWTBotTreeItem selectEntry( final SWTEclipseBot bot, final SWTBotTree tree,
+ public static SWTBotTreeItem selectEntry( final SWTWorkbenchBot bot, final SWTBotTree tree,
final boolean expandChild, final String... path ) throws Exception
{
List<String> pathList = new ArrayList<String>( Arrays.asList( path ) );
@@ -542,7 +542,7 @@
* @throws Exception
* the exception
*/
- public static void expandEntry( final SWTEclipseBot bot, final SWTBotTreeItem entry, final String nextName )
+ public static void expandEntry( final SWTWorkbenchBot bot, final SWTBotTreeItem entry, final String nextName )
throws Exception
{
UIThreadRunnable.asyncExec( bot.getDisplay(), new VoidResult()
Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java?rev=781080&r1=781079&r2=781080&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java Tue Jun 2 16:53:39 2009
@@ -21,12 +21,21 @@
package org.apache.directory.studio.test.integration.ui;
-import org.apache.directory.server.unit.AbstractServerTest;
+import static junit.framework.Assert.assertEquals;
+
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -35,26 +44,31 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class SearchTest extends AbstractServerTest
+//@RunWith(SWTBotJunit4ClassRunner.class)
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+public class SearchTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+
+ private SWTWorkbenchBot bot;
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
SWTBotUtils.createTestConnection( bot, "SearchTest1", ldapService.getPort() );
SWTBotUtils.createTestConnection( bot, "SearchTest2", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -65,6 +79,7 @@
*
* @throws Exception
*/
+ @Test
public void testCopyPasteSearchBetweenConnections() throws Exception
{
BrowserConnectionManager browserConnectionManager = BrowserCorePlugin.getDefault().getConnectionManager();
Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java?rev=781080&r1=781079&r2=781080&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java Tue Jun 2 16:53:39 2009
@@ -21,15 +21,25 @@
package org.apache.directory.studio.test.integration.ui;
-import org.apache.directory.server.unit.AbstractServerTest;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import org.apache.directory.server.core.integ.Level;
+import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.integ.SiRunner;
+import org.apache.directory.server.ldap.LdapService;
import org.eclipse.swt.graphics.DeviceData;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.IntResult;
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.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -38,25 +48,29 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class SwtResourcesTest extends AbstractServerTest
+@RunWith(SiRunner.class)
+@CleanupLevel(Level.SUITE)
+public class SwtResourcesTest
{
- private SWTEclipseBot bot;
+ public static LdapService ldapService;
+
+ private SWTWorkbenchBot bot;
- protected void setUp() throws Exception
+ @Before
+ public void setUp() throws Exception
{
- super.setUp();
- bot = new SWTEclipseBot();
+ bot = new SWTWorkbenchBot();
SWTBotUtils.openLdapPerspective( bot );
SWTBotUtils.createTestConnection( bot, "SwtResourcesTest", ldapService.getPort() );
}
- protected void tearDown() throws Exception
+ @After
+ public void tearDown() throws Exception
{
SWTBotUtils.deleteTestConnections();
bot = null;
- super.tearDown();
}
@@ -69,6 +83,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testSwtResourcesDelta() throws Exception
{
SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
@@ -103,6 +118,7 @@
* @throws Exception
* the exception
*/
+ @Test
public void testSwtResourcesCount() throws Exception
{
int swtObjectCount = getSwtObjectCount();