You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/08/26 19:15:36 UTC
svn commit: r437183 - in /directory/branches/apacheds/1.0:
core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java
core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Author: akarasulu
Date: Sat Aug 26 10:15:35 2006
New Revision: 437183
URL: http://svn.apache.org/viewvc?rev=437183&view=rev
Log:
Fix for DIRSERVER-717: RFC2713 integration test fails
Modified:
directory/branches/apacheds/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java
directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Modified: directory/branches/apacheds/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java?rev=437183&r1=437182&r2=437183&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java (original)
+++ directory/branches/apacheds/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/RFC2713ITest.java Sat Aug 26 10:15:35 2006
@@ -39,7 +39,6 @@
{
public void testSerialization() throws Exception
{
- /*
ArrayList colors = new ArrayList();
colors.add( "red" );
colors.add( "white" );
@@ -71,6 +70,5 @@
attr = attrs.get( "javaSerializedData" );
assertNotNull( attr );
assertEquals( 1, attr.size() );
- */
}
}
Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=437183&r1=437182&r2=437183&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Sat Aug 26 10:15:35 2006
@@ -291,20 +291,7 @@
{
Attributes attributes = new LockableAttributesImpl();
LdapDN target = buildTarget( name );
-
- Rdn rdn = target.getRdn( target.size() - 1 );
- if ( rdn.size() == 1 )
- {
- attributes.put( rdn.getType(), rdn.getValue() );
- }
- else
- {
- for ( Iterator ii = rdn.iterator(); ii.hasNext(); /**/ )
- {
- AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
- attributes.put( atav.getType(), atav.getValue() );
- }
- }
+ injectRdnAttributeValues( target, attributes );
attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR, JavaLdapSupport.JCONTAINER_ATTR );
attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR, JavaLdapSupport.TOP_ATTR );
@@ -353,7 +340,26 @@
bind( new LdapDN( name ), obj );
}
+
+ private void injectRdnAttributeValues( LdapDN target, Attributes attributes ) throws NamingException
+ {
+ // Add all the RDN attributes and their values to this entry
+ Rdn rdn = target.getRdn( target.size() - 1 );
+ if ( rdn.size() == 1 )
+ {
+ attributes.put( rdn.getType(), rdn.getValue() );
+ }
+ else
+ {
+ for ( Iterator ii = rdn.iterator(); ii.hasNext(); /**/ )
+ {
+ AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
+ attributes.put( atav.getType(), atav.getValue() );
+ }
+ }
+ }
+
/**
* @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
*/
@@ -395,7 +401,9 @@
}
}
+ // Get target and inject all rdn attributes into entry
LdapDN target = buildTarget( name );
+ injectRdnAttributeValues( target, attributes );
// Serialize object into entry attributes and add it.
JavaLdapSupport.serialize( attributes, obj );
@@ -415,6 +423,7 @@
}
LdapDN target = buildTarget( name );
+ injectRdnAttributeValues( target, attributes );
nexusProxy.add( target, attributes );
}
else