Package org.apache.directory.server.core.entry

Examples of org.apache.directory.server.core.entry.DefaultServerEntry


        store.modify( dn, mods );
        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );

        // testing the store.modify( dn, mod, entry ) API
        ServerEntry entry = new DefaultServerEntry( schemaManager, dn );
        attribVal = "JWalker";
        entry.add( "sn", attribVal );

        store.modify( dn, ModificationOperation.REPLACE_ATTRIBUTE, entry );
        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
    }
View Full Code Here


        store.modify( dn, mods );
        assertNull( lookedup.get( "sn" ) );

        // testing the store.modify( dn, mod, entry ) API
        ServerEntry entry = new DefaultServerEntry( schemaManager, dn );

        // add an entry for the sake of testing the remove operation
        entry.add( "sn", "JWalker" );
        store.modify( dn, ModificationOperation.ADD_ATTRIBUTE, entry );
        assertNotNull( lookedup.get( "sn" ) );

        store.modify( dn, ModificationOperation.REMOVE_ATTRIBUTE, entry );
        assertNull( lookedup.get( "sn" ) );
View Full Code Here

    @Test
    public void testModifyReplaceNonExistingIndexAttribute() throws Exception
    {
        DN dn = new DN( "cn=Tim B,ou=Sales,o=Good Times Co." );
        dn.normalize( schemaManager.getNormalizerMapping() );
        DefaultServerEntry entry = new DefaultServerEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "person", "organizationalPerson" );
        entry.add( "cn", "Tim B" );
        entry.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        entry.add( "entryUUID", UUID.randomUUID().toString() );

        store.add( entry );

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT, schemaManager
View Full Code Here

    public AddOperationContext( CoreSession session, InternalAddRequest addRequest ) throws Exception
    {
        super( session );
        entry = new ClonedServerEntry(
            new DefaultServerEntry( session.getDirectoryService().getSchemaManager(), addRequest.getEntry() ) );
        dn = addRequest.getEntry().getDn();
        requestControls = addRequest.getControls();
       
        if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )
        {
View Full Code Here

        }


        public ServerEntry get() throws Exception
        {
            return new DefaultServerEntry( service.getSchemaManager() );
        }
View Full Code Here

    {
        Collection<String> attrTypes = new ArrayList<String>();
        attrTypes.add( "cn" );
        Collection<ACITuple> tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );

        ServerEntry entry = new DefaultServerEntry( schemaManager, USER_NAME );
        entry.put( "cn", USER_NAME.toNormName() );

        // Test wrong scope
        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ENTRY, null, null, USER_NAME, null, null, null,
            "cn", null, entry, null, null ).size() );

        tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );

        assertEquals( 1, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
            null, null, null, "cn", null, entry, null, null ).size() );

        entry.removeAttributes( "cn" );
        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
            null, null, null, "cn", null, entry, null, null ).size() );

        tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );
        assertEquals( 0, filterA.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, USER_NAME,
View Full Code Here

        LdifReader reader = new LdifReader( new StringReader( ldif ) );
        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            ldapServer.getDirectoryService().getAdminSession().add(
                new DefaultServerEntry( ldapServer.getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }
    }
View Full Code Here

            fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
        }

        DN entryName = new DN( "ou=test, ou=system" );
        PROTECTED_ITEMS.add( new ProtectedItem.MaxImmSub( 2 ) );
        ENTRY = new DefaultServerEntry( schemaManager, entryName );

        ENTRY.put( "cn", "1", "2" );
    }
View Full Code Here

        nextInterceptor.rename( opContext );

        DN newDn = opContext.getNewDn();
       
        // add operational attributes after call in case the operation fails
        ServerEntry serverEntry = new DefaultServerEntry( schemaManager, newDn );
        serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
        serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );

        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );

        ModifyOperationContext newModify = new ModifyOperationContext( opContext.getSession(), newDn, items );
        newModify.setEntry( opContext.getAlteredEntry() );
View Full Code Here

    public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws Exception
    {
        nextInterceptor.move( opContext );

        // add operational attributes after call in case the operation fails
        ServerEntry serverEntry = new DefaultServerEntry( schemaManager, opContext.getDn() );
        serverEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal().getName() );
        serverEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );

        List<Modification> items = ModifyOperationContext.createModItems( serverEntry, ModificationOperation.REPLACE_ATTRIBUTE );


        ModifyOperationContext newModify =
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.entry.DefaultServerEntry

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.