You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/10/17 10:40:42 UTC
svn commit: r826197 -
/directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java
Author: elecharny
Date: Sat Oct 17 08:40:42 2009
New Revision: 826197
URL: http://svn.apache.org/viewvc?rev=826197&view=rev
Log:
Merged the two test classes here
Modified:
directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java
Modified: directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java?rev=826197&r1=826196&r2=826197&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java (original)
+++ directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/registries/AttributeTypeRegistryTest.java Sat Oct 17 08:40:42 2009
@@ -19,6 +19,11 @@
*/
package org.apache.directory.shared.ldap.registries;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import javax.naming.NamingException;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -26,10 +31,6 @@
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
/**
@@ -97,4 +98,38 @@
assertTrue( true );
}
}
+
+
+ @Test
+ public void testClone() throws Exception
+ {
+ AttributeType at0 = new AttributeType( "1.1" );
+ at0.addName( "t", "test", "Test", "T" );
+
+ atRegistry.register( at0 );
+
+ AttributeType at1 = new AttributeType( "1.2" );
+ at1.addName( "u", "unit", "Unit", "U" );
+
+ atRegistry.register( at1 );
+
+ // Clone the ATRegistry
+ AttributeTypeRegistry clone = atRegistry.clone();
+
+ assertEquals( at0, clone.lookup( "1.1" ) );
+ assertEquals( at1, clone.lookup( "1.2" ) );
+
+ atRegistry.unregister( "1.1" );
+ assertFalse( atRegistry.contains( "1.1" ) );
+ assertTrue( clone.contains( "1.1" ) );
+
+ AttributeType at = atRegistry.lookup( "1.2" );
+ at.setOid( "2.2" );
+
+ at = atRegistry.lookup( "1.2" );
+ assertEquals( "2.2", at.getOid() );
+
+ at = clone.lookup( "1.2" );
+ assertEquals( "1.2", at.getOid() );
+ }
}