Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 20969 invoked from network); 13 Jul 2008 16:54:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Jul 2008 16:54:50 -0000 Received: (qmail 75105 invoked by uid 500); 13 Jul 2008 16:54:50 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 75071 invoked by uid 500); 13 Jul 2008 16:54:50 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 75062 invoked by uid 99); 13 Jul 2008 16:54:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Jul 2008 09:54:50 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Jul 2008 16:54:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3F59B23889FB; Sun, 13 Jul 2008 09:53:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r676357 - in /directory/studio/trunk: ./ connection-core/src/main/java/org/apache/directory/studio/connection/core/ connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ connection-ui/src/main/java/org/apache/di... Date: Sun, 13 Jul 2008 16:53:57 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080713165358.3F59B23889FB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Sun Jul 13 09:53:55 2008 New Revision: 676357 URL: http://svn.apache.org/viewvc?rev=676357&view=rev Log: o Updated to SWTBot trunk because it provides new features o Updated tests o Added test for referral handling o Fixed referral handling (DIRSTUDIO-343) o Removed duplicate ExceptionHandler class Added: directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.2.0.840/ directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.2.0.840/finder-1.2.0.840.jar (with props) directory/studio/trunk/repository/net/sf/swtbot/finder/1.2.0.840/ directory/studio/trunk/repository/net/sf/swtbot/finder/1.2.0.840/finder-1.2.0.840.jar (with props) directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.840.jar (with props) directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.spy_1.2.0.840.jar (with props) directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.ui_1.2.0.840.jar (with props) directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.840.jar (with props) directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java Removed: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/ExceptionHandler.java directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.0.0.574/ directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/maven-metadata.xml directory/studio/trunk/repository/net/sf/swtbot/finder/1.0.0.574/ directory/studio/trunk/repository/net/sf/swtbot/finder/maven-metadata.xml directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.721-dev.jar directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.721-dev.jar Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/IJndiLogger.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonActivator.java directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java directory/studio/trunk/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 directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/IJndiLogger.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/IJndiLogger.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/IJndiLogger.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/IJndiLogger.java Sun Jul 13 09:53:55 2008 @@ -27,7 +27,9 @@ import javax.naming.ldap.Control; import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod; +import org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo; import org.apache.directory.studio.connection.core.io.jndi.StudioSearchResult; +import org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.UrlAndDn; /** @@ -170,6 +172,19 @@ /** + * Logs a search result reference. + * + * @param connection the connection + * @param urlAndDn the first URL and DN + * @param referralsInfo the referrals info containing further URLs and DNs + * @param requestNum the request number + * @param the naming exception if an error occurred, null otherwise + */ + public void logSearchResultReference( Connection connection, ReferralsInfo.UrlAndDn urlAndDn, + ReferralsInfo referralsInfo, long requestNum, NamingException namingException ); + + + /** * Logs a search result done. * * @param connection the connection Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java Sun Jul 13 09:53:55 2008 @@ -219,7 +219,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeAdd(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.directory.Attributes, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeAdd( Connection connection, final String dn, final Attributes attributes, final Control[] controls, NamingException ex ) @@ -265,7 +265,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeDelete(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeDelete( Connection connection, final String dn, final Control[] controls, NamingException ex ) @@ -286,7 +286,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeModify(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.directory.ModificationItem[], javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeModify( Connection connection, final String dn, final ModificationItem[] modificationItems, final Control[] controls, NamingException ex ) @@ -349,7 +349,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeModDn(org.apache.directory.studio.connection.core.Connection, java.lang.String, java.lang.String, boolean, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeModDn( Connection connection, final String oldDn, final String newDn, final boolean deleteOldRdn, final Control[] controls, NamingException ex ) @@ -383,7 +383,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchRequest(org.apache.directory.studio.connection.core.Connection, java.lang.String, java.lang.String, javax.naming.directory.SearchControls, org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod, javax.naming.ldap.Control[], long, javax.naming.NamingException) + * {@inheritDoc} */ public void logSearchRequest( Connection connection, String searchBase, String filter, SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod, Control[] controls, @@ -394,7 +394,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchResultEntry(org.apache.directory.studio.connection.core.Connection, org.apache.directory.studio.connection.core.io.jndi.StudioSearchResult, long, javax.naming.NamingException) + * {@inheritDoc} */ public void logSearchResultEntry( Connection connection, StudioSearchResult studioSearchResult, long requestNum, NamingException ex ) @@ -402,11 +402,20 @@ // don't log searches } + + /** + * {@inheritDoc} + */ + public void logSearchResultReference( Connection connection, ReferralsInfo.UrlAndDn urlAndDn, + ReferralsInfo referralsInfo, long requestNum, NamingException ex ) + { + // don't log searches + } /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchResultDone(org.apache.directory.studio.connection.core.Connection, long, long, javax.naming.NamingException) + * {@inheritDoc} */ - public void logSearchResultDone( Connection connection, long count, long requestNum, NamingException namingException ) + public void logSearchResultDone( Connection connection, long count, long requestNum, NamingException ex ) { // don't log searches } Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java Sun Jul 13 09:53:55 2008 @@ -210,7 +210,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeAdd(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.directory.Attributes, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeAdd( Connection connection, final String dn, final Attributes attributes, final Control[] controls, NamingException ex ) @@ -220,7 +220,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeDelete(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeDelete( Connection connection, final String dn, final Control[] controls, NamingException ex ) @@ -230,7 +230,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeModify(org.apache.directory.studio.connection.core.Connection, java.lang.String, javax.naming.directory.ModificationItem[], javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeModify( Connection connection, final String dn, final ModificationItem[] modificationItems, final Control[] controls, NamingException ex ) @@ -240,7 +240,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logChangetypeModDn(org.apache.directory.studio.connection.core.Connection, java.lang.String, java.lang.String, boolean, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logChangetypeModDn( Connection connection, final String oldDn, final String newDn, final boolean deleteOldRdn, final Control[] controls, NamingException ex ) @@ -250,7 +250,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchRequest(org.apache.directory.studio.connection.core.Connection, java.lang.String, java.lang.String, javax.naming.directory.SearchControls, org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod, javax.naming.ldap.Control[], javax.naming.NamingException) + * {@inheritDoc} */ public void logSearchRequest( Connection connection, String searchBase, String filter, SearchControls searchControls, AliasDereferencingMethod aliasesDereferencingMethod, Control[] controls, @@ -312,7 +312,7 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchResultEntry(org.apache.directory.studio.connection.core.Connection, org.apache.directory.studio.connection.core.io.jndi.StudioSearchResult, javax.naming.NamingException) + * {@inheritDoc} */ public void logSearchResultEntry( Connection connection, StudioSearchResult studioSearchResult, long requestNum, NamingException ex ) @@ -324,32 +324,40 @@ try { - String dn = studioSearchResult.getNameInNamespace(); - Attributes attributes = studioSearchResult.getAttributes(); - - LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( dn ) ); - NamingEnumeration attributeEnumeration = attributes.getAll(); - while ( attributeEnumeration.hasMore() ) + String formattedString; + if ( studioSearchResult != null ) { - Attribute attribute = attributeEnumeration.next(); - String attributeName = attribute.getID(); - NamingEnumeration valueEnumeration = attribute.getAll(); - while ( valueEnumeration.hasMore() ) + String dn = studioSearchResult.getNameInNamespace(); + Attributes attributes = studioSearchResult.getAttributes(); + + LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( dn ) ); + NamingEnumeration attributeEnumeration = attributes.getAll(); + while ( attributeEnumeration.hasMore() ) { - Object o = valueEnumeration.next(); - if ( o instanceof String ) - { - record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) ); - } - if ( o instanceof byte[] ) + Attribute attribute = attributeEnumeration.next(); + String attributeName = attribute.getID(); + NamingEnumeration valueEnumeration = attribute.getAll(); + while ( valueEnumeration.hasMore() ) { - record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) ); + Object o = valueEnumeration.next(); + if ( o instanceof String ) + { + record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) ); + } + if ( o instanceof byte[] ) + { + record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) ); + } } } + record.finish( LdifSepLine.create() ); + formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT ); + } + else + { + formattedString = LdifFormatParameters.DEFAULT.getLineSeparator(); } - record.finish( LdifSepLine.create() ); - String formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT ); log( formattedString, "SEARCH RESULT ENTRY (" + requestNum + ")", ex, connection ); } catch ( NamingException e ) @@ -359,7 +367,31 @@ /** - * @see org.apache.directory.studio.connection.core.IJndiLogger#logSearchResultDone(org.apache.directory.studio.connection.core.Connection, long, javax.naming.NamingException) + * {@inheritDoc} + */ + public void logSearchResultReference( Connection connection, ReferralsInfo.UrlAndDn urlAndDn, + ReferralsInfo referralsInfo, long requestNum, NamingException ex ) + { + if ( !isSearchResultEntryLogEnabled() ) + { + return; + } + + Collection lines = new ArrayList(); + lines.add( LdifCommentLine.create( "# reference : " + ( urlAndDn != null ? urlAndDn.getUrl() : "null" ) ) ); + lines.add( LdifSepLine.create() ); + + String formattedString = ""; + for ( LdifLineBase line : lines ) + { + formattedString += line.toFormattedString( LdifFormatParameters.DEFAULT ); + } + log( formattedString, "SEARCH RESULT REFERENCE (" + requestNum + ")", ex, connection ); + } + + + /** + * {@inheritDoc} */ public void logSearchResultDone( Connection connection, long count, long requestNum, NamingException ex ) { Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ReferralsInfo.java Sun Jul 13 09:53:55 2008 @@ -74,7 +74,7 @@ } else { - throw new LinkLoopException( "Loop detected while following referral: " + urlAndDn.toString() ); + throw new LinkLoopException( "Loop detected while following referral: " + url ); } } @@ -104,7 +104,7 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ - class UrlAndDn + public static class UrlAndDn { private LdapURL url; private LdapDN dn; Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java (original) +++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/StudioNamingEnumeration.java Sun Jul 13 09:53:55 2008 @@ -142,19 +142,24 @@ { logResultDone = true; logResultDoneException = re; + referralsInfo = JNDIConnectionWrapper.handleReferralException( re, referralsInfo ); + UrlAndDn urlAndDn = referralsInfo.getNext(); + for ( IJndiLogger logger : ConnectionCorePlugin.getDefault().getJndiLoggers() ) + { + logger.logSearchResultReference( connection, urlAndDn, referralsInfo, requestNum, null ); + } - // ignore exception if referrals handling method is IGNORE - // report exception if referrals handling method is MANGAGE + // ignore exception if referrals handling method is IGNORE OR MANAGE // follow referral if referrals handling method is FOLLOW - if ( referralsHandlingMethod == ReferralHandlingMethod.IGNORE ) + if ( referralsHandlingMethod == ReferralHandlingMethod.IGNORE + || referralsHandlingMethod == ReferralHandlingMethod.MANAGE ) { + logResultDone = true; + logResultDoneException = null; return false; } else if ( referralsHandlingMethod == ReferralHandlingMethod.FOLLOW ) { - referralsInfo = JNDIConnectionWrapper.handleReferralException( re, referralsInfo ); - logResultDone = false; - UrlAndDn urlAndDn = referralsInfo.getNext(); if ( urlAndDn != null ) { LdapURL url = urlAndDn.getUrl(); @@ -162,6 +167,9 @@ .getReferralConnection( url, monitor, this ); if ( referralConnection != null ) { + logResultDone = false; + logResultDoneException = null; + String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty() ? url.getDn() .getUpName() : searchBase; String referralFilter = url.getFilter() != null && url.getFilter().length() == 0 ? url @@ -181,12 +189,14 @@ referralFilter, referralSearchControls, aliasesDereferencingMethod, referralsHandlingMethod, controls, monitor, referralsInfo ); } + else + { + logResultDone = true; + logResultDoneException = null; + return false; + } } } - else - { - throw re; - } } catch ( NamingException ne ) { Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java (original) +++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ExceptionHandler.java Sun Jul 13 09:53:55 2008 @@ -57,14 +57,22 @@ */ private void display( final String message, final IStatus status ) { - Runnable runnable = new Runnable() + if ( Thread.currentThread() == Display.getDefault().getThread() ) { - public void run() + ErrorDialog.openError( Display.getDefault().getActiveShell(), "Error", message, status ); + } + else + { + Runnable runnable = new Runnable() { - ErrorDialog.openError( Display.getDefault().getActiveShell(), "Error", message, status ); - } - }; - Display.getDefault().asyncExec( runnable ); + public void run() + { + ErrorDialog.openError( Display.getDefault().getActiveShell(), "Error", message, status ); + } + }; + Display.getDefault().asyncExec( runnable ); + } + ConnectionCorePlugin.getDefault().getLog().log( status ); } } Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonActivator.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonActivator.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonActivator.java (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonActivator.java Sun Jul 13 09:53:55 2008 @@ -65,9 +65,6 @@ /** The color registry */ private ColorRegistry colorRegistry; - /** The event dispatcher */ - private ExceptionHandler exceptionHandler; - /** The value editor preferences */ private ValueEditorsPreferences valueEditorPreferences; @@ -112,11 +109,6 @@ colorRegistry = new ColorRegistry( getWorkbench().getDisplay() ); } - if ( exceptionHandler == null ) - { - exceptionHandler = new ExceptionHandler(); - } - valueEditorPreferences = new ValueEditorsPreferences(); if ( filterTemplateContextTypeRegistry == null ) @@ -166,11 +158,6 @@ colorRegistry = null; } - if ( exceptionHandler != null ) - { - exceptionHandler = null; - } - if ( filterTemplateContextTypeRegistry != null ) { filterTemplateContextTypeRegistry = null; @@ -302,16 +289,6 @@ /** - * - * @return The exception handler - */ - public ExceptionHandler getExceptionHandler() - { - return exceptionHandler; - } - - - /** * Gets the value editors preferences. * * @return the value editors preferences Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java (original) +++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/HexDialog.java Sun Jul 13 09:53:55 2008 @@ -28,6 +28,7 @@ import java.io.FileOutputStream; import java.io.IOException; +import org.apache.directory.studio.connection.ui.ConnectionUIPlugin; import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator; import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants; import org.eclipse.core.runtime.IStatus; @@ -114,13 +115,13 @@ } catch ( FileNotFoundException e ) { - BrowserCommonActivator.getDefault().getExceptionHandler().handleException( + ConnectionUIPlugin.getDefault().getExceptionHandler().handleException( new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) ); } catch ( IOException e ) { - BrowserCommonActivator.getDefault().getExceptionHandler().handleException( + ConnectionUIPlugin.getDefault().getExceptionHandler().handleException( new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) ); } @@ -151,13 +152,13 @@ } catch ( FileNotFoundException e ) { - BrowserCommonActivator.getDefault().getExceptionHandler().handleException( + ConnectionUIPlugin.getDefault().getExceptionHandler().handleException( new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file", e ) ); } catch ( IOException e ) { - BrowserCommonActivator.getDefault().getExceptionHandler().handleException( + ConnectionUIPlugin.getDefault().getExceptionHandler().handleException( new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, IStatus.ERROR, "Can't read file", e ) ); } Modified: directory/studio/trunk/pom.xml URL: http://svn.apache.org/viewvc/directory/studio/trunk/pom.xml?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/pom.xml (original) +++ directory/studio/trunk/pom.xml Sun Jul 13 09:53:55 2008 @@ -2073,12 +2073,12 @@ net.sf.swtbot.eclipse finder - 1.0.0.574 + 1.2.0.840 net.sf.swtbot finder - 1.0.0.574 + 1.2.0.840 Added: directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.2.0.840/finder-1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.2.0.840/finder-1.2.0.840.jar?rev=676357&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/studio/trunk/repository/net/sf/swtbot/eclipse/finder/1.2.0.840/finder-1.2.0.840.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/studio/trunk/repository/net/sf/swtbot/finder/1.2.0.840/finder-1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/repository/net/sf/swtbot/finder/1.2.0.840/finder-1.2.0.840.jar?rev=676357&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/studio/trunk/repository/net/sf/swtbot/finder/1.2.0.840/finder-1.2.0.840.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.finder_1.2.0.840.jar?rev=676357&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.840.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.spy_1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.spy_1.2.0.840.jar?rev=676357&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.spy_1.2.0.840.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.ui_1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.ui_1.2.0.840.jar?rev=676357&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.eclipse.ui_1.2.0.840.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.840.jar URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.840.jar?rev=676357&view=auto ============================================================================== Binary file - no diff available. Propchange: directory/studio/trunk/test-integration-ui/resources/test-plugins/net.sf.swtbot.finder_1.2.0.840.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=676357&r1=676356&r2=676357&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 Sun Jul 13 09:53:55 2008 @@ -47,6 +47,7 @@ addTest( new TestSuite( NewConnectionWizardTest.class ) ); addTest( new TestSuite( NewEntryWizardTest.class ) ); addTest( new TestSuite( RenameEntryDialogTest.class ) ); + addTest( new TestSuite( ReferralDialogTest.class ) ); addTest( new TestSuite( SwtResourcesTest.class ) ); } 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=676357&r1=676356&r2=676357&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 Sun Jul 13 09:53:55 2008 @@ -34,6 +34,7 @@ import org.apache.directory.studio.connection.core.ConnectionCorePlugin; import org.apache.directory.studio.connection.core.ConnectionManager; import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod; +import org.eclipse.jface.dialogs.ErrorDialog; /** @@ -91,9 +92,9 @@ // enter connection parameter SWTBotText connText = bot.textWithLabel( "Connection name:" ); connText.setText( "NewConnectionWizardTest" ); - SWTBotCombo hostnameCombo = bot.comboBox( "" ); + SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" ); hostnameCombo.setText( "localhost" ); - SWTBotCombo portCombo = bot.comboBox( "" ); + SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" ); portCombo.setText( Integer.toString( ldapServer.getIpPort() ) ); // ensure "Next >" button is enabled, "Finish" button is disabled @@ -110,11 +111,11 @@ assertFalse( finishButton.isEnabled() ); // ensure "Simple Authentication" is the default - SWTBotCombo authMethodCombo = bot.comboBox( "Simple Authentication" ); + SWTBotCombo authMethodCombo = bot.comboBoxWithLabel( "Authentication Method" ); assertEquals( "Simple Authentication", authMethodCombo.selection() ); // enter authentication parameters - SWTBotCombo dnCombo = bot.comboBox( "" ); + SWTBotCombo dnCombo = bot.comboBoxWithLabel( "Bind DN or user:" ); dnCombo.setText( "uid=admin,ou=system" ); SWTBotText passwordText = bot.textWithLabel( "Bind password:" ); passwordText.setText( "secret" ); @@ -126,7 +127,7 @@ // finish dialog finishButton.click(); - Thread.sleep( 2000 ); + bot.sleep( 2000 ); // ensure connection was created ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager(); @@ -168,15 +169,15 @@ // enter connection parameter SWTBotText connText = bot.textWithLabel( "Connection name:" ); connText.setText( "NewConnectionWizardTest" ); - SWTBotCombo hostnameCombo = bot.comboBox( "" ); + SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" ); hostnameCombo.setText( "localhost" ); - SWTBotCombo portCombo = bot.comboBox( "" ); + SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" ); portCombo.setText( Integer.toString( ldapServer.getIpPort() ) ); // click "Check Network Parameter" button SWTBotButton checkButton = bot.button( "Check Network Parameter" ); checkButton.click(); - + bot.sleep( 1000 ); bot.waitUntil( new DefaultCondition() { public boolean test() throws Exception @@ -196,36 +197,38 @@ } -// /** -// * Tests the "Check Network Parameter" button. -// * -// * @throws Exception the exception -// */ -// public void testCheckNetworkParameterButtonNOK() throws Exception -// { -// // Select "Connections" view, ensure no connections exists yet -// SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot ); -// assertEquals( 0, connectionsTree.rowCount() ); -// -// // open "New Connection" wizard -// SWTBotMenu newConnectionMenu = connectionsTree.contextMenu( "New Connection..." ); -// newConnectionMenu.click(); -// -// // enter connection parameter -// SWTBotText connText = bot.textWithLabel( "Connection name:" ); -// connText.setText( "NewConnectionWizardTest" ); -// SWTBotCombo hostnameCombo = bot.comboBox( "" ); -// hostnameCombo.setText( "localhost" ); -// SWTBotCombo portCombo = bot.comboBox( "" ); -// portCombo.setText( Integer.toString( ldapServer.getIpPort() + 1 ) ); -// -// // click "Check Network Parameter" button -// SWTBotButton checkButton = bot.button( "Check Network Parameter" ); -// checkButton.click(); -// -// //TODO: error dialog does not pop up when using SWTBot??? -// Thread.sleep( 2000 ); -// + /** + * Tests the "Check Network Parameter" button. + * + * @throws Exception the exception + */ + public void testCheckNetworkParameterButtonNOK() throws Exception + { + // we expect the error dialog here, so set flag to false + boolean errorDialogAutomatedMode = ErrorDialog.AUTOMATED_MODE; + ErrorDialog.AUTOMATED_MODE = false; + + // Select "Connections" view, ensure no connections exists yet + SWTBotTree connectionsTree = SWTBotUtils.getConnectionsTree( bot ); + assertEquals( 0, connectionsTree.rowCount() ); + + // open "New Connection" wizard + SWTBotMenu newConnectionMenu = connectionsTree.contextMenu( "New Connection..." ); + newConnectionMenu.click(); + + // enter connection parameter + SWTBotText connText = bot.textWithLabel( "Connection name:" ); + connText.setText( "NewConnectionWizardTest" ); + SWTBotCombo hostnameCombo = bot.comboBoxWithLabel( "Hostname:" ); + hostnameCombo.setText( "localhost" ); + SWTBotCombo portCombo = bot.comboBoxWithLabel( "Port:" ); + portCombo.setText( Integer.toString( ldapServer.getIpPort() + 1 ) ); + + // click "Check Network Parameter" button + SWTBotButton checkButton = bot.button( "Check Network Parameter" ); + checkButton.click(); + bot.sleep( 2000 ); +//SWTBotTestCase.assertEnabled( widget ); // bot.waitUntil( new DefaultCondition() // { // public boolean test() throws Exception @@ -239,5 +242,11 @@ // return "Expected an dialog box 'Error' with an 'OK' button."; // } // } ); -// } + + bot.button( "OK" ).click(); + bot.button( "Cancel" ).click(); + + // reset flag + ErrorDialog.AUTOMATED_MODE = errorDialogAutomatedMode; + } } 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=676357&r1=676356&r2=676357&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 Sun Jul 13 09:53:55 2008 @@ -27,9 +27,9 @@ import net.sf.swtbot.widgets.SWTBotMenu; import net.sf.swtbot.widgets.SWTBotText; import net.sf.swtbot.widgets.SWTBotTree; +import net.sf.swtbot.widgets.SWTBotTreeItem; import org.apache.directory.server.unit.AbstractServerTest; -import org.eclipse.ui.PlatformUI; /** @@ -84,7 +84,7 @@ bot.button( "Next >" ).click(); // specify DN - SWTBotCombo typeCombo = bot.comboBox( "" ); + SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" ); typeCombo.setText( "o" ); SWTBotText valueText = bot.text( "" ); valueText.setText( "testCreateOrganizationEntry" ); @@ -113,7 +113,7 @@ { public boolean test() throws Exception { - return browserTree.selection().get( 0 ).get( 0 ).equals( "o=testCreateOrganizationEntry" ); + return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=testCreateOrganizationEntry" ); } @@ -149,7 +149,7 @@ bot.button( "Next >" ).click(); // specify DN - SWTBotCombo typeCombo = bot.comboBox( "" ); + SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" ); typeCombo.setText( "cn" ); SWTBotText valueText = bot.text( "" ); valueText.setText( "testCreatePersonEntry" ); @@ -170,30 +170,15 @@ } } ); - // enter values + // enter sn value 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(); - bot.button( "Next >" ).click(); - bot.waitUntil( new DefaultCondition() - { - public boolean test() throws Exception - { - return bot.button( "Finish" ).isEnabled(); - } - - - public String getFailureMessage() - { - return "Could not find widget"; - } - } ); + // click to finish editing of sn + SWTBotTreeItem cnNode = SWTBotUtils.selectNode( bot, tree, "sn" ); + cnNode.click(); + // click finish to create the entry bot.button( "Finish" ).click(); // wait till entry is created and selected in the tree @@ -201,7 +186,7 @@ { public boolean test() throws Exception { - return browserTree.selection().get( 0 ).get( 0 ).equals( "cn=testCreatePersonEntry" ); + return browserTree.selection().get( 0 ).get( 0 ).startsWith( "cn=testCreatePersonEntry" ); } @@ -214,9 +199,10 @@ /** + * Test for DIRSTUDIO-350. + * * Create entries with upper case attribute types and ensures that * the retrieved entries still are in upper case. - * Test for DIRSTUDIO-350. * * @throws Exception the exception */ @@ -239,7 +225,7 @@ bot.button( "Next >" ).click(); // specify DN - SWTBotCombo typeCombo = bot.comboBox( "" ); + SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" ); typeCombo.setText( "O" ); SWTBotText valueText = bot.text( "" ); valueText.setText( "testCreateOrganizationEntry" ); @@ -268,7 +254,7 @@ { public boolean test() throws Exception { - return browserTree.selection().get( 0 ).get( 0 ).equals( "O=testCreateOrganizationEntry" ); + return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry" ); } @@ -295,7 +281,7 @@ bot.button( "Next >" ).click(); // specify DN - typeCombo = bot.comboBox( "" ); + typeCombo = bot.comboBoxWithLabel( "RDN:" ); typeCombo.setText( "O" ); valueText = bot.text( "" ); valueText.setText( "testCreateOrganizationEntry2" ); @@ -329,7 +315,7 @@ { public boolean test() throws Exception { - return browserTree.selection().get( 0 ).get( 0 ).equals( "O=testCreateOrganizationEntry2" ); + return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry2" ); } @@ -338,9 +324,6 @@ return "Could not find widget"; } } ); - - - Thread.sleep( 10000 ); } } Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java?rev=676357&view=auto ============================================================================== --- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java (added) +++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java Sun Jul 13 09:53:55 2008 @@ -0,0 +1,234 @@ +/* + * 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 javax.naming.NamingException; +import javax.naming.directory.Attribute; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttribute; +import javax.naming.directory.BasicAttributes; + +import net.sf.swtbot.eclipse.finder.SWTEclipseBot; +import net.sf.swtbot.finder.UIThreadRunnable; +import net.sf.swtbot.widgets.SWTBotTree; +import net.sf.swtbot.widgets.SWTBotTreeItem; + +import org.apache.directory.server.unit.AbstractServerTest; +import org.apache.directory.studio.connection.core.Connection; +import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod; +import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection; + + +/** + * Tests the referral dialog. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class ReferralDialogTest extends AbstractServerTest +{ + private SWTEclipseBot bot; + private Connection connection; + + + protected void setUp() throws Exception + { + super.setUp(); + bot = new SWTEclipseBot(); + SWTBotUtils.openLdapPerspective( bot ); + connection = SWTBotUtils.createTestConnection( bot, "ReferralDialogTest", ldapServer.getIpPort() ); + } + + + protected void tearDown() throws Exception + { + SWTBotUtils.deleteTestConnections(); + bot = null; + super.tearDown(); + } + + + /** + * Test for DIRSTUDIO-343. + * + * Follows a continuation reference. + * + * @throws Exception the exception + */ + public void testBrowseAndFollowContinuationReference() throws Exception + { + // ensure that referrals handling method is FOLLOW + int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD ); + assertEquals( ReferralHandlingMethod.FOLLOW.ordinal(), referralsHandlingMethodOrdinal ); + + // create the referral entry + createReferralEntry(); + + final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot ); + + // expand ou=system, that reads the referral and opens the referral dialog + final SWTBotTreeItem systemNode = SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + UIThreadRunnable.asyncExec( bot.getDisplay(), new UIThreadRunnable.VoidResult() + { + public void run() + { + systemNode.expand(); + } + } ); + bot.sleep( 1000 ); + + // click OK in the referral dialog + bot.button( "OK" ).click(); + systemNode.expand(); + bot.sleep( 1000 ); + + // ensure that the referral URL and target is visible + SWTBotTreeItem referralNode = systemNode.getNode( "ldap://localhost:" + ldapServer.getIpPort() + + "/ou=users,ou=system" ); + assertNotNull( referralNode ); + SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system", "ldap://localhost:" + + ldapServer.getIpPort() + "/ou=users,ou=system" ); + + } + + + /** + * Test for DIRSTUDIO-343. + * + * Does not follow a continuation reference by clicking + * the cancel button in the referral dialog. + * + * @throws Exception the exception + */ + public void testBrowseAndCancelFollowingContinuationReference() throws Exception + { + // ensure that referrals handling method is FOLLOW + int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD ); + assertEquals( ReferralHandlingMethod.FOLLOW.ordinal(), referralsHandlingMethodOrdinal ); + + // create the referral entry + createReferralEntry(); + + final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot ); + + // expand ou=system, that reads the referral and opens the referral dialog + final SWTBotTreeItem systemNode = SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + UIThreadRunnable.asyncExec( bot.getDisplay(), new UIThreadRunnable.VoidResult() + { + public void run() + { + systemNode.expand(); + } + } ); + bot.sleep( 1000 ); + + // click Cancel in the referral dialog + bot.button( "Cancel" ).click(); + systemNode.expand(); + bot.sleep( 1000 ); + + // ensure that the referral URL and target is not visible + SWTBotTreeItem referralNode = systemNode.getNode( "ldap://localhost:" + ldapServer.getIpPort() + + "/ou=users,ou=system" ); + assertNull( referralNode ); + } + + + /** + * Tests ignore referral by setting the connection property to IGNORE. + * + * @throws Exception the exception + */ + public void testBrowseAndIgnoreReferral() throws Exception + { + // ensure that referrals handling method is IGNORE + connection.getConnectionParameter().setExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.IGNORE.ordinal() ); + int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD ); + assertEquals( ReferralHandlingMethod.IGNORE.ordinal(), referralsHandlingMethodOrdinal ); + + // create the referral entry + createReferralEntry(); + + final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot ); + + // expand ou=system, that reads the referral and opens the referral dialog + final SWTBotTreeItem systemNode = SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + systemNode.expand(); + systemNode.expand(); + bot.sleep( 1000 ); + + // ensure that the referral entry is not visible + SWTBotTreeItem referralNode = systemNode.getNode( "ldap://localhost:" + ldapServer.getIpPort() + + "/ou=users,ou=system" ); + assertNull( referralNode ); + } + + + /** + * Tests manage referral entry by setting the connection property to MANAGE. + * + * @throws Exception the exception + */ + public void testBrowseAndManageReferralEntry() throws Exception + { + // ensure that referrals handling method is MANAGE + connection.getConnectionParameter().setExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.MANAGE.ordinal() ); + int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty( + IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD ); + assertEquals( ReferralHandlingMethod.MANAGE.ordinal(), referralsHandlingMethodOrdinal ); + + // create the referral entry + createReferralEntry(); + + final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot ); + + // expand ou=system, that reads the referral and opens the referral dialog + final SWTBotTreeItem systemNode = SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + systemNode.expand(); + systemNode.expand(); + bot.sleep( 1000 ); + + // ensure that the referral entry is visible + SWTBotTreeItem referralNode = systemNode.getNode( "cn=referralDialogTest" ); + assertNotNull( referralNode ); + SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system", "cn=referralDialogTest" ); + } + + + private void createReferralEntry() throws NamingException + { + Attributes attrs = new BasicAttributes(); + Attribute ocAttr = new BasicAttribute( "objectClass" ); + ocAttr.add( "top" ); + ocAttr.add( "referral" ); + ocAttr.add( "extensibleObject" ); + attrs.put( ocAttr ); + attrs.put( "cn", "referralDialogTest" ); + attrs.put( "ref", "ldap://localhost:" + ldapServer.getIpPort() + "/ou=users,ou=system" ); + rootDSE.createSubcontext( "cn=referralDialogTest,ou=system", attrs ); + } +} 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=676357&r1=676356&r2=676357&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 Sun Jul 13 09:53:55 2008 @@ -142,7 +142,7 @@ * * @throws Exception the exception */ - public static void createTestConnection( SWTEclipseBot bot, String name, int port ) throws Exception + public static Connection createTestConnection( SWTEclipseBot bot, String name, int port ) throws Exception { SWTBotTree connectionsTree = getConnectionsTree( bot ); @@ -167,6 +167,7 @@ //new OpenConnectionsJob( connection ).execute(); Thread.sleep( 1000 ); + return connection; } @@ -209,10 +210,10 @@ SWTBotTreeItem child = browserTree.getTreeItem( currentPath ); child.select(); - child.expand(); if ( !pathList.isEmpty() ) { + child.expand(); return selectNode( bot, child, pathList ); } else @@ -252,12 +253,13 @@ } } ); - SWTBotTreeItem child = item.expandNode( currentPath[0] ); + SWTBotTreeItem child = item.getNode( currentPath[0] ); child.select(); - child.expand(); if ( !pathList.isEmpty() ) { + child.expand(); + child.expand(); return selectNode( bot, child, pathList ); } else Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java (original) +++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java Sun Jul 13 09:53:55 2008 @@ -29,10 +29,9 @@ import net.sf.swtbot.widgets.SWTBotMenu; import net.sf.swtbot.widgets.SWTBotText; import net.sf.swtbot.widgets.SWTBotTree; +import net.sf.swtbot.widgets.SWTBotTreeItem; import org.apache.directory.server.unit.AbstractServerTest; -import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator; -import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants; import org.eclipse.swt.graphics.DeviceData; @@ -77,9 +76,6 @@ { SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot ); - BrowserCommonActivator.getDefault().getPreferenceStore().setValue( - BrowserCommonConstants.PREFERENCE_BROWSER_ENABLE_FOLDING, false ); - // run the new entry wizard once to ensure all SWT resources are created createAndDeleteEntry( browserTree, "testSwtResourcesDelta" + 0 ); @@ -90,11 +86,6 @@ for ( int i = 1; i < 25; i++ ) { createAndDeleteEntry( browserTree, "testSwtResourcesDelta" + i ); - - // update the status of SWT objects in the Sleak view - bot.view( "Sleak" ).show(); - bot.button( "Snap" ).click(); - browserTree = SWTBotUtils.getLdapBrowserTree( bot ); } // get the SWT objects after the run @@ -140,8 +131,11 @@ private void createAndDeleteEntry( final SWTBotTree browserTree, final String name ) throws Exception { - SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + SWTBotTreeItem systemNode = SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" ); + systemNode.expand(); + systemNode.expand(); + // bot.sleep( 1000 ); SWTBotMenu contextMenu = browserTree.contextMenu( "New Entry..." ); contextMenu.click(); @@ -152,7 +146,7 @@ bot.button( "Add" ).click(); bot.button( "Next >" ).click(); - SWTBotCombo typeCombo = bot.comboBox( "" ); + SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" ); typeCombo.setText( "o" ); SWTBotText valueText = bot.text( "" ); valueText.setText( name ); @@ -163,13 +157,13 @@ { public boolean test() throws Exception { - return bot.tree( 0 ) != null; + return bot.button( "Finish" ).isEnabled(); } public String getFailureMessage() { - return "Could not find widget"; + return "Finish button is not enabled"; } } ); bot.button( "Finish" ).click(); @@ -179,17 +173,18 @@ { public boolean test() throws Exception { - return browserTree.selection().get( 0 ).get( 0 ).equals( "o=" + name ); + return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=" + name ); } public String getFailureMessage() { - return "Could not find widget"; + return "Could not select 'o=" + name + "'"; } } ); // delete the entry + SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system", "o=" + name ); contextMenu = browserTree.contextMenu( "Delete Entry" ); contextMenu.click(); bot.button( "OK" ).click(); @@ -205,7 +200,7 @@ public String getFailureMessage() { - return "Could not find widget"; + return "Could not select 'ou=system'"; } } ); } Modified: directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java?rev=676357&r1=676356&r2=676357&view=diff ============================================================================== --- directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java (original) +++ directory/studio/trunk/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/image/ImageDialog.java Sun Jul 13 09:53:55 2008 @@ -29,7 +29,7 @@ import java.io.FileOutputStream; import java.io.IOException; -import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator; +import org.apache.directory.studio.connection.ui.ConnectionUIPlugin; import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils; import org.apache.directory.studio.valueeditors.ValueEditorsActivator; import org.apache.directory.studio.valueeditors.ValueEditorsConstants; @@ -316,14 +316,14 @@ catch ( FileNotFoundException e ) { - BrowserCommonActivator.getDefault() + ConnectionUIPlugin.getDefault() .getExceptionHandler().handleException( new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) ); } catch ( IOException e ) { - BrowserCommonActivator.getDefault() + ConnectionUIPlugin.getDefault() .getExceptionHandler().handleException( new Status( IStatus.ERROR, ValueEditorsActivator.PLUGIN_ID, IStatus.ERROR, "Can't write to file", e ) );