directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r830496 - 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/java/org...
Date Wed, 28 Oct 2009 10:43:07 GMT
Author: seelmann
Date: Wed Oct 28 10:43:07 2009
New Revision: 830496

URL: http://svn.apache.org/viewvc?rev=830496&view=rev
Log:
DIRSTUDIO-481 (Improve refreshing of attributes and children)
o Refresh didn't work for search continuations
o Added tests

Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
    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/BrowserViewBot.java

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java?rev=830496&r1=830495&r2=830496&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenRunnable.java
Wed Oct 28 10:43:07 2009
@@ -38,7 +38,6 @@
 import org.apache.directory.studio.ldapbrowser.core.events.ChildrenInitializedEvent;
 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.IContinuation;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
@@ -429,11 +428,6 @@
 
     static void clearCaches( IEntry entry, boolean purgeAllCaches )
     {
-        if ( entry instanceof IContinuation )
-        {
-            return;
-        }
-
         // clear the parent-child relationship, recursively
         IEntry[] children = entry.getChildren();
         if ( children != null )

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=830496&r1=830495&r2=830496&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
Wed Oct 28 10:43:07 2009
@@ -22,11 +22,14 @@
 
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 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;
@@ -34,6 +37,7 @@
 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.connection.core.Connection.ReferralHandlingMethod;
 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;
@@ -42,6 +46,7 @@
 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.ReferralDialogBot;
 import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.junit.After;
@@ -181,4 +186,220 @@
         assertTrue( attributeValues.contains( "uid: user.1" ) );
     }
 
+
+    /**
+     * Test for DIRSTUDIO-481.
+     * 
+     * Check proper operation of refresh action.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testRefreshParent() throws Exception
+    {
+        // check the entry doesn't exist yet
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // add the entry directly in the server
+        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        entry.setDn( new LdapDN( "cn=refresh,ou=users,ou=system" ) );
+        entry.add( "objectClass", "top", "person" );
+        entry.add( "cn", "refresh" );
+        entry.add( "sn", "refresh" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
+
+        // check the entry still isn't visible in the tree
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh parent
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        browserViewBot.refresh();
+
+        // check the entry exists now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh"
);
+
+        // delete the entry directly in the server
+        ldapServer.getDirectoryService().getAdminSession().delete( new LdapDN( "cn=refresh,ou=users,ou=system"
) );
+
+        // check the entry still is now visible in the tree
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh parent
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        browserViewBot.refresh();
+
+        // check the entry doesn't exist now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-481.
+     * 
+     * Check proper operation of refresh action.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testRefreshContextEntry() throws Exception
+    {
+        // check the entry doesn't exist yet
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // add the entry directly in the server
+        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        entry.setDn( new LdapDN( "cn=refresh,ou=users,ou=system" ) );
+        entry.add( "objectClass", "top", "person" );
+        entry.add( "cn", "refresh" );
+        entry.add( "sn", "refresh" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
+
+        // check the entry still isn't visible in the tree
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh context entry
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+        browserViewBot.refresh();
+
+        // check the entry exists now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh"
);
+
+        // delete the entry directly in the server
+        ldapServer.getDirectoryService().getAdminSession().delete( new LdapDN( "cn=refresh,ou=users,ou=system"
) );
+
+        // check the entry still is now visible in the tree
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh context entry
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+        browserViewBot.refresh();
+
+        // check the entry doesn't exist now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-481.
+     * 
+     * Check proper operation of refresh action.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testRefreshRootDSE() throws Exception
+    {
+        // check the entry doesn't exist yet
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // add the entry directly in the server
+        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        entry.setDn( new LdapDN( "cn=refresh,ou=users,ou=system" ) );
+        entry.add( "objectClass", "top", "person" );
+        entry.add( "cn", "refresh" );
+        entry.add( "sn", "refresh" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
+
+        // check the entry still isn't visible in the tree
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh Root DSE
+        browserViewBot.selectEntry( "DIT", "Root DSE" );
+        browserViewBot.refresh();
+
+        // check the entry exists now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh"
);
+
+        // delete the entry directly in the server
+        ldapServer.getDirectoryService().getAdminSession().delete( new LdapDN( "cn=refresh,ou=users,ou=system"
) );
+
+        // check the entry still is now visible in the tree
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+
+        // refresh Root DSE
+        browserViewBot.selectEntry( "DIT", "Root DSE" );
+        browserViewBot.refresh();
+
+        // check the entry doesn't exist now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
"cn=refresh" ) );
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-481.
+     * 
+     * Check proper operation of refresh action.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testRefreshSearchContinuation() throws Exception
+    {
+        // preparation: add referral entry and set referral handling
+        String url = "ldap://localhost:" + ldapServer.getPort() + "/ou=users,ou=system";
+        ServerEntry refEntry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        refEntry.setDn( new LdapDN( "cn=referral,ou=system" ) );
+        refEntry.add( "objectClass", "top", "referral", "extensibleObject" );
+        refEntry.add( "cn", "referral" );
+        refEntry.add( "ref", url );
+        ldapServer.getDirectoryService().getAdminSession().add( refEntry );
+        connection.getConnectionParameter().setExtendedIntProperty(
+            IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+            ReferralHandlingMethod.FOLLOW_MANUALLY.ordinal() );
+        browserViewBot.selectEntry( "DIT", "Root DSE" );
+        browserViewBot.refresh();
+
+        // check the entry doesn't exist yet
+        ReferralDialogBot refDialog = browserViewBot.expandEntryExpectingReferralDialog(
"DIT", "Root DSE",
+            "ou=system", url );
+        refDialog.clickOkButton();
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh"
) );
+
+        // add the entry directly in the server
+        ServerEntry entry = new DefaultServerEntry( ldapServer.getDirectoryService().getRegistries()
);
+        entry.setDn( new LdapDN( "cn=refresh,ou=users,ou=system" ) );
+        entry.add( "objectClass", "top", "person" );
+        entry.add( "cn", "refresh" );
+        entry.add( "sn", "refresh" );
+        ldapServer.getDirectoryService().getAdminSession().add( entry );
+
+        // check the entry still isn't visible in the tree
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh"
) );
+
+        // refresh search continuation
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url );
+        browserViewBot.refresh();
+
+        // check the entry exists now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", url );
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh"
) );
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" );
+
+        // delete the entry directly in the server
+        ldapServer.getDirectoryService().getAdminSession().delete( new LdapDN( "cn=refresh,ou=users,ou=system"
) );
+
+        // check the entry still is now visible in the tree
+        assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh"
) );
+
+        // refresh search continuation
+        browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url );
+        browserViewBot.refresh();
+
+        // check the entry doesn't exist now
+        browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", url );
+        assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh"
) );
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java?rev=830496&r1=830495&r2=830496&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
Wed Oct 28 10:43:07 2009
@@ -268,4 +268,10 @@
         return tree;
     }
 
+
+    public void refresh()
+    {
+        ContextMenuHelper.clickContextMenu( getBrowserTree(), "Reload Entry" );
+    }
+
 }



Mime
View raw message