directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r807554 - /directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
Date Tue, 25 Aug 2009 11:07:33 GMT
Author: elecharny
Date: Tue Aug 25 11:07:33 2009
New Revision: 807554

URL: http://svn.apache.org/viewvc?rev=807554&view=rev
Log:
Fixed the MatchingRule description parser test

Modified:
    directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java

Modified: directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java?rev=807554&r1=807553&r2=807554&view=diff
==============================================================================
--- directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
(original)
+++ directory/shared/branches/shared-schema/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
Tue Aug 25 11:07:33 2009
@@ -22,7 +22,9 @@
 
 import java.text.ParseException;
 
-import org.apache.directory.shared.ldap.schema.parsers.MatchingRuleDescription;
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.parsers.MatchingRuleDescriptionSchemaParser;
 import org.junit.After;
 import org.junit.Before;
@@ -89,36 +91,36 @@
 
 
     @Test
-    public void testSyntax() throws ParseException
+    public void testSyntax() throws ParseException, NamingException
     {
         String value = null;
-        MatchingRuleDescription mrd = null;
+        MatchingRule matchingRule = null;
 
         // simple
         value = "( 1.1 SYNTAX 0.1.2.3.4.5.6.7.8.9 )";
-        mrd = parser.parseMatchingRuleDescription( value );
-        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+        matchingRule = parser.parseMatchingRuleDescription( value );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", matchingRule.getSyntaxOid() );
 
         // simple
         value = "(1.1 SYNTAX 123.456.789.0)";
-        mrd = parser.parseMatchingRuleDescription( value );
-        assertEquals( "123.456.789.0", mrd.getSyntax() );
+        matchingRule = parser.parseMatchingRuleDescription( value );
+        assertEquals( "123.456.789.0", matchingRule.getSyntaxOid() );
 
         // simple with spaces
         value = "( 1.1    SYNTAX    0.1.2.3.4.5.6.7.8.9    )";
-        mrd = parser.parseMatchingRuleDescription( value );
-        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+        matchingRule = parser.parseMatchingRuleDescription( value );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", matchingRule.getSyntaxOid() );
 
         // quoted value in parentheses
         value = "( 1.1    SYNTAX ('0.1.2.3.4.5.6.7.8.9')    )";
-        mrd = parser.parseMatchingRuleDescription( value );
-        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
+        matchingRule = parser.parseMatchingRuleDescription( value );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", matchingRule.getSyntaxOid() );
 
         // SYNTAX must only appear once
         value = "( 1.1 SYNTAX 2.2 SYNTAX 3.3 )";
         try
         {
-            mrd = parser.parseMatchingRuleDescription( value );
+            matchingRule = parser.parseMatchingRuleDescription( value );
             fail( "Exception expected, SYNTAX appears twice" );
         }
         catch ( ParseException pe )
@@ -144,7 +146,7 @@
             value = "( 1.1 )";
             try
             {
-                mrd = parser.parseMatchingRuleDescription( value );
+                matchingRule = parser.parseMatchingRuleDescription( value );
                 fail( "Exception expected, SYNTAX is required" );
             }
             catch ( ParseException pe )
@@ -163,30 +165,30 @@
 
 
     @Test
-    public void testFull() throws ParseException
+    public void testFull() throws ParseException, NamingException
     {
         String value = null;
-        MatchingRuleDescription mrd = null;
+        MatchingRule matchingRule = 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 SYNTAX 0.1.2.3.4.5.6.7.8.9
X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )";
-        mrd = parser.parseMatchingRuleDescription( value );
+        matchingRule = parser.parseMatchingRuleDescription( value );
 
-        assertEquals( "1.2.3.4.5.6.7.8.9.0", mrd.getOid() );
-        assertEquals( 2, mrd.getNames().size() );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-0123456789",
mrd.getNames().get( 0 ) );
-        assertEquals( "test", mrd.getNames().get( 1 ) );
-        assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", mrd.getDescription()
);
-        assertTrue( mrd.isObsolete() );
-        assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
-        assertEquals( 2, mrd.getExtensions().size() );
-        assertNotNull( mrd.getExtensions().get( "X-TEST-a" ) );
-        assertEquals( 2, mrd.getExtensions().get( "X-TEST-a" ).size() );
-        assertEquals( "test1-1", mrd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
-        assertEquals( "test1-2", mrd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
-        assertNotNull( mrd.getExtensions().get( "X-TEST-b" ) );
-        assertEquals( 2, mrd.getExtensions().get( "X-TEST-b" ).size() );
-        assertEquals( "test2-1", mrd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
-        assertEquals( "test2-2", mrd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", matchingRule.getOid() );
+        assertEquals( 2, matchingRule.getNames().size() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789",
matchingRule.getNames().get( 0 ) );
+        assertEquals( "test", matchingRule.getNames().get( 1 ) );
+        assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", matchingRule.getDescription()
);
+        assertTrue( matchingRule.isObsolete() );
+        assertEquals( "0.1.2.3.4.5.6.7.8.9", matchingRule.getSyntaxOid() );
+        assertEquals( 2, matchingRule.getExtensions().size() );
+        assertNotNull( matchingRule.getExtensions().get( "X-TEST-a" ) );
+        assertEquals( 2, matchingRule.getExtensions().get( "X-TEST-a" ).size() );
+        assertEquals( "test1-1", matchingRule.getExtensions().get( "X-TEST-a" ).get( 0 )
);
+        assertEquals( "test1-2", matchingRule.getExtensions().get( "X-TEST-a" ).get( 1 )
);
+        assertNotNull( matchingRule.getExtensions().get( "X-TEST-b" ) );
+        assertEquals( 2, matchingRule.getExtensions().get( "X-TEST-b" ).size() );
+        assertEquals( "test2-1", matchingRule.getExtensions().get( "X-TEST-b" ).get( 0 )
);
+        assertEquals( "test2-2", matchingRule.getExtensions().get( "X-TEST-b" ).get( 1 )
);
     }
 
 
@@ -212,14 +214,14 @@
      * @throws ParseException
      */
     @Test
-    public void testRequiredElements() throws ParseException
+    public void testRequiredElements() throws ParseException, NamingException
     {
         String value = null;
-        MatchingRuleDescription mrd = null;
+        MatchingRule matchingRule = null;
 
         value = "( 1.2.3.4.5.6.7.8.9.0 SYNTAX 1.1 )";
-        mrd = parser.parseMatchingRuleDescription( value );
-        assertNotNull( mrd.getSyntax() );
+        matchingRule = parser.parseMatchingRuleDescription( value );
+        assertNotNull( matchingRule.getSyntaxOid() );
 
         if ( !parser.isQuirksMode() )
         {
@@ -242,34 +244,34 @@
     ////////////////////////////////////////////////////////////////
 
     @Test
-    public void testRfc1() throws ParseException
+    public void testRfc1() throws ParseException, NamingException
     {
         String value = "( 2.5.13.5 NAME 'caseExactMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
)";
-        MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
+        MatchingRule matchingRule = parser.parseMatchingRuleDescription( value );
 
-        assertEquals( "2.5.13.5", mrd.getOid() );
-        assertEquals( 1, mrd.getNames().size() );
-        assertEquals( "caseexactmatch", mrd.getNames().get( 0 ) );
-        assertNull( mrd.getDescription() );
-        assertFalse( mrd.isObsolete() );
-        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", mrd.getSyntax() );
-        assertEquals( 0, mrd.getExtensions().size() );
+        assertEquals( "2.5.13.5", matchingRule.getOid() );
+        assertEquals( 1, matchingRule.getNames().size() );
+        assertEquals( "caseExactMatch", matchingRule.getNames().get( 0 ) );
+        assertNull( matchingRule.getDescription() );
+        assertFalse( matchingRule.isObsolete() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", matchingRule.getSyntaxOid() );
+        assertEquals( 0, matchingRule.getExtensions().size() );
     }
 
 
     @Test
-    public void testSun1() throws ParseException
+    public void testSun1() throws ParseException, NamingException
     {
         String value = "( 2.5.13.5 NAME 'caseExactMatch' DESC 'Case Exact Matching on Directory
String [defined in X.520]' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )";
-        MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
+        MatchingRule matchingRule = parser.parseMatchingRuleDescription( value );
 
-        assertEquals( "2.5.13.5", mrd.getOid() );
-        assertEquals( 1, mrd.getNames().size() );
-        assertEquals( "caseexactmatch", mrd.getNames().get( 0 ) );
-        assertEquals( "Case Exact Matching on Directory String [defined in X.520]", mrd.getDescription()
);
-        assertFalse( mrd.isObsolete() );
-        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", mrd.getSyntax() );
-        assertEquals( 0, mrd.getExtensions().size() );
+        assertEquals( "2.5.13.5", matchingRule.getOid() );
+        assertEquals( 1, matchingRule.getNames().size() );
+        assertEquals( "caseExactMatch", matchingRule.getNames().get( 0 ) );
+        assertEquals( "Case Exact Matching on Directory String [defined in X.520]", matchingRule.getDescription()
);
+        assertFalse( matchingRule.isObsolete() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", matchingRule.getSyntaxOid() );
+        assertEquals( 0, matchingRule.getExtensions().size() );
     }
 
 
@@ -278,7 +280,7 @@
      * syntax, no DOTs allowed in NAME value. 
      */
     @Test
-    public void testSun2() throws ParseException
+    public void testSun2() throws ParseException, NamingException
     {
         String value = "( 1.3.6.1.4.1.42.2.27.9.4.34.3.6 NAME 'caseExactSubstringMatch-2.16.840.1.113730.3.3.2.11.3'
DESC 'en' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )";
         if ( !parser.isQuirksMode() )
@@ -295,14 +297,14 @@
         }
         else
         {
-            MatchingRuleDescription mrd = parser.parseMatchingRuleDescription( value );
-            assertEquals( "1.3.6.1.4.1.42.2.27.9.4.34.3.6", mrd.getOid() );
-            assertEquals( 1, mrd.getNames().size() );
-            assertEquals( "caseexactsubstringmatch-2.16.840.1.113730.3.3.2.11.3", mrd.getNames().get(
0 ) );
-            assertEquals( "en", mrd.getDescription() );
-            assertFalse( mrd.isObsolete() );
-            assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", mrd.getSyntax() );
-            assertEquals( 0, mrd.getExtensions().size() );
+            MatchingRule matchingRule = parser.parseMatchingRuleDescription( value );
+            assertEquals( "1.3.6.1.4.1.42.2.27.9.4.34.3.6", matchingRule.getOid() );
+            assertEquals( 1, matchingRule.getNames().size() );
+            assertEquals( "caseExactSubstringMatch-2.16.840.1.113730.3.3.2.11.3", matchingRule.getNames().get(
0 ) );
+            assertEquals( "en", matchingRule.getDescription() );
+            assertFalse( matchingRule.isObsolete() );
+            assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", matchingRule.getSyntaxOid() );
+            assertEquals( 0, matchingRule.getExtensions().size() );
         }
     }
 
@@ -327,7 +329,7 @@
      * Tests quirks mode.
      */
     @Test
-    public void testQuirksMode() throws ParseException
+    public void testQuirksMode() throws ParseException, NamingException
     {
         SchemaParserTestUtils.testQuirksMode( parser, "SYNTAX 1.1" );
 



Mime
View raw message