directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r612324 [2/2] - in /directory/apacheds/branches/bigbang: core-entry/src/main/java/org/apache/directory/server/core/entry/ core-entry/src/test/java/org/apache/directory/server/core/entry/ core/src/main/java/org/apache/directory/server/core/ ...
Date Wed, 16 Jan 2008 00:32:20 GMT
Modified: directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java?rev=612324&r1=612323&r2=612324&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
Tue Jan 15 16:32:18 2008
@@ -23,9 +23,11 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.naming.Name;
@@ -36,9 +38,11 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.CSNVector;
@@ -71,6 +75,7 @@
     private DerbyReplicationStore store;
     private int testCount;
     private long startTime;
+    private DefaultDirectoryService service;
 
 
     public void setUp() throws Exception
@@ -90,7 +95,7 @@
         // Open store
         store = new DerbyReplicationStore();
         store.setTablePrefix( "TEST_" );
-        DefaultDirectoryService service = new DefaultDirectoryService();
+        service = new DefaultDirectoryService();
         service.setWorkingDirectory( DB_PATH );
         store.open( service, cfg );
     }
@@ -181,22 +186,29 @@
 
     private void subTestWriteLog() throws Exception
     {
+        Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer()
) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() )
);
+        
         CSN csn = csnFactory.newInstance( REPLICA_ID );
         CompositeOperation op1 = new CompositeOperation( csn );
-        op1.add( new AddEntryOperation( csn, new LdapDN( "ou=a" ), new AttributesImpl( true
) ) );
-        op1.add( new AddAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
-        op1.add( new ReplaceAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
-        op1.add( new DeleteAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
+        LdapDN ouA =  new LdapDN( "ou=a" ).normalize( oids );
+        op1.add( new AddEntryOperation( csn, ouA, new DefaultServerEntry( service.getRegistries(),
ouA ) ) );
+        op1.add( new AddAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" )
) );
+        op1.add( new ReplaceAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie"
) ) );
+        op1.add( new DeleteAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie"
) ) );
 
         store.putLog( op1 );
         testGetLogs( csn, op1 );
 
         csn = csnFactory.newInstance( OTHER_REPLICA_ID );
         CompositeOperation op2 = new CompositeOperation( csn );
-        op2.add( new AddEntryOperation( csn, new LdapDN( "ou=a" ), new AttributesImpl( true
) ) );
-        op2.add( new AddAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
-        op2.add( new ReplaceAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
-        op2.add( new DeleteAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl(
"id", "valie" ) ) );
+        op2.add( new AddEntryOperation( csn, ouA, new DefaultServerEntry( service.getRegistries(),
ouA ) ) );
+        op2.add( new AddAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" )
) );
+        op2.add( new ReplaceAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie"
) ) );
+        op2.add( new DeleteAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie"
) ) );
 
         store.putLog( op2 );
         testGetLogs( csn, op2 );

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java?rev=612324&r1=612323&r2=612324&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
Tue Jan 15 16:32:18 2008
@@ -25,16 +25,23 @@
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.sp.JavaStoredProcUtils;
 import org.apache.directory.shared.ldap.sp.LdapContextParameter;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
+
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Map;
 import java.util.Set;
 
 
@@ -46,9 +53,10 @@
 {
     private LdapContext ctx;
     private LdapContext spCtx;
+    private Map<String, OidNormalizer> oids;
 
     
-    public void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
 
         super.setUp();
@@ -65,6 +73,13 @@
         spContainer.get( "objectClass" ).add( "organizationalUnit" );
         spContainer.put( "ou", "Stored Procedures" );
         spCtx = ( LdapContext ) ctx.createSubcontext( "ou=Stored Procedures", spContainer
);
+        
+        // Initialize OIDs maps for normalization
+        oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer()
) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() )
);
     }
 
 
@@ -112,7 +127,7 @@
     }
     
     
-    public void testSPDeleteSubtree() throws NamingException
+    @Test public void testSPDeleteSubtree() throws NamingException
     {
         String ldif =
             "version: 1\n" +
@@ -138,9 +153,13 @@
         
         JavaStoredProcUtils.loadStoredProcedureClass( spCtx, DITUtilitiesSP.class );
         
+        LdapDN people = new LdapDN( "ou=People" );
+        people = LdapDN.normalize(  people, oids );
+        
         String spName = DITUtilitiesSP.class.getName() + ":deleteSubtree";
         Object[] params = new Object[] { new LdapContextParameter( "ou=system" ),
-                                         new LdapDN( "ou=People" ) };
+                                         people };
+        
         
         JavaStoredProcUtils.callStoredProcedure( ctx, spName, params );
         



Mime
View raw message