directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r667813 - in /directory/studio/trunk/test-integration-ui: ./ resources/test-plugins/ src/main/java/org/apache/directory/studio/test/integration/ui/ src/main/resources/ src/main/resources/org/ src/main/resources/org/apache/ src/main/resource...
Date Sat, 14 Jun 2008 15:18:11 GMT
Author: seelmann
Date: Sat Jun 14 08:18:10 2008
New Revision: 667813

URL: http://svn.apache.org/viewvc?rev=667813&view=rev
Log:
o Updated to SWTBot 1.2.0-dev
o Fixed UI integration tests, we need the full org.eclipse.ui.ide plugin including the Resource
perspective
o Reorganized tests
o Added RenameEntryDialog test for DIRSTUDIO-318


Added:
    directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.721-dev.jar
  (with props)
    directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.721-dev.jar
  (with props)
    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/resources/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
Removed:
    directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.0.0.574.jar
    directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.0.0.574.jar
Modified:
    directory/studio/trunk/test-integration-ui/pom.xml
    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/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/SWTBotUtils.java

Modified: directory/studio/trunk/test-integration-ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/pom.xml?rev=667813&r1=667812&r2=667813&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/pom.xml (original)
+++ directory/studio/trunk/test-integration-ui/pom.xml Sat Jun 14 08:18:10 2008
@@ -144,6 +144,12 @@
                     <copy todir="target/test-sandbox">
                       <fileset dir="../target/distributions">
                         <include name="ApacheDirectoryStudio-*/**" />
+                        <!-- 
+                          To run the tests we need the full org.eclipse.ui.ide plugins 
+                          including the Resouce perspective, so we can't use the 
+                          adapted studio plugin.
+                        -->
+                        <exclude name="**/*org.eclipse.ui.ide*"/>
                       </fileset>
                       <regexpmapper from="${integration-regexp}" to="\2"/>
                     </copy>
@@ -179,6 +185,8 @@
                         <include name="org.eclipse.ui.cheatsheets_*.jar" />
                         <include name="org.eclipse.ui.console_*.jar" />
                         <include name="org.eclipse.ui.externaltools_*.jar" />
+                        <include name="org.eclipse.ui.ide_*.jar" />
+                        <include name="org.eclipse.ui.ide.application_*.jar" />
                         <include name="org.eclipse.ui.navigator_*.jar" />
                         <include name="org.eclipse.ui.navigator.resources_*.jar" />
                         <include name="org.eclipse.ui.net_*.jar" />

Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.721-dev.jar
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.721-dev.jar?rev=667813&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.721-dev.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.721-dev.jar
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.721-dev.jar?rev=667813&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.721-dev.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=667813&r1=667812&r2=667813&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
Sat Jun 14 08:18:10 2008
@@ -44,6 +44,7 @@
     {
         addTest( new TestSuite( NewConnectionWizardTest.class ) );
         addTest( new TestSuite( NewEntryWizardTest.class ) );
+        addTest( new TestSuite( RenameEntryDialogTest.class ) );
     }
 
 }
\ No newline at end of file

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=667813&r1=667812&r2=667813&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
Sat Jun 14 08:18:10 2008
@@ -56,14 +56,8 @@
 
     protected void tearDown() throws Exception
     {
+        SWTBotUtils.deleteTestConnections();
         bot = null;
-        
-        // clear all created connections
-        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
-        for( Connection connection : connectionManager.getConnections() )
-        {
-            connectionManager.removeConnection( connection );
-        }
         super.tearDown();
     }
 

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=667813&r1=667812&r2=667813&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
Sat Jun 14 08:18:10 2008
@@ -29,14 +29,6 @@
 import net.sf.swtbot.widgets.SWTBotTree;
 
 import org.apache.directory.server.unit.AbstractServerTest;
-import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
-import org.apache.directory.studio.connection.core.ConnectionFolder;
-import org.apache.directory.studio.connection.core.ConnectionFolderManager;
-import org.apache.directory.studio.connection.core.ConnectionManager;
-import org.apache.directory.studio.connection.core.ConnectionParameter;
-import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
-import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 
 
 /**
@@ -55,14 +47,14 @@
         super.setUp();
         bot = new SWTEclipseBot();
         SWTBotUtils.openLdapPerspective( bot );
-        createConnection();
+        SWTBotUtils.createTestConnection( bot, "NewEntryWizardTest", ldapServer.getIpPort()
);
     }
 
 
     protected void tearDown() throws Exception
     {
+        SWTBotUtils.deleteTestConnections();
         bot = null;
-        deleteConnection();
         super.tearDown();
     }
 
@@ -75,7 +67,7 @@
     public void testCreateOrganizationEntry() throws Exception
     {
         final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectNode( browserTree, "DIT", "Root DSE", "ou=system" );
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" );
 
         // open "New Entry" wizard
         SWTBotMenu contextMenu = browserTree.contextMenu( "New Entry..." );
@@ -140,7 +132,7 @@
     public void testCreatePersonEntry() throws Exception
     {
         final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectNode( browserTree, "DIT", "Root DSE", "ou=system" );
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" );
 
         // open "New Entry" wizard
         SWTBotMenu contextMenu = browserTree.contextMenu( "New Entry..." );
@@ -181,7 +173,8 @@
         SWTBotTree tree = bot.tree( 0 );
         tree.select( "sn" );
         bot.text( "" ).setText( "test" );
-
+        tree.select( "cn" );
+        
         // TODO: with SWTBot 1.2 we could use the tree.click() method! 
         // workaround to apply the new value 
         bot.button( "< Back" ).click();
@@ -237,7 +230,7 @@
 
     private void createEntry( final SWTBotTree browserTree, final String name ) throws Exception
     {
-        SWTBotUtils.selectNode( browserTree, "DIT", "Root DSE", "ou=system" );
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" );
 
         SWTBotMenu contextMenu = browserTree.contextMenu( "New Entry..." );
         contextMenu.click();
@@ -287,50 +280,4 @@
         } );
     }
 
-
-    /**
-     * Creates the test connection.
-     * 
-     * @throws Exception the exception
-     */
-    private void createConnection() throws Exception
-    {
-        SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot );
-
-        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
-        ConnectionParameter connectionParameter = new ConnectionParameter();
-        connectionParameter.setName( "NewEntryWizardTest" );
-        connectionParameter.setHost( "localhost" );
-        connectionParameter.setPort( ldapServer.getIpPort() );
-        connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
-        connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
-        connectionParameter.setBindPrincipal( "uid=admin,ou=system" );
-        connectionParameter.setBindPassword( "secret" );
-        Connection connection = new Connection( connectionParameter );
-        connectionManager.addConnection( connection );
-
-        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
-            .getConnectionFolderManager();
-        ConnectionFolder rootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
-        rootConnectionFolder.addConnectionId( connection.getId() );
-        //new OpenConnectionsJob( connection ).execute();
-
-        connectionsTree.select( "NewEntryWizardTest" );
-
-        Thread.sleep( 1000 );
-    }
-
-
-    /**
-     * Deletes the test connection.
-     */
-    private void deleteConnection()
-    {
-        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
-        for ( Connection connection : connectionManager.getConnections() )
-        {
-            connectionManager.removeConnection( connection );
-        }
-    }
-
 }

Added: 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=667813&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
Sat Jun 14 08:18:10 2008
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import net.sf.swtbot.eclipse.finder.SWTEclipseBot;
+import net.sf.swtbot.widgets.SWTBotMenu;
+import net.sf.swtbot.widgets.SWTBotTree;
+
+import org.apache.directory.server.unit.AbstractServerTest;
+
+
+/**
+ * Tests the rename entry dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RenameEntryDialogTest extends AbstractServerTest
+{
+    private SWTEclipseBot bot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        super.loadTestLdif( true );
+        bot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( bot );
+        SWTBotUtils.createTestConnection( bot, "RenameEntryDialogTest", ldapServer.getIpPort()
);
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        bot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-318.
+     * 
+     * Renames a multi-valued RDN by changing both RDN attributes.
+     * 
+     * @throws Exception the exception
+     */
+    public void testRenameMultiValuedRdn() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Barbara Jensen+uid=bjensen" );
+
+        SWTBotMenu contextMenu = browserTree.contextMenu( "Rename Entry..." );
+        contextMenu.click();
+
+        bot.text( "Barbara Jensen" ).setText( "Babs Jensen" );
+        bot.text( "bjensen" ).setText( "babsjens" );
+        bot.button( "OK" ).click();
+
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system", "ou=users",
+            "cn=Babs Jensen+uid=babsjens" );
+    }
+
+}

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=667813&r1=667812&r2=667813&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
Sat Jun 14 08:18:10 2008
@@ -27,11 +27,22 @@
 
 import net.sf.swtbot.eclipse.finder.SWTEclipseBot;
 import net.sf.swtbot.eclipse.finder.widgets.SWTBotView;
+import net.sf.swtbot.wait.DefaultCondition;
+import net.sf.swtbot.widgets.SWTBotButton;
 import net.sf.swtbot.widgets.SWTBotMenu;
 import net.sf.swtbot.widgets.SWTBotTable;
 import net.sf.swtbot.widgets.SWTBotTree;
 import net.sf.swtbot.widgets.SWTBotTreeItem;
 
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.ConnectionFolder;
+import org.apache.directory.studio.connection.core.ConnectionFolderManager;
+import org.apache.directory.studio.connection.core.ConnectionManager;
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
+import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+
 
 /**
  * Helpers for using SWTBot.
@@ -62,6 +73,56 @@
         // select "LDAP" perspective
         SWTBotTable table = bot.table();
         table.select( "LDAP" );
+
+        // press "OK"
+        SWTBotButton okButton = bot.button( "OK" );
+        okButton.click();
+    }
+
+
+    /**
+     * Creates the test connection.
+     * 
+     * @throws Exception the exception
+     */
+    public static void createTestConnection( SWTEclipseBot bot, String name, int port ) throws
Exception
+    {
+        SWTBotTree connectionsTree = getConnectionsTree( bot );
+
+        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
+        ConnectionParameter connectionParameter = new ConnectionParameter();
+        connectionParameter.setName( name );
+        connectionParameter.setHost( "localhost" );
+        connectionParameter.setPort( port );
+        connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
+        connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
+        connectionParameter.setBindPrincipal( "uid=admin,ou=system" );
+        connectionParameter.setBindPassword( "secret" );
+        Connection connection = new Connection( connectionParameter );
+        connectionManager.addConnection( connection );
+
+        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
+            .getConnectionFolderManager();
+        ConnectionFolder rootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
+        rootConnectionFolder.addConnectionId( connection.getId() );
+
+        connectionsTree.select( name );
+        //new OpenConnectionsJob( connection ).execute();
+
+        Thread.sleep( 1000 );
+    }
+
+
+    /**
+     * Deletes the test connection.
+     */
+    public static void deleteTestConnections()
+    {
+        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
+        for ( Connection connection : connectionManager.getConnections() )
+        {
+            connectionManager.removeConnection( connection );
+        }
     }
 
 
@@ -83,7 +144,8 @@
     }
 
 
-    public static SWTBotTreeItem selectNode( SWTBotTree browserTree, String... path ) throws
Exception
+    public static SWTBotTreeItem selectNode( SWTEclipseBot bot, SWTBotTree browserTree, String...
path )
+        throws Exception
     {
         List<String> pathList = new ArrayList<String>( Arrays.asList( path )
);
         String currentPath = pathList.remove( 0 );
@@ -94,7 +156,7 @@
 
         if ( !pathList.isEmpty() )
         {
-            return selectNode( child, pathList );
+            return selectNode( bot, child, pathList );
         }
         else
         {
@@ -103,25 +165,43 @@
     }
 
 
-    public static SWTBotTreeItem selectNode( SWTBotTreeItem item, List<String> pathList
) throws Exception
+    public static SWTBotTreeItem selectNode( SWTEclipseBot bot, final SWTBotTreeItem item,
List<String> pathList )
+        throws Exception
     {
-        String currentPath = pathList.remove( 0 );
+        final String[] currentPath = new String[]
+            { pathList.remove( 0 ) };
 
-        List<String> nodes = item.getNodes();
-        for ( String node : nodes )
+        // wait till node becomes visible
+        bot.waitUntil( new DefaultCondition()
         {
-            if ( node.toUpperCase().startsWith( currentPath.toUpperCase() ) )
+            public boolean test() throws Exception
             {
-                currentPath = node;
+                List<String> nodes = item.getNodes();
+                for ( String node : nodes )
+                {
+                    if ( node.toUpperCase().startsWith( currentPath[0].toUpperCase() ) )
+                    {
+                        currentPath[0] = node;
+                        return true;
+                    }
+                }
+                return false;
             }
-        }
-        SWTBotTreeItem child = item.expandNode( currentPath );
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+
+        SWTBotTreeItem child = item.expandNode( currentPath[0] );
         child.select();
         child.expand();
 
         if ( !pathList.isEmpty() )
         {
-            return selectNode( child, pathList );
+            return selectNode( bot, child, pathList );
         }
         else
         {

Added: directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif?rev=667813&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
Sat Jun 14 08:18:10 2008
@@ -0,0 +1,10 @@
+dn: cn=Barbara Jensen+uid=bjensen,ou=users,ou=system
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Barbara Jensen
+sn: Jensen
+givenName: Barbara
+uid: bjensen
+



Mime
View raw message