Examples of DefaultEntry


Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

     * Test for method add( String, byte[]...)
     */
    @Test
    public void testAddStringByteArrayArray() throws Exception
    {
        Entry entry = new DefaultEntry( schemaManager, EXAMPLE_DN );

        entry.add( "userPassword", ( byte[] ) null );
        assertEquals( 1, entry.size() );
        Attribute attributePWD = entry.get( "userPassword" );
        assertEquals( 1, attributePWD.size() );
        assertNotNull( attributePWD.get() );
        assertNull( attributePWD.get().getValue() );

        entry.clear();

        entry.add( "userPassword", BYTES1, BYTES1, BYTES2 );
        assertEquals( 1, entry.size() );
        Attribute attributeJPG = entry.get( "userPassword" );
        assertEquals( 2, attributeJPG.size() );
        assertNotNull( attributeJPG.get() );
        assertTrue( attributeJPG.contains( BYTES1 ) );
        assertTrue( attributeJPG.contains( BYTES2 ) );

        entry.clear();

        try
        {
            // Cannot add an attribute which does not exist
            entry.add( "wrongAT", BYTES1, BYTES2 );
            fail();
        }
        catch ( LdapNoSuchAttributeException nsae )
        {
            assertTrue( true );
        }

        // Cannot add String values into a binary attribute
        entry.add( "userPassword", "test", "test2" );
        assertEquals( 2, entry.get( "userPassword" ).size() );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

            // First, add 100 entries in the server
            for ( int i = 0; i < 100; i++ )
            {
                String dn = "cn=user" + i + "," + BASE;
                Entry kate = new DefaultEntry( dn );

                kate.add( "objectclass", "top", "person" );
                kate.add( "sn", "Bush" );
                kate.add( "cn", "user" + i );

                asyncCnx.add( kate );
            }

            // Searches for all the entries in ou=system
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

                if ( contextEntry == null )
                {
                    if ( contextEntryFile.exists() )
                    {
                        LdifReader reader = new LdifReader( contextEntryFile );
                        contextEntry = new DefaultEntry( schemaManager, reader.next().getEntry() );
                        reader.close();
                    }
                    else
                    {
                        // No context entry and no LDIF file exists.
                        // Skip initialization of context entry here, it will be added later.
                        return;
                    }
                }

                // Initialization of the context entry
                if ( ( suffixDn != null ) && ( contextEntry != null ) )
                {
                    Dn contextEntryDn = contextEntry.getDn();

                    // Checking if the context entry DN is schema aware
                    if ( !contextEntryDn.isSchemaAware() )
                    {
                        contextEntryDn.apply( schemaManager );
                    }

                    // We're only adding the entry if the two DNs are equal
                    if ( suffixDn.equals( contextEntryDn ) )
                    {
                        // Looking for the current context entry
                        Entry suffixEntry = lookup( new LookupOperationContext( null, suffixDn ) );

                        // We're only adding the context entry if it doesn't already exist
                        if ( suffixEntry == null )
                        {
                            // Checking of the context entry is schema aware
                            if ( !contextEntry.isSchemaAware() )
                            {
                                // Making the context entry schema aware
                                contextEntry = new DefaultEntry( schemaManager, contextEntry );
                            }

                            // Adding the 'entryCsn' attribute
                            if ( contextEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null )
                            {
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

                {
                    // this ldif will have only one entry
                    LdifEntry ldifEntry = ldifEntries.get( 0 );
                    LOG.debug( "Adding entry {}", ldifEntry );

                    Entry serverEntry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );

                    if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_CSN_AT ) )
                    {
                        serverEntry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString() );
                    }

                    if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_UUID_AT ) )
                    {
                        serverEntry.put( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
                    }

                    // call add on the wrapped partition not on the self
                    AddOperationContext addContext = new AddOperationContext( null, serverEntry );
                    super.add( addContext );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

   
        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            getLdapServer().getDirectoryService().getAdminSession().add(
                new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }
   
        reader.close();
   
        connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            getLdapServer().getDirectoryService().getAdminSession().add(
                new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }

        reader.close();
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.entry.DefaultEntry

        assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
        assertNotNull( evaluator.getNormalizer() );
        assertNotNull( evaluator.getComparator() );

        Dn dn = new Dn( schemaManager, "cn=jane doe,o=good times co." );
        Entry attrs = new DefaultEntry( schemaManager, dn );
        attrs.add( "objectClass", "person" );
        attrs.add( "c-street", "3" );
        attrs.add( "cn", "jane doe" );
        attrs.add( "sn", "doe" );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", Strings.getUUID( 12L ).toString() );

        AddOperationContext addContext = new AddOperationContext( null, attrs );
        ( ( Partition ) store ).add( addContext );

        indexEntry.setId( Strings.getUUID( 12L ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.DefaultEntry

        try
        {
            String cn = "entry-" + System.currentTimeMillis();
            DN dn = new DN( "cn=" + cn + "," + config.getBaseDn() );
            Entry entry = new DefaultEntry();
            entry.add( "objectclass", "person" );
            entry.add( "cn", cn );
            entry.add( "sn", cn );
            entry.setDn( dn );

            LOG.debug( "adding entry with dn: {}" + dn );
            connection.add( entry );
        }
        catch ( Exception e )
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.entry.DefaultEntry

                // Store the response into the responseQueue
                SearchResultEntry searchResultEntry = ( SearchResultEntry ) response;

                if ( schemaManager != null )
                {
                    searchResultEntry.setEntry( new DefaultEntry( schemaManager, searchResultEntry.getEntry() ) );
                }

                searchFuture = ( SearchFuture ) responseFuture;

                if ( LOG.isDebugEnabled() )
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.entry.DefaultEntry

    }


    private Entry getEntry( LdapComparatorDescription comparatorDescription )
    {
        Entry entry = new DefaultEntry();

        entry.put( SchemaConstants.OBJECT_CLASS_AT,
            SchemaConstants.TOP_OC,
            MetaSchemaConstants.META_TOP_OC,
            MetaSchemaConstants.META_COMPARATOR_OC );

        entry.put( MetaSchemaConstants.M_OID_AT, comparatorDescription.getOid() );
        entry.put( MetaSchemaConstants.M_FQCN_AT, comparatorDescription.getFqcn() );

        if ( comparatorDescription.getBytecode() != null )
        {
            entry.put( MetaSchemaConstants.M_BYTECODE_AT,
                Base64.decode( comparatorDescription.getBytecode().toCharArray() ) );
        }

        if ( comparatorDescription.getDescription() != null )
        {
            entry.put( MetaSchemaConstants.M_DESCRIPTION_AT, comparatorDescription.getDescription() );
        }

        return entry;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.