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 2006/08/20 22:25:12 UTC
svn commit: r433029 [1/3] - in
/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name:
AttributeTypeAndValueTest.java DnParserDIRSERVER_584_Test.java
LdapDNTest.java LdapDnParserTest.java RdnTest.java
Author: elecharny
Date: Sun Aug 20 13:25:11 2006
New Revision: 433029
URL: http://svn.apache.org/viewvc?rev=433029&view=rev
Log:
Reformating, adding some tests for DIRSERVER-631
Modified:
directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDnParserTest.java
directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java?rev=433029&r1=433028&r2=433029&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValueTest.java Sun Aug 20 13:25:11 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 The Apache Software Foundation
+ * Copyright 2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,137 +27,146 @@
/**
* Test the class AttributeTypeAndValue
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class AttributeTypeAndValueTest extends TestCase
{
- // ~ Methods
- // ------------------------------------------------------------------------------------
+ // ~ Methods
+ // ------------------------------------------------------------------------------------
+
+ /**
+ * Setup the test
+ */
+ protected void setUp()
+ {
+ }
+
+
+ /**
+ * Test a null AttributeTypeAndValue
+ */
+ public void testAttributeTypeAndValueNull() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav = new AttributeTypeAndValue();
+ assertEquals( "", atav.toString() );
+ assertEquals( "", atav.getUpName());
+ assertEquals( -1, atav.getStart());
+ assertEquals( 0, atav.getLength());
+ }
+
+
+ /**
+ * test an empty AttributeTypeAndValue
+ */
+ public void testLdapRDNEmpty() throws InvalidNameException
+ {
+ try
+ {
+ new AttributeTypeAndValue( "", "" );
+ Assert.fail( "Should not occurs ... " );
+ }
+ catch ( InvalidNameException ine )
+ {
+ assertTrue( true );
+ }
+ }
+
+
+ /**
+ * test a simple AttributeTypeAndValue : a = b
+ */
+ public void testLdapRDNSimple() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav = new AttributeTypeAndValue( "a", "b" );
+ assertEquals( "a=b", atav.toString() );
+ assertEquals( "a=b", atav.getUpName());
+ assertEquals( 0, atav.getStart());
+ assertEquals( 3, atav.getLength());
+ }
+
+
+ /**
+ * Compares two equals atavs
+ */
+ public void testCompareToEquals() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+ assertEquals( 0, atav1.compareTo( atav2 ) );
+ }
+
+
+ /**
+ * Compares two equals atavs but with a type in different case
+ */
+ public void testCompareToEqualsCase() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "b" );
+
+ assertEquals( 0, atav1.compareTo( atav2 ) );
+ }
+
+
+ /**
+ * Compare two atavs : the first one is superior because its type is
+ * superior
+ */
+ public void testCompareAtav1TypeSuperior() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+ assertEquals( 1, atav1.compareTo( atav2 ) );
+ }
+
+
+ /**
+ * Compare two atavs : the second one is superior because its type is
+ * superior
+ */
+ public void testCompareAtav2TypeSuperior() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b" );
+
+ assertEquals( -1, atav1.compareTo( atav2 ) );
+ }
+
+
+ /**
+ * Compare two atavs : the first one is superior because its type is
+ * superior
+ */
+ public void testCompareAtav1ValueSuperior() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a" );
+
+ assertEquals( 1, atav1.compareTo( atav2 ) );
+ }
+
+
+ /**
+ * Compare two atavs : the second one is superior because its type is
+ * superior
+ */
+ public void testCompareAtav2ValueSuperior() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a" );
+ AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
+
+ assertEquals( -1, atav1.compareTo( atav2 ) );
+ }
+
+
+ public void testNormalize() throws InvalidNameException
+ {
+ AttributeTypeAndValue atav = new AttributeTypeAndValue( " A ", "a" );
- /**
- * Setup the test
- */
- protected void setUp()
- {
- }
-
-
- /**
- * Test a null AttributeTypeAndValue
- */
- public void testAttributeTypeAndValueNull() throws InvalidNameException
- {
- Assert.assertEquals( "", new AttributeTypeAndValue().toString() );
- }
-
-
- /**
- * test an empty AttributeTypeAndValue
- */
- public void testLdapRDNEmpty() throws InvalidNameException
- {
- try
- {
- new AttributeTypeAndValue( "", "" );
- Assert.fail( "Should not occurs ... " );
- }
- catch ( InvalidNameException ine )
- {
- Assert.assertTrue( true );
- }
- }
-
-
- /**
- * test a simple AttributeTypeAndValue : a = b
- */
- public void testLdapRDNSimple() throws InvalidNameException
- {
- Assert.assertEquals( "a=b", new AttributeTypeAndValue( "a", "b" ).toString() );
- }
-
-
- /**
- * Compares two equals atavs
- */
- public void testCompareToEquals() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
- Assert.assertEquals( 0, atav1.compareTo( atav2 ) );
- }
-
-
- /**
- * Compares two equals atavs but with a type in different case
- */
- public void testCompareToEqualsCase() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "A", "b" );
-
- Assert.assertEquals( 0, atav1.compareTo( atav2 ) );
- }
-
-
- /**
- * Compare two atavs : the first one is superior because its type is
- * superior
- */
- public void testCompareAtav1TypeSuperior() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "b", "b" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
- Assert.assertEquals( 1, atav1.compareTo( atav2 ) );
- }
-
-
- /**
- * Compare two atavs : the second one is superior because its type is
- * superior
- */
- public void testCompareAtav2TypeSuperior() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "b", "b" );
-
- Assert.assertEquals( -1, atav1.compareTo( atav2 ) );
- }
-
-
- /**
- * Compare two atavs : the first one is superior because its type is
- * superior
- */
- public void testCompareAtav1ValueSuperior() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "b" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "a" );
-
- Assert.assertEquals( 1, atav1.compareTo( atav2 ) );
- }
-
-
- /**
- * Compare two atavs : the second one is superior because its type is
- * superior
- */
- public void testCompareAtav2ValueSuperior() throws InvalidNameException
- {
- AttributeTypeAndValue atav1 = new AttributeTypeAndValue( "a", "a" );
- AttributeTypeAndValue atav2 = new AttributeTypeAndValue( "a", "b" );
-
- Assert.assertEquals( -1, atav1.compareTo( atav2 ) );
- }
-
-
- public void testNormalize() throws InvalidNameException
- {
- AttributeTypeAndValue atav = new AttributeTypeAndValue( " A ", "a" );
+ assertEquals( "a=a", atav.normalize() );
- Assert.assertEquals( "a=a", atav.normalize() );
- }
+ }
}
Modified: directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java?rev=433029&r1=433028&r2=433029&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/test/java/org/apache/directory/shared/ldap/name/DnParserDIRSERVER_584_Test.java Sun Aug 20 13:25:11 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 The Apache Software Foundation
+ * Copyright 2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,35 +26,35 @@
/**
* Testcase devised specifically for DIRSERVER-584.
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
* @see <a href="https://issues.apache.org/jira/browse/DIRSERVER-584">DIRSERVER-584</a>
*/
public class DnParserDIRSERVER_584_Test extends TestCase
{
- /**
- * Need this testa() to run first to mess up the state of the static parser.
- */
- public void testa() throws Exception
- {
- try
- {
- LdapDnParser.parseInternal( "ou=test=testing", new ArrayList() );
- fail( "should never get here" );
- }
- catch ( InvalidNameException e )
- {
- }
- }
-
-
- /**
- * Need this testb() to run second to use the mess up static parser. This
- * test should succeed but fails.
- */
- public void testb() throws Exception
- {
- LdapDnParser.parseInternal( "ou=system", new ArrayList() );
- }
-}
+ /**
+ * Need this testa() to run first to mess up the state of the static parser.
+ */
+ public void testa() throws Exception
+ {
+ try
+ {
+ LdapDnParser.parseInternal( "ou=test=testing", new ArrayList() );
+ fail( "should never get here" );
+ }
+ catch ( InvalidNameException e )
+ {
+ }
+ }
+
+
+ /**
+ * Need this testb() to run second to use the mess up static parser. This
+ * test should succeed but fails.
+ */
+ public void testb() throws Exception
+ {
+ LdapDnParser.parseInternal( "ou=system", new ArrayList() );
+ }
+}
\ No newline at end of file