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

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


    public void testNotEqualDiffName() throws LdapException
    {
        AddRequestImpl req0 = new AddRequestImpl();
        req0.setMessageId( 5 );
        req0.setEntry( getEntry() );
        req0.setEntryDn( new Dn( "cn=admin,dc=example,dc=com" ) );

        AddRequestImpl req1 = new AddRequestImpl();
        req1.setMessageId( 5 );
        req1.setEntry( getEntry() );
        req1.setEntryDn( new Dn( "cn=admin,dc=apache,dc=org" ) );

        assertFalse( req0.equals( req1 ) );
    }
View Full Code Here


    public void testNotEqualDiffAttributes() throws LdapException
    {
        AddRequestImpl req0 = new AddRequestImpl();
        req0.setMessageId( 5 );
        Entry entry0 = getEntry();
        entry0.setDn( new Dn( "cn=admin,dc=apache,dc=org" ) );
        req0.setEntry( entry0 );

        AddRequestImpl req1 = new AddRequestImpl();
        req1.setMessageId( 5 );
        req1.setEntryDn( new Dn( "cn=admin,dc=apache,dc=org" ) );

        assertTrue( req0.equals( req1 ) );
        assertTrue( req1.equals( req0 ) );

        Entry entry1 = getEntry();
        entry1.setDn( new Dn( "cn=admin,dc=apache,dc=org" ) );
        req1.setEntry( entry1 );

        assertTrue( req0.equals( req1 ) );
        assertTrue( req1.equals( req0 ) );
View Full Code Here

     */
    public void initialize() throws Exception
    {
        try
        {
            schemaModificationAttributesDn = new Dn( SchemaConstants.SCHEMA_MODIFICATIONS_DN );
            schemaModificationAttributesDn.apply( new DefaultSchemaManager() );
        }
        catch ( LdapInvalidDnException e )
        {
            throw new RuntimeException( e );
View Full Code Here

        {
            root.addAttribute( "requestID", "" + requestID );
        }

        // Matched Dn
        Dn matchedDn = result.getMatchedDn();

        if ( !Dn.isNullOrEmpty( matchedDn ) )
        {
            root.addAttribute( "matchedDn", matchedDn.getName() );
        }

        // Controls
        ParserUtils.addControls( codec, root, message.getControls().values() );
View Full Code Here

     * @throws java.lang.Exception
     */
    @BeforeClass
    public static void setUpBeforeClass() throws Exception
    {
        EXAMPLE_DN = new Dn( "dc=example,dc=com" );
        schemaManager = new DefaultSchemaManager();
    }
View Full Code Here

    {
        Entry entry = new DefaultEntry( EXAMPLE_DN );

        assertEquals( EXAMPLE_DN, entry.getDn() );

        Dn testDn = new Dn( "cn=test" );
        entry.setDn( testDn );

        assertEquals( testDn, entry.getDn() );
    }
View Full Code Here

        Entry entry1 = new DefaultEntry( EXAMPLE_DN );
        Entry entry2 = new DefaultEntry( EXAMPLE_DN );

        assertEquals( entry1.hashCode(), entry2.hashCode() );

        entry2.setDn( new Dn( "ou=system,dc=com" ) );
        assertNotSame( entry1.hashCode(), entry2.hashCode() );

        entry2.setDn( EXAMPLE_DN );
        assertEquals( entry1.hashCode(), entry2.hashCode() );
View Full Code Here

     * Test the serialization of a complete entry
     */
    @Test
    public void testSerializeCompleteEntry() throws LdapException, IOException, ClassNotFoundException
    {
        Dn dn = new Dn( "ou=system" );

        dn.apply( schemaManager );

        byte[] password = Strings.getBytesUtf8( "secret" );
        Entry entry = new DefaultEntry( dn );
        entry.add( "ObjectClass", "top", "person" );
        entry.add( "cn", "test1" );
View Full Code Here

     * Test the serialization of an entry with no attribute
     */
    @Test
    public void testSerializeEntryWithNoAttribute() throws LdapException, IOException, ClassNotFoundException
    {
        Dn dn = new Dn( "ou=system" );

        dn.apply( schemaManager );

        Entry entry = new DefaultEntry( dn );

        Entry entrySer = deserializeValue( serializeValue( entry ) );

View Full Code Here

     *                    +--> 0x04 L7-m-n value
     * </pre>
     */
    public int computeLength()
    {
        Dn dn = getObjectName();

        byte[] dnBytes = Strings.getBytesUtf8( dn.getName() );

        // The entry
        int searchResultEntryLength = 1 + TLV.getNbBytes( dnBytes.length ) + dnBytes.length;
        setObjectNameBytes( dnBytes );

View Full Code Here

TOP

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

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.