directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r928372 - in /directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui: BrowserTest.java EntryEditorTest.java bots/BrowserWidgetBot.java bots/EntryEditorBot.java bots/EntryEditorWidgetBot.java
Date Sun, 28 Mar 2010 10:37:18 GMT
Author: seelmann
Date: Sun Mar 28 10:37:17 2010
New Revision: 928372

URL: http://svn.apache.org/viewvc?rev=928372&view=rev
Log:
Added tests for DIRSTUDIO-637

Modified:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.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/bots/BrowserWidgetBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java?rev=928372&r1=928371&r2=928372&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
Sun Mar 28 10:37:17 2010
@@ -28,6 +28,7 @@ import static junit.framework.Assert.ass
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.integ.Level;
@@ -38,6 +39,7 @@ import org.apache.directory.server.ldap.
 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.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -50,6 +52,7 @@ import org.apache.directory.studio.test.
 import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
 import org.eclipse.jface.dialogs.ErrorDialog;
 import org.junit.After;
 import org.junit.Before;
@@ -493,4 +496,48 @@ public class BrowserTest
         browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=loopback+ipHostNumber=127.0.0.1"
);
     }
 
+
+    /**
+     * DIRSTUDIO-637: copy/paste of attributes no longer works.
+     * Test copy/paste of a value to a bookmark.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    @Test
+    public void testCopyPasteValueToBookmark() throws Exception
+    {
+        // create a bookmark
+        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+            .getBrowserConnection( connection );
+        browserConnection.getBookmarkManager().addBookmark(
+            new Bookmark( browserConnection, new LdapDN( "uid=user.2,ou=users,ou=system"
), "My Bookmark" ) );
+
+        // copy a value
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1"
);
+        EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system"
);
+        entryEditorBot.activate();
+        entryEditorBot.copyValue( "uid", "user.1" );
+
+        // select the bookmark
+        browserViewBot.selectEntry( "Bookmarks", "My Bookmark" );
+        entryEditorBot = studioBot.getEntryEditorBot( "uid=user.2,ou=users,ou=system" );
+        entryEditorBot.activate();
+        assertEquals( 23, entryEditorBot.getAttributeValues().size() );
+
+        // paste the value
+        JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__execute_ldif_name
);
+        browserViewBot.paste();
+        watcher.waitUntilDone();
+
+        // assert pasted value visible in editor
+        assertEquals( 24, entryEditorBot.getAttributeValues().size() );
+        entryEditorBot.getAttributeValues().contains( "uid: user.1" );
+
+        // assert pasted value was written to directory
+        ClonedServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
+            new LdapDN( "uid=user.2,ou=users,ou=system" ) );
+        assertTrue( entry.contains( "uid", "user.1" ) );
+    }
+
 }

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=928372&r1=928371&r2=928372&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
Sun Mar 28 10:37:17 2010
@@ -27,11 +27,14 @@ import static junit.framework.Assert.ass
 import static org.eclipse.swtbot.swt.finder.SWTBotTestCase.assertContains;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.directory.server.core.entry.ClonedServerEntry;
 import org.apache.directory.server.core.integ.Level;
 import org.apache.directory.server.core.integ.annotations.ApplyLdifFiles;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
 import org.apache.directory.server.integ.SiRunner;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.DnEditorDialogBot;
@@ -40,6 +43,7 @@ import org.apache.directory.studio.test.
 import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot;
 import org.apache.directory.studio.test.integration.ui.bots.SelectDnDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
 import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -211,4 +215,44 @@ public class EntryEditorTest
             .getModificationLogsText(), "#!RESULT OK" ) );
     }
 
+
+    /**
+     * DIRSTUDIO-637: copy/paste of attributes no longer works.
+     * Test copy/paste within entry editor.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    @Test
+    public void testCopyPasteIn() throws Exception
+    {
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara
Jensen" );
+
+        // copy a value
+        EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system"
);
+        entryEditorBot.activate();
+        entryEditorBot.copyValue( "uid", "bjensen" );
+
+        // go to another entry
+        browserViewBot
+            .selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\""
);
+        entryEditorBot = studioBot.getEntryEditorBot( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system"
);
+        entryEditorBot.activate();
+        assertEquals( 8, entryEditorBot.getAttributeValues().size() );
+
+        // paste value, wait till job is done
+        JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__execute_ldif_name
);
+        entryEditorBot.pasteValue();
+        watcher.waitUntilDone();
+
+        // assert pasted value visible in editor
+        assertEquals( 9, entryEditorBot.getAttributeValues().size() );
+        entryEditorBot.getAttributeValues().contains( "uid: bjensen" );
+
+        // assert pasted value was written to directory
+        ClonedServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
+            new LdapDN( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" ) );
+        assertTrue( entry.contains( "uid", "bjensen" ) );
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java?rev=928372&r1=928371&r2=928372&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
Sun Mar 28 10:37:17 2010
@@ -5,6 +5,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
@@ -183,8 +185,10 @@ class BrowserWidgetBot
                 }
             } );
         }
+        JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__init_entries_title_attonly
);
         entry.click();
         entry.select();
+        watcher.waitUntilDone();
     }
 
 

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java?rev=928372&r1=928371&r2=928372&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
Sun Mar 28 10:37:17 2010
@@ -106,4 +106,16 @@ public class EntryEditorBot
         editorBot.deleteValue( attributeType, value );
     }
 
+
+    public void copyValue( String attributeType, String value )
+    {
+        editorBot.copyValue( attributeType, value );
+    }
+
+
+    public void pasteValue()
+    {
+        editorBot.pasteValue();
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java?rev=928372&r1=928371&r2=928372&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
Sun Mar 28 10:37:17 2010
@@ -110,10 +110,24 @@ class EntryEditorWidgetBot
     void deleteValue( String attributeType, String value )
     {
         SWTBotTreeItem treeItem = getTreeItem( attributeType, value );
-        treeItem.click();
+        treeItem.select();
         ContextMenuHelper.clickContextMenu( bot.tree(), "Delete Value" );
         DeleteDialogBot deleteDialogBot = new DeleteDialogBot( DeleteDialogBot.DELETE_VALUE_TITLE
);
         deleteDialogBot.clickOkButton();
     }
 
+
+    public void copyValue( String attributeType, String value )
+    {
+        SWTBotTreeItem treeItem = getTreeItem( attributeType, value );
+        treeItem.select();
+        ContextMenuHelper.clickContextMenu( bot.tree(), "Copy Value" );
+    }
+
+
+    public void pasteValue()
+    {
+        ContextMenuHelper.clickContextMenu( bot.tree(), "Paste Value" );
+    }
+
 }



Mime
View raw message