Package org.apache.directory.shared.ldap.model.name

Examples of org.apache.directory.shared.ldap.model.name.FastDnParser


     * azerty; 7.8 = test
     */
    @Test
    public void testLdapDNCompositeOidWithoutPrefix() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        Dn dn = (Dn) dnParser.parse( "12.34.56 = azerty; 7.8 = test" );
        assertEquals( "12.34.56=azerty,7.8=test", dn.getNormName() );
        assertEquals( "12.34.56 = azerty; 7.8 = test", dn.getName() );
    }
View Full Code Here


     * test a simple Dn with pair char attribute value : a = \,\=\+\<\>\#\;\\\"\C3\A9"
     */
    @Test
    public void testLdapDNPairCharAttributeValue() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        try
        {
            dnParser.parse( "a = \\,\\=\\+\\<\\>\\#\\;\\\\\\\"\\C3\\A9" );
            fail( "Complex DNs not supported by fast parser" );
        }
        catch ( TooComplexException tce )
        {
            // expected
View Full Code Here

     * test a simple Dn with hexString attribute value : a = #0010A0AAFF
     */
    @Test
    public void testLdapDNHexStringAttributeValue() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        try
        {
            dnParser.parse( "a = #0010A0AAFF" );
            fail( "Hex DNs not supported by fast parser" );
        }
        catch ( TooComplexException tce )
        {
            // expected
View Full Code Here

    @Test
    public void testBadLdapDNHexStringAttributeValue() throws LdapException
    {
        try
        {
            FastDnParser dnParser = FastDnParser.getNameParser();
            dnParser.parse( "a=#zz" );
            fail( "Hex DNs not supported by fast parser" );
        }
        catch ( TooComplexException tce )
        {
            // expected
View Full Code Here

     * test a simple Dn with quoted attribute value : a = "quoted \"value"
     */
    @Test
    public void testLdapDNQuotedAttributeValue() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        try
        {
            dnParser.parse( "a = quoted \\\"value" );
            fail( "Quotes not supported by fast parser" );
        }
        catch ( TooComplexException tce )
        {
            // expected
View Full Code Here

     * Test the encoding of a LdanDN
     */
    @Test
    public void testNameToBytes() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        Dn dn = (Dn) dnParser.parse( "cn = John, ou = People, OU = Marketing" );

        byte[] bytes = Dn.getBytes(dn);

        assertEquals( 30, bytes.length );
        assertEquals( "cn=John,ou=People,ou=Marketing", Strings.utf8ToString(bytes) );
View Full Code Here

    {
        String dn = Strings.utf8ToString(new byte[]
                {'C', 'N', ' ', '=', ' ', 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', ' ', 'L', (byte) 0xc3,
                        (byte) 0xa9, 'c', 'h', 'a', 'r', 'n', 'y'});

        FastDnParser dnParser = FastDnParser.getNameParser();
        Dn name = (Dn) dnParser.parse( dn );

        assertEquals( dn, name.getName() );
        assertEquals( "cn=Emmanuel  L\u00e9charny", name.getNormName() );
    }
View Full Code Here

    public void testStringParserShort() throws LdapException
    {
        String dn = Strings.utf8ToString(new byte[]
                {'C', '=', ' ', 'E', (byte) 0xc3, (byte) 0xa9, 'c'});

        FastDnParser dnParser = FastDnParser.getNameParser();
        Dn name = (Dn) dnParser.parse( dn );

        assertEquals( dn, name.getName() );
        assertEquals( "c=E\u00e9c", name.getNormName() );
    }
View Full Code Here


    @Test
    public void testVsldapExtras() throws LdapException
    {
        FastDnParser dnParser = FastDnParser.getNameParser();
        try
        {
            dnParser
                .parse( "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting, ou=Americas, ou=Search, o=IMC, c=US" );
            fail( "OID prefix not supported by fast parser" );
        }
        catch ( TooComplexException tce )
        {
View Full Code Here

     *             if anything goes wrong
     */
    @Test
    public final void testDnParser()
    {
        FastDnParser parser = FastDnParser.getNameParser();

        assertNotNull( parser );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.name.FastDnParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.