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

Examples of org.apache.directory.shared.ldap.model.schema.MatchingRuleUse


        {
            String desc = value.getString();

            try
            {
                MatchingRuleUse matchingRuleUse = MRU_DESCR_SCHEMA_PARSER.parseMatchingRuleUseDescription( desc );

                updateSchemas( matchingRuleUse );
            }
            catch ( ParseException pe )
            {
View Full Code Here


            {
                SchemaObject schemaObject = schemaObjectWrapper.get();

                if ( schemaObject instanceof MatchingRuleUse )
                {
                    MatchingRuleUse matchingRuleUse = ( MatchingRuleUse ) schemaObject;

                    Entry matchingRuleUseEntry = factory.convert( matchingRuleUse, schema, null );

                    matchingRuleUseEntries.add( matchingRuleUseEntry );
                }
View Full Code Here

        reset( matchingRuleUseDescription ); // reset and initialize the parser / lexer pair

        try
        {
            MatchingRuleUse matchingRuleUse = parser.matchingRuleUseDescription();

            // Update the schemaName
            updateSchemaName( matchingRuleUse );

            return matchingRuleUse;
View Full Code Here

        }

        // MatchingRuleUse
        try
        {
            MatchingRuleUse matchingRuleUse = matchingRuleUseRegistry.lookup( name );

            if ( matchingRuleUse != null )
            {
                return matchingRuleUse.getOid();
            }
        }
        catch ( LdapException ne )
        {
            // Fall down to the next registry
View Full Code Here

    @Test
    public void testApplies() throws ParseException
    {

        String value = null;
        MatchingRuleUse matchingRuleUse = null;

        // APPLIES simple numericoid
        value = "( 1.1 APPLIES 1.2.3.4.5.6.7.8.9.0 )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "1.2.3.4.5.6.7.8.9.0", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );

        // SUP simple descr
        value = "( 1.1 APPLIES abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", matchingRuleUse
            .getApplicableAttributeOids().get( 0 ) );

        // APPLIES single numericoid
        value = "( 1.1 APPLIES ( 123.4567.890 ) )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "123.4567.890", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );

        // APPLIES single descr
        value = "(1.1 APPLIES(a-z-A-Z-0-9))";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "a-z-A-Z-0-9", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );

        // APPLIES multi numericoid
        value = "( 1.1 APPLIES ( 1.2.3 $ 4.5.6 $ 7.8.90 ) )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 3, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "1.2.3", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "4.5.6", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );
        assertEquals( "7.8.90", matchingRuleUse.getApplicableAttributeOids().get( 2 ) );

        // APPLIES multi descr
        value = "( 1.1 APPLIES ( test1 $ test2 ) )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 2, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "test1", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "test2", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );

        // APPLIES multi mixed, tabs
        value = "\t(\t1.1\tAPPLIES\t(\ttest1\t$\t1.2.3.4\t$\ttest2\t)\t)\t";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 3, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "test1", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "1.2.3.4", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );
        assertEquals( "test2", matchingRuleUse.getApplicableAttributeOids().get( 2 ) );

        // APPLIES multi mixed no space
        value = "(1.1 APPLIES(TEST-1$1.2.3.4$TEST-2))";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 3, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "TEST-1", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "1.2.3.4", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );
        assertEquals( "TEST-2", matchingRuleUse.getApplicableAttributeOids().get( 2 ) );

        // APPLIES multi mixed many spaces
        value = "(          1.1          APPLIES          (          test1          $          1.2.3.4$test2          )          )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 3, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "test1", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "1.2.3.4", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );
        assertEquals( "test2", matchingRuleUse.getApplicableAttributeOids().get( 2 ) );

        // quoted value
        value = "( 1.1 APPLIES 'test' )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "test", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );

        // quoted value
        value = "( 1.1 APPLIES '1.2.3.4' )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "1.2.3.4", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );

        // no $ separator
        value = "( 1.1 APPLIES ( test1 test2 ) )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 2, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "test1", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "test2", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );

        // invalid character
        value = "( 1.1 APPLIES 1.2.3.4.A )";
        try
        {
View Full Code Here

    @Test
    public void testFull() throws ParseException
    {
        String value = null;
        MatchingRuleUse matchingRuleUse = null;

        value = "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' OBSOLETE APPLIES ( 0.1.2.3.4.5.6.7.8.9 $ abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 ) X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );

        assertEquals( "1.2.3.4.5.6.7.8.9.0", matchingRuleUse.getOid() );
        assertEquals( 2, matchingRuleUse.getNames().size() );
        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", matchingRuleUse.getNames()
            .get( 0 ) );
        assertEquals( "test", matchingRuleUse.getNames().get( 1 ) );
        assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", matchingRuleUse.getDescription() );
        assertTrue( matchingRuleUse.isObsolete() );
        assertEquals( 2, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "0.1.2.3.4.5.6.7.8.9", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", matchingRuleUse
            .getApplicableAttributeOids().get( 1 ) );
        assertEquals( 2, matchingRuleUse.getExtensions().size() );
        assertNotNull( matchingRuleUse.getExtensions().get( "X-TEST-a" ) );
        assertEquals( 2, matchingRuleUse.getExtensions().get( "X-TEST-a" ).size() );
        assertEquals( "test1-1", matchingRuleUse.getExtensions().get( "X-TEST-a" ).get( 0 ) );
        assertEquals( "test1-2", matchingRuleUse.getExtensions().get( "X-TEST-a" ).get( 1 ) );
        assertNotNull( matchingRuleUse.getExtensions().get( "X-TEST-b" ) );
        assertEquals( 2, matchingRuleUse.getExtensions().get( "X-TEST-b" ).size() );
        assertEquals( "test2-1", matchingRuleUse.getExtensions().get( "X-TEST-b" ).get( 0 ) );
        assertEquals( "test2-2", matchingRuleUse.getExtensions().get( "X-TEST-b" ).get( 1 ) );
    }
View Full Code Here

     */
    @Test
    public void testRequiredElements() throws ParseException
    {
        String value = null;
        MatchingRuleUse matchingRuleUse = null;

        value = "( 1.2.3.4.5.6.7.8.9.0 APPLIES a )";
        matchingRuleUse = parser.parseMatchingRuleUseDescription( value );
        assertEquals( 1, matchingRuleUse.getApplicableAttributeOids().size() );

        if ( !parser.isQuirksMode() )
        {
            value = "( 1.2.3.4.5.6.7.8.9.0 )";
            try
View Full Code Here

    @Test
    public void testOpenldap1() throws ParseException
    {
        String value = "( 2.5.13.17 NAME 'octetStringMatch' APPLIES ( javaSerializedData $ userPassword ) )";
        MatchingRuleUse matchingRuleUse = parser.parseMatchingRuleUseDescription( value );

        assertEquals( "2.5.13.17", matchingRuleUse.getOid() );
        assertEquals( 1, matchingRuleUse.getNames().size() );
        assertEquals( "octetStringMatch", matchingRuleUse.getNames().get( 0 ) );
        assertNull( matchingRuleUse.getDescription() );
        assertFalse( matchingRuleUse.isObsolete() );
        assertEquals( 2, matchingRuleUse.getApplicableAttributeOids().size() );
        assertEquals( "javaSerializedData", matchingRuleUse.getApplicableAttributeOids().get( 0 ) );
        assertEquals( "userPassword", matchingRuleUse.getApplicableAttributeOids().get( 1 ) );
        assertEquals( 0, matchingRuleUse.getExtensions().size() );
    }
View Full Code Here

        }

        // MatchingRuleUse
        try
        {
            MatchingRuleUse matchingRuleUse = matchingRuleUseRegistry.lookup( name );

            if ( matchingRuleUse != null )
            {
                return matchingRuleUse.getOid();
            }
        }
        catch ( LdapException ne )
        {
            // Fall down to the next registry
View Full Code Here

        int pos = 0;

        for ( Value<?> value : attr )
        {
            MatchingRuleUse matchingRuleUse = null;

            try
            {
                matchingRuleUse = matchingRuleUseParser.parseMatchingRuleUseDescription( value.getString() );
                matchingRuleUse.setSpecification( value.getString() );
            }
            catch ( ParseException e )
            {
                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_421,
                        value.getString() ) );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.schema.MatchingRuleUse

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.