directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r767306 - in /directory/studio/trunk: ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/ ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/ ldapbrowser-common/src/m...
Date Tue, 21 Apr 2009 21:34:36 GMT
Author: seelmann
Date: Tue Apr 21 21:34:34 2009
New Revision: 767306

URL: http://svn.apache.org/viewvc?rev=767306&view=rev
Log:
Fix for DIRSTUDIO-484 (Rename dialog does not work with escaped RDNs): Usage of AttributeTypeAndValue.getNormValue()
instead of getUpValue()

Modified:
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.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/wizards/NewEntryDnWizardPage.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
    directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/DeleteAction.java
Tue Apr 21 21:34:34 2009
@@ -32,7 +32,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
 import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescription;
 import org.apache.directory.shared.ldap.schema.parsers.ObjectClassDescription;
 import org.apache.directory.studio.ldapbrowser.common.dialogs.DeleteDialog;
@@ -474,17 +473,11 @@
             AttributeHierarchy ah = value.getAttribute().getEntry().getAttributeWithSubtypes(
type );
 
             // check if (part of) RDN is selected
-            Iterator<AttributeTypeAndValue> atavIterator = value.getAttribute().getEntry().getRdn().iterator();
-            while ( atavIterator.hasNext() )
+            if ( value.isRdnPart() )
             {
-                AttributeTypeAndValue atav = atavIterator.next();
-                if ( value.getAttribute().getDescription().equals( atav.getUpType() )
-                    && value.getStringValue().equals( atav.getUpValue() ) )
-                {
-                    message.append( NLS.bind( Messages.getString( "DeleteAction.DeletePartOfRDN"
), value.toString() ) ); //$NON-NLS-1$
-                    message.append( BrowserCoreConstants.LINE_SEPARATOR );
-                    message.append( BrowserCoreConstants.LINE_SEPARATOR );
-                }
+                message.append( NLS.bind( Messages.getString( "DeleteAction.DeletePartOfRDN"
), value.toString() ) ); //$NON-NLS-1$
+                message.append( BrowserCoreConstants.LINE_SEPARATOR );
+                message.append( BrowserCoreConstants.LINE_SEPARATOR );
             }
 
             // check if a required objectClass is selected

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=767306&r1=767305&r2=767306&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
Tue Apr 21 21:34:34 2009
@@ -175,7 +175,7 @@
                     AttributeTypeAndValue atav = atavIterator.next();
                     addRdnLine( rdnComposite, i );
                     rdnLineList.get( i ).rdnTypeCombo.setText( atav.getUpType() );
-                    rdnLineList.get( i ).rdnValueText.setText( ( String ) atav.getUpValue()
);
+                    rdnLineList.get( i ).rdnValueText.setText( ( String ) atav.getNormValue()
);
                     if ( i == 0 )
                     {
                         if ( "".equals( rdnLineList.get( i ).rdnTypeCombo ) ) //$NON-NLS-1$

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
(original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
Tue Apr 21 21:34:34 2009
@@ -231,7 +231,7 @@
                         IValue[] values = attribute.getValues();
                         for ( int v = 0; v < values.length; v++ )
                         {
-                            if ( values[v].getStringValue().equals( atav.getUpValue() ) )
+                            if ( values[v].getStringValue().equals( atav.getNormValue() )
)
                             {
                                 attribute.deleteValue( values[v] );
                             }
@@ -281,7 +281,7 @@
                         rdnAttribute = new Attribute( newEntry, atav.getUpType() );
                         newEntry.addAttribute( rdnAttribute );
                     }
-                    Object rdnValue = atav.getUpValue();
+                    Object rdnValue = atav.getNormValue();
                     String[] stringValues = rdnAttribute.getStringValues();
                     if ( !Arrays.asList( stringValues ).contains( rdnValue ) )
                     {

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
Tue Apr 21 21:34:34 2009
@@ -410,7 +410,7 @@
             Attribute attribute = attributes.get( atav.getUpType() );
             if ( attribute != null )
             {
-                attribute.remove( atav.getUpValue() );
+                attribute.remove( atav.getNormValue() );
                 if ( attribute.size() == 0 )
                 {
                     attributes.remove( atav.getUpType() );
@@ -428,9 +428,9 @@
                 attribute = new BasicAttribute( atav.getUpType() );
                 attributes.put( attribute );
             }
-            if ( !attribute.contains( atav.getUpValue() ) )
+            if ( !attribute.contains( atav.getNormValue() ) )
             {
-                attribute.add( atav.getUpValue() );
+                attribute.add( atav.getNormValue() );
             }
         }
     }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java
(original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java
Tue Apr 21 21:34:34 2009
@@ -311,7 +311,7 @@
         {
             AttributeTypeAndValue atav = atavIterator.next();
             if ( getAttribute().getDescription().equals( atav.getUpType() )
-                && getStringValue().equals( atav.getUpValue() ) )
+                && getStringValue().equals( atav.getNormValue() ) )
             {
                 return true;
             }

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.java
Tue Apr 21 21:34:34 2009
@@ -41,7 +41,7 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        super.loadTestLdif( true );
+        super.loadTestLdif( false );
         bot = new SWTEclipseBot();
         SWTBotUtils.openLdapPerspective( bot );
         SWTBotUtils.createTestConnection( bot, "RenameEntryDialogTest", ldapService.getPort()
);
@@ -84,4 +84,32 @@
             "cn=Babs Jensen+uid=babsjens" );
     }
 
+
+    /**
+     * Test for DIRSTUDIO-484.
+     * 
+     * Renames a RDN with escaped characters.
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public void testRenameRdnWithEscapedCharacters() throws Exception
+    {
+        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+
+        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system",
"ou=users",
+            "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
+
+        SWTBotMenu contextMenu = browserTree.contextMenu( "Rename Entry..." );
+        contextMenu.click();
+
+        // ensure that the unescaped value is in the text field
+        bot.text( "#\\+, \"\u00F6\u00E9\"" ).setText( "#\\+, \"\u00F6\u00E9\"2" );
+        bot.button( "OK" ).click();
+
+        // ensure that the entry with the new name exists
+        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system",
"ou=users",
+            "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"2" );
+    }
+
 }

Modified: directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif?rev=767306&r1=767305&r2=767306&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
Tue Apr 21 21:34:34 2009
@@ -8,3 +8,14 @@
 givenName: Barbara
 uid: bjensen
 
+# cn=\#\\\+\, \"öé\",ou=users,ou=system
+dn:: Y249XCNcXFwrXCwgXCLDtsOpXCIsb3U9dXNlcnMsb3U9c3lzdGVt
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn:: I1wrLCAiw7bDqSI=
+sn:: I1wrLCAiw7bDqSI=
+givenName:: I1wrLCAiw7bDqSI=
+uid:: I1wrLCAiw7bDqSI=
+



Mime
View raw message