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

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


    @Test
    public void testComplexOrRefinement() throws Exception
    {
        ExprNode refinement = null;
        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
        String refStr = "(|(objectClass=person)(objectClass=organizationalUnit))";
       
        refinement = FilterParser.parse( refStr );

        assertTrue( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
        assertTrue( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
        assertFalse( evaluator.evaluate( refinement, objectClasses ) );
    }
View Full Code Here


    @Test
    public void testComplexAndRefinement() throws Exception
    {
        ExprNode refinement = null;
        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
        objectClasses.add( "organizationalUnit" );
        String refStr = "(&(objectClass=person)(objectClass=organizationalUnit))";
       
        refinement = FilterParser.parse( refStr );

        assertTrue( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
        assertFalse( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
        assertFalse( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
        assertFalse( evaluator.evaluate( refinement, objectClasses ) );
    }
View Full Code Here

    @Test
    public void testComplexNotRefinement() throws Exception
    {
        ExprNode refinement = null;
        ServerAttribute objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "person" );
        String refStr = "(!(objectClass=person))";

        refinement = FilterParser.parse( refStr );

        assertFalse( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
        assertTrue( evaluator.evaluate( refinement, objectClasses ) );
       
        objectClasses = new DefaultServerAttribute( "objectClass", OBJECT_CLASS, "domain" );
        assertTrue( evaluator.evaluate( refinement, objectClasses ) );

        try
        {
            assertFalse( evaluator.evaluate( new NotNode(), new DefaultServerAttribute( "objectClass", OBJECT_CLASS ) ) );
            fail( "should never get here due to an IAE" );
        }
        catch ( IllegalArgumentException iae )
        {
        }
View Full Code Here

    /**
     * Generate the comparators attribute from the registry
     */
    private ServerAttribute generateComparators() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.COMPARATORS_AT ) );

        for ( LdapComparator<?> comparator : getSchemaManager().getComparatorRegistry() )
        {
            attr.add( SchemaUtils.render( comparator ) );
        }

        return attr;
    }
View Full Code Here

    }


    private ServerAttribute generateNormalizers() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.NORMALIZERS_AT ) );

        NormalizerRegistry nr = getSchemaManager().getNormalizerRegistry();
       
        for ( Normalizer normalizer : nr )
        {
            attr.add( SchemaUtils.render( normalizer ) );
        }

        return attr;
    }
View Full Code Here

    {
        AttributeType at;
        try
        {
            at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key );
            ServerAttribute attr = new DefaultServerAttribute( at );
            Modification mi = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
            addDelta( mi );
        }
        catch ( NamingException e )
        {
View Full Code Here

    {
        AttributeType at;
        try
        {
            at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key );
            ServerAttribute attr = new DefaultServerAttribute( at, value );
            Modification mi = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
            addDelta( mi );
        }
        catch ( NamingException e )
        {
View Full Code Here

    }


    private ServerAttribute generateSyntaxCheckers() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.SYNTAX_CHECKERS_AT ) );

        for ( SyntaxChecker syntaxChecker : getSchemaManager().getSyntaxCheckerRegistry() )
        {
            attr.add( SchemaUtils.render( syntaxChecker ) );
        }
       
        return attr;
    }
View Full Code Here

    }


    private ServerAttribute generateObjectClasses() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASSES_AT ) );

        for ( ObjectClass objectClass : getSchemaManager().getObjectClassRegistry() )
        {
            attr.add( SchemaUtils.render( objectClass ).toString() );
        }

        return attr;
    }
View Full Code Here

    }


    private ServerAttribute generateAttributeTypes() throws NamingException
    {
        ServerAttribute attr = new DefaultServerAttribute(
            getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.ATTRIBUTE_TYPES_AT ) );

        for ( AttributeType attributeType : getSchemaManager().getAttributeTypeRegistry() )
        {
            attr.add( SchemaUtils.render( attributeType ).toString() );
        }

        return attr;
    }
View Full Code Here

TOP

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

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.