directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r800748 - in /directory/studio/trunk: ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ test-integration-ui/src/main/resource...
Date Tue, 04 Aug 2009 12:25:05 GMT
Author: seelmann
Date: Tue Aug  4 12:25:05 2009
New Revision: 800748

URL: http://svn.apache.org/viewvc?rev=800748&view=rev
Log:
Fix for DIRSTUDIO-512 (Deletion of entries very slow)
o Removed UI update for each deleted entry
o Added test


Added:
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=800748&r1=800747&r2=800748&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
Tue Aug  4 12:25:05 2009
@@ -43,7 +43,6 @@
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
-import org.apache.directory.studio.ldapbrowser.core.events.EntryDeletedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -319,10 +318,9 @@
 
     protected void runNotification()
     {
-        for ( IEntry entry : deletedEntriesSet )
-        {
-            EventRegistry.fireEntryUpdated( new EntryDeletedEvent( entry.getBrowserConnection(),
entry ), this );
-        }
+        // don't fire an EntryDeletedEvent for each deleted entry
+        // that would cause massive UI updates
+        // instead we fire a ChildrenInitializedEvent for each parent
         for ( IEntry parent : entriesToUpdateSet )
         {
             EventRegistry.fireEntryUpdated( new ChildrenInitializedEvent( parent ), this
);

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=800748&r1=800747&r2=800748&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 Aug  4 12:25:05 2009
@@ -25,12 +25,16 @@
 
 import org.apache.commons.lang.StringUtils;
 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.studio.ldapbrowser.core.events.EventRegistry;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
 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;
@@ -45,19 +49,21 @@
  */
 @RunWith(SiRunner.class)
 @CleanupLevel(Level.SUITE)
+@ApplyLdifFiles(
+    { "BrowserTest.ldif" })
 public class BrowserTest
 {
     public static LdapServer ldapServer;
 
-    private SWTWorkbenchBot bot;
+    private SWTWorkbenchBot eBot;
 
 
     @Before
     public void setUp() throws Exception
     {
-        bot = new SWTWorkbenchBot();
-        SWTBotUtils.openLdapPerspective( bot );
-        SWTBotUtils.createTestConnection( bot, "BrowserTest", ldapServer.getPort() );
+        eBot = new SWTWorkbenchBot();
+        SWTBotUtils.openLdapPerspective( eBot );
+        SWTBotUtils.createTestConnection( eBot, "BrowserTest", ldapServer.getPort() );
     }
 
 
@@ -65,7 +71,7 @@
     public void tearDown() throws Exception
     {
         SWTBotUtils.deleteTestConnections();
-        bot = null;
+        eBot = null;
     }
 
 
@@ -80,23 +86,72 @@
     @Test
     public void testOnlyOneSearchRequestWhenExpandingEntry() throws Exception
     {
-        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system"
);
+        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
+        SWTBotUtils.selectEntry( eBot, browserTree, false, "DIT", "Root DSE", "ou=system"
);
 
         // get number of search requests before expanding the entry
-        SWTBotStyledText searchLogsText = SWTBotUtils.getSearchLogsText( bot );
+        SWTBotStyledText searchLogsText = SWTBotUtils.getSearchLogsText( eBot );
         String text = searchLogsText.getText();
         int countMatchesBefore = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
 
         // expand
-        browserTree = SWTBotUtils.getLdapBrowserTree( bot );
-        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+        browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
+        SWTBotUtils.selectEntry( eBot, browserTree, true, "DIT", "Root DSE", "ou=system"
);
 
         // get number of search requests after expanding the entry
-        searchLogsText = SWTBotUtils.getSearchLogsText( bot );
+        searchLogsText = SWTBotUtils.getSearchLogsText( eBot );
         text = searchLogsText.getText();
         int countMatchesAfter = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
 
         assertEquals( "Expected exactly 1 search request", 1, countMatchesAfter - countMatchesBefore
);
     }
+
+
+    /**
+     * Test for DIRSTUDIO-512.
+     * 
+     * Verify minimum UI updates when deleting multiple entries.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testDeleteDontUpdateUI() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( eBot );
+        SWTBotTreeItem ou = SWTBotUtils.selectEntry( eBot, browserTree, true, "DIT", "Root
DSE", "ou=system",
+            "ou=users" );
+
+        long fireCount0 = EventRegistry.getFireCount();
+
+        // delete
+        ou.select( "uid=user.1", "uid=user.2", "uid=user.3", "uid=user.4", "uid=user.5",
"uid=user.6", "uid=user.7",
+            "uid=user.8" );
+        browserTree.contextMenu( "Delete Entries" ).click();
+        eBot.shell( "Delete Entries" );
+        eBot.button( "OK" ).click();
+
+        // wait until tree is refreshed, that is if ou=users doesn't has any children
+        eBot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                SWTBotTreeItem ou = SWTBotUtils.selectEntry( eBot, browserTree, true, "DIT",
"Root DSE", "ou=system",
+                    "ou=users" );
+                return "ou=users".equals( ou.getText() ) && ou.getNodes().isEmpty();
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "'ou=users' should be selected and should not contain any children";
+            }
+        } );
+
+        long fireCount1 = EventRegistry.getFireCount();
+
+        // verify that only two events were fired during deletion
+        long fireCount = fireCount1 - fireCount0;
+        assertEquals( "Only 2 event firings expected when deleting multiple entries.", 2,
fireCount );
+    }
+
 }

Added: directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif?rev=800748&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
Tue Aug  4 12:25:05 2009
@@ -0,0 +1,199 @@
+dn: uid=user.1,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaccf
+sn: Amar
+cn: Aaccf Amar
+initials: AA
+uid: user.1
+mail: user.1@null
+userPassword: password
+telephoneNumber: 976-893-3312
+homePhone: 337-310-0727
+pager: 185-156-4071
+mobile: 626-188-0934
+employeeNumber: 1
+street: 27919 Broadway Street
+l: Tallahassee
+st: DE
+postalCode: 67698
+postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE  67698
+description: This is the description for Aaccf Amar.
+roomNumber: 1388
+
+dn: uid=user.2,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaren
+sn: Atp
+cn: Aaren Atp
+initials: AA
+uid: user.2
+mail: user.2@null
+userPassword: password
+telephoneNumber: 147-953-0396
+homePhone: 174-439-5329
+pager: 617-443-8449
+mobile: 045-464-2512
+employeeNumber: 2
+street: 36109 Center Street
+l: Harlingen
+st: CO
+postalCode: 21733
+postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO  21733
+description: This is the description for Aaren Atp.
+roomNumber: 1198
+
+dn: uid=user.3,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aarika
+sn: Atpco
+cn: Aarika Atpco
+initials: AA
+uid: user.3
+mail: user.3@null
+userPassword: password
+telephoneNumber: 925-356-4943
+homePhone: 099-983-0308
+pager: 806-672-7363
+mobile: 425-493-8009
+employeeNumber: 3
+street: 14730 Fourteenth Street
+l: Evansville
+st: ND
+postalCode: 95526
+postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND  95526
+description: This is the description for Aarika Atpco.
+roomNumber: 1135
+
+dn: uid=user.4,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaron
+sn: Atrc
+cn: Aaron Atrc
+initials: AA
+uid: user.4
+mail: user.4@null
+userPassword: password
+telephoneNumber: 696-981-0488
+homePhone: 854-401-1330
+pager: 389-028-9518
+mobile: 117-882-4912
+employeeNumber: 4
+street: 98495 Fifteenth Street
+l: Miami
+st: PA
+postalCode: 16887
+postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA  16887
+description: This is the description for Aaron Atrc.
+roomNumber: 1311
+
+dn: uid=user.5,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aartjan
+sn: Aalders
+cn: Aartjan Aalders
+initials: AA
+uid: user.5
+mail: user.5@null
+userPassword: password
+telephoneNumber: 657-627-9753
+homePhone: 109-158-4533
+pager: 801-392-0010
+mobile: 763-973-0947
+employeeNumber: 5
+street: 52408 Ridge Street
+l: Omaha
+st: AR
+postalCode: 08015
+postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR  08015
+description: This is the description for Aartjan Aalders.
+roomNumber: 1090
+
+dn: uid=user.6,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abagael
+sn: Aasen
+cn: Abagael Aasen
+initials: AA
+uid: user.6
+mail: user.6@null
+userPassword: password
+telephoneNumber: 600-556-9017
+homePhone: 543-731-7797
+pager: 349-743-6572
+mobile: 042-921-9717
+employeeNumber: 6
+street: 87514 Dogwood Street
+l: Bloomington
+st: ID
+postalCode: 56762
+postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID  56762
+description: This is the description for Abagael Aasen.
+roomNumber: 1449
+
+dn: uid=user.7,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abagail
+sn: Abadines
+cn: Abagail Abadines
+initials: AA
+uid: user.7
+mail: user.7@null
+userPassword: password
+telephoneNumber: 628-294-0713
+homePhone: 313-764-3970
+pager: 118-541-2978
+mobile: 111-360-9243
+employeeNumber: 7
+street: 60751 Main Street
+l: Macon
+st: MI
+postalCode: 38755
+postalAddress: Abagail Abadines$60751 Main Street$Macon, MI  38755
+description: This is the description for Abagail Abadines.
+roomNumber: 1312
+
+dn: uid=user.8,ou=users,ou=system
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abahri
+sn: Abazari
+cn: Abahri Abazari
+initials: AA
+uid: user.8
+mail: user.8@null
+userPassword: password
+telephoneNumber: 760-373-5805
+homePhone: 856-861-3648
+pager: 271-218-0027
+mobile: 957-465-6928
+employeeNumber: 8
+street: 81023 River Street
+l: Monroe
+st: SD
+postalCode: 51865
+postalAddress: Abahri Abazari$81023 River Street$Monroe, SD  51865
+description: This is the description for Abahri Abazari.
+roomNumber: 1963



Mime
View raw message