* run into infinite loops.
*/
@Test
public void testLdapDNIncomplete() throws LdapException
{
FastDnParser dnParser = FastDnParser.getNameParser();
// empty Dn is ok
dnParser.parse( " " );
// test DNs starting with an descr
try
{
dnParser.parse( " a" );
fail();
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " a " );
fail();
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " a- " );
fail();
}
catch ( LdapException ine )
{
// expected
}
dnParser.parse( " a =" );
dnParser.parse( " a = " );
dnParser.parse( " a = b" );
// test DNs starting with an OID
try
{
dnParser.parse( " 1 = b " );
fail( "OID must contain at least on dot." );
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " 0" );
fail();
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " 0." );
fail();
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " 0.5" );
fail();
}
catch ( LdapException ine )
{
// expected
}
try
{
dnParser.parse( " 0.5 " );
fail();
}
catch ( LdapException ine )
{
// expected
}
dnParser.parse( " 0.5=" );
dnParser.parse( " 0.5 = " );
dnParser.parse( " 0.5 = b" );
}