directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r830316 - in /directory/studio/trunk: ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/ test-integration-ui/ test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ test-integration-ui/src/mai...
Date Tue, 27 Oct 2009 19:55:46 GMT
Author: seelmann
Date: Tue Oct 27 19:55:45 2009
New Revision: 830316

URL: http://svn.apache.org/viewvc?rev=830316&view=rev
Log:
Fix for DIRSTUDIO-575 (Bookmarks not working)
o Ensure that attributes of bookmarks are initialized when opening the editor
o Added UI test

Added:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
Modified:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
    directory/studio/trunk/test-integration-ui/pom.xml
    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/bots/StudioBot.java

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java?rev=830316&r1=830315&r2=830316&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
(original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/entryeditors/EntryEditorManager.java
Tue Oct 27 19:55:45 2009
@@ -727,6 +727,10 @@
         {
             input = new EntryEditorInput( bookmarks[0], extension );
             entry = bookmarks[0].getEntry();
+            if ( entry.getBrowserConnection().getEntryFromCache( entry.getDn() ) == null
)
+            {
+                EntryEditorUtils.ensureAttributesInitialized( entry );
+            }
         }
         else
         {

Modified: directory/studio/trunk/test-integration-ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/pom.xml?rev=830316&r1=830315&r2=830316&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/pom.xml (original)
+++ directory/studio/trunk/test-integration-ui/pom.xml Tue Oct 27 19:55:45 2009
@@ -258,6 +258,7 @@
             <Bundle-Localization>plugin</Bundle-Localization>
             <Require-Bundle>org.eclipse.core.runtime,
  org.eclipse.ui,
+ org.apache.directory.studio.jars,
  org.apache.directory.studio.connection.core,
  org.apache.directory.studio.connection.ui,
  org.apache.directory.studio.ldapbrowser.common,
@@ -318,11 +319,13 @@
       <groupId>org.apache.directory.shared</groupId>
       <artifactId>shared-ldap</artifactId>
       <version>0.9.15</version>
+      <scope>provided</scope>
     </dependency> 
     <dependency>
       <groupId>org.apache.directory.shared</groupId>
       <artifactId>shared-asn1</artifactId>
       <version>0.9.15</version>
+      <scope>provided</scope>
     </dependency> 
     <dependency>
       <groupId>junit</groupId>

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=830316&r1=830315&r2=830316&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
Tue Oct 27 19:55:45 2009
@@ -22,6 +22,9 @@
 
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.server.core.integ.Level;
@@ -29,10 +32,16 @@
 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.connection.core.Connection;
+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;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.Bookmark;
 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.DeleteDialogBot;
+import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
@@ -60,6 +69,8 @@
     private ConnectionsViewBot connectionsViewBot;
     private BrowserViewBot browserViewBot;
 
+    private Connection connection;
+
     private SWTWorkbenchBot eBot;
 
 
@@ -69,7 +80,7 @@
         studioBot = new StudioBot();
         studioBot.resetLdapPerspective();
         connectionsViewBot = studioBot.getConnectionView();
-        connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
+        connection = connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort()
);
         browserViewBot = studioBot.getBrowserView();
 
         eBot = new SWTWorkbenchBot();
@@ -147,4 +158,34 @@
         assertEquals( "Only 2 event firings expected when deleting multiple entries.", 2,
fireCount );
     }
 
+
+    /**
+     * Test for DIRSTUDIO-575.
+     * 
+     * When opening a bookmark the entry editor should be opened and the 
+     * bookmark entry's attributes should be displayed.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testBookmark() throws Exception
+    {
+        // create a bookmark
+        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+            .getBrowserConnection( connection );
+        browserConnection.getBookmarkManager().addBookmark(
+            new Bookmark( browserConnection, new LdapDN( "uid=user.1,ou=users,ou=system"
), "Existing Bookmark" ) );
+
+        // select the bookmark
+        browserViewBot.selectEntry( "Bookmarks", "Existing Bookmark" );
+
+        // check that entry editor was opened and attributes are visible
+        EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system"
);
+        String dn = entryEditorBot.getDnText();
+        assertEquals( "DN: uid=user.1,ou=users,ou=system", dn );
+        List<String> attributeValues = entryEditorBot.getAttributeValues();
+        assertEquals( 23, attributeValues.size() );
+        assertTrue( attributeValues.contains( "uid: user.1" ) );
+    }
+
 }

Added: 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=830316&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
Tue Oct 27 19:55:45 2009
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+
+public class EntryEditorBot
+{
+
+    private SWTBotEditor editor;
+    private SWTBot bot;
+
+
+    public EntryEditorBot( String title )
+    {
+        SWTWorkbenchBot bot = new SWTWorkbenchBot();
+        editor = bot.editorByTitle( title );
+        this.bot = editor.bot();
+    }
+
+
+    public String getDnText()
+    {
+        String text = bot.text().getText();
+        return text;
+    }
+
+
+    public boolean isEnabled()
+    {
+        return bot.tree().isEnabled();
+    }
+
+
+    public List<String> getAttributeValues()
+    {
+        SWTBotTree tree = bot.tree();
+        List<String> attributes = new ArrayList<String>();
+        int rowCount = tree.rowCount();
+        for ( int i = 0; i < rowCount; i++ )
+        {
+            String attribute = tree.cell( i, 0 );
+            String value = tree.cell( i, 1 );
+            attributes.add( attribute + ": " + value );
+        }
+        return attributes;
+    }
+
+}

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java?rev=830316&r1=830315&r2=830316&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
Tue Oct 27 19:55:45 2009
@@ -46,6 +46,12 @@
     }
 
 
+    public EntryEditorBot getEntryEditorBot( String title )
+    {
+        return new EntryEditorBot( title );
+    }
+
+
     public void resetLdapPerspective()
     {
         UIThreadRunnable.syncExec( new VoidResult()



Mime
View raw message