directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r675672 - in /directory/studio/trunk: connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ ldapbrowser-common/src/main/ja...
Date Thu, 10 Jul 2008 18:43:19 GMT
Author: seelmann
Date: Thu Jul 10 11:43:18 2008
New Revision: 675672

URL: http://svn.apache.org/viewvc?rev=675672&view=rev
Log:
Fix for DIRSTUDIO-350: use user provided case of attribute type

Modified:
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java?rev=675672&r1=675671&r2=675672&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
(original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
Thu Jul 10 11:43:18 2008
@@ -301,7 +301,7 @@
                     searchCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );
 
                     // perform the search
-                    NamingEnumeration<SearchResult> ne = searchCtx.search( new LdapDN(
searchBase ), filter,
+                    NamingEnumeration<SearchResult> ne = searchCtx.search( searchBase,
filter,
                         searchControls );
                     namingEnumeration = new StudioNamingEnumeration( connection, ne, searchBase,
filter,
                         searchControls, aliasesDereferencingMethod, referralsHandlingMethod,
controls, requestNum,
@@ -453,7 +453,7 @@
                     modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );
 
                     // perform modification
-                    modCtx.modifyAttributes( new LdapDN( dn ), modificationItems );
+                    modCtx.modifyAttributes( dn, modificationItems );
                 }
                 catch ( ReferralException re )
                 {
@@ -554,7 +554,7 @@
                     }
 
                     // rename entry
-                    modCtx.rename( new LdapDN( oldDn ), new LdapDN( newDn ) );
+                    modCtx.rename( oldDn, newDn );
                 }
                 catch ( ReferralException re )
                 {
@@ -644,7 +644,7 @@
                     modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );
 
                     // create entry
-                    modCtx.createSubcontext( new LdapDN( dn ), attributes );
+                    modCtx.createSubcontext( dn, attributes );
                 }
                 catch ( ReferralException re )
                 {
@@ -732,7 +732,7 @@
                     modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );
 
                     // delete entry
-                    modCtx.destroySubcontext( new LdapDN( dn ) );
+                    modCtx.destroySubcontext( dn );
                 }
                 catch ( ReferralException re )
                 {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java?rev=675672&r1=675671&r2=675672&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/DnBuilderWidget.java
Thu Jul 10 11:43:18 2008
@@ -342,7 +342,7 @@
             try
             {
                 // calculate DN
-                parentDn = new LdapDN( parentEntryWidget.getDn() );
+                parentDn = ( LdapDN ) parentEntryWidget.getDn().clone();
             }
             catch ( Exception e )
             {

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java?rev=675672&r1=675671&r2=675672&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/browser/BrowserLabelProvider.java
Thu Jul 10 11:43:18 2008
@@ -340,19 +340,20 @@
         {
             Rdn rdn = entry.getRdn();
             Iterator<AttributeTypeAndValue> atavIterator = rdn.iterator();
-            while(atavIterator.hasNext())
+            while ( atavIterator.hasNext() )
             {
                 AttributeTypeAndValue atav = atavIterator.next();
-                if ( "cn".equals( atav.getUpType() ) || "sn".equals( atav.getUpType() ) ||
"uid".equals( atav.getUpType() )
-                    || "userid".equals( atav.getUpType() ) )
+                if ( "cn".equalsIgnoreCase( atav.getUpType() ) || "sn".equalsIgnoreCase(
atav.getUpType() )
+                    || "uid".equalsIgnoreCase( atav.getUpType() ) || "userid".equalsIgnoreCase(
atav.getUpType() ) )
                 {
                     return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_ENTRY_PERSON
);
                 }
-                else if ( "ou".equals( atav.getUpType() ) || "o".equals( atav.getUpType()
) )
+                else if ( "ou".equalsIgnoreCase( atav.getUpType() ) || "o".equalsIgnoreCase(
atav.getUpType() ) )
                 {
                     return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_ENTRY_ORG
);
                 }
-                else if ( "dc".equals( atav.getUpType() ) || "c".equals( atav.getUpType()
) || "l".equals( atav.getUpType() ) )
+                else if ( "dc".equalsIgnoreCase( atav.getUpType() ) || "c".equalsIgnoreCase(
atav.getUpType() )
+                    || "l".equalsIgnoreCase( atav.getUpType() ) )
                 {
                     return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_ENTRY_DC
);
                 }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java?rev=675672&r1=675671&r2=675672&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesRunnable.java
Thu Jul 10 11:43:18 2008
@@ -302,21 +302,14 @@
             && !"".equals( browserConnection.getBaseDN().toString() ) )
         {
             // only add the specified base DN
-            try
+            LdapDN dn = browserConnection.getBaseDN();
+            IEntry entry = browserConnection.getEntryFromCache( dn );
+            if ( entry == null )
             {
-                LdapDN dn = browserConnection.getBaseDN();
-                IEntry entry = browserConnection.getEntryFromCache( dn );
-                if ( entry == null )
-                {
-                    entry = new BaseDNEntry( new LdapDN( dn ), browserConnection );
-                    browserConnection.cacheEntry( entry );
-                }
-                rootDseEntries.put( dn, entry );
-            }
-            catch ( InvalidNameException e )
-            {
-                monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e
);
+                entry = new BaseDNEntry( ( LdapDN ) dn.clone(), browserConnection );
+                browserConnection.cacheEntry( entry );
             }
+            rootDseEntries.put( dn, entry );
         }
         else
         {
@@ -341,7 +334,7 @@
                         IEntry entry = browserConnection.getEntryFromCache( dn );
                         if ( entry == null )
                         {
-                            entry = new BaseDNEntry( new LdapDN( dn ), browserConnection
);
+                            entry = new BaseDNEntry( dn, browserConnection );
                             browserConnection.cacheEntry( entry );
                         }
                         rootDseEntries.put( dn, entry );

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=675672&r1=675671&r2=675672&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
Thu Jul 10 11:43:18 2008
@@ -29,6 +29,7 @@
 import net.sf.swtbot.widgets.SWTBotTree;
 
 import org.apache.directory.server.unit.AbstractServerTest;
+import org.eclipse.ui.PlatformUI;
 
 
 /**
@@ -211,4 +212,135 @@
         } );
     }
 
+    
+    /**
+     * 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
+     */
+    public void testCreateUpperCaseOrganizationEntries() throws Exception
+    {
+        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectNode( bot, browserTree, "DIT", "Root DSE", "ou=system" );
+
+        // open "New Entry" wizard
+        SWTBotMenu contextMenu = browserTree.contextMenu( "New Entry..." );
+        contextMenu.click();
+
+        // select entry creation method
+        bot.radio( "Create entry from scratch" ).click();
+        bot.button( "Next >" ).click();
+
+        // select object classes
+        bot.table( 0 ).select( "organization" );
+        bot.button( "Add" ).click();
+        bot.button( "Next >" ).click();
+
+        // specify DN
+        SWTBotCombo typeCombo = bot.comboBox( "" );
+        typeCombo.setText( "O" );
+        SWTBotText valueText = bot.text( "" );
+        valueText.setText( "testCreateOrganizationEntry" );
+        bot.button( "Next >" ).click();
+
+        // wait for check that entry doesn't exist yet
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.tree( 0 ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+
+        // click finish to create the entry
+        bot.button( "Finish" ).click();
+
+        // wait till entry is created and selected in the tree
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return browserTree.selection().get( 0 ).get( 0 ).equals( "O=testCreateOrganizationEntry"
);
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+        
+        // Now create a second entry under the previously created entry 
+        // to ensure that the selected parent is also upper case.
+        
+        // open "New Entry" wizard
+        contextMenu = browserTree.contextMenu( "New Entry..." );
+        contextMenu.click();
+
+        // select entry creation method
+        bot.radio( "Create entry from scratch" ).click();
+        bot.button( "Next >" ).click();
+
+        // select object classes
+        bot.table( 0 ).select( "organization" );
+        bot.button( "Add" ).click();
+        bot.button( "Next >" ).click();
+        
+        // specify DN
+        typeCombo = bot.comboBox( "" );
+        typeCombo.setText( "O" );
+        valueText = bot.text( "" );
+        valueText.setText( "testCreateOrganizationEntry2" );
+        
+        // check preview text 
+        SWTBotText previewText = bot.text( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system"
);
+        assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system",
previewText.getText() );
+        
+        bot.button( "Next >" ).click();
+
+        // wait for check that entry doesn't exist yet
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return bot.tree( 0 ) != null;
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+
+        // click finish to create the entry
+        bot.button( "Finish" ).click();
+
+        // wait till entry is created and selected in the tree
+        bot.waitUntil( new DefaultCondition()
+        {
+            public boolean test() throws Exception
+            {
+                return browserTree.selection().get( 0 ).get( 0 ).equals( "O=testCreateOrganizationEntry2"
);
+            }
+
+
+            public String getFailureMessage()
+            {
+                return "Could not find widget";
+            }
+        } );
+        
+        
+        Thread.sleep( 10000 );
+    }
+
 }



Mime
View raw message