mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
13.18.2006 e2b5d0139eddee6a32ede3e586b10bd0fdfa667f
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java
@@ -47,35 +47,33 @@
    // - a value that must be tested for correctness
    // - a boolean indicating if the value is correct.
    return new Object[][] {
        // tests for the UTC time syntax
        // Some values are commented because these values are not
        // accepted. I think they should.
        //{SYNTAX_UTC_TIME_OID,"20060906135000.000Z", true},
        //{SYNTAX_UTC_TIME_OID,"20060906135030.3Z", true},
        //{SYNTAX_UTC_TIME_OID,"20060906135030.30Z", true},
        //{SYNTAX_UTC_TIME_OID,"20060906135030.Z", true},
        //{SYNTAX_UTC_TIME_OID,"20060906135030.0118Z", true},
        {SYNTAX_UTC_TIME_OID,"20060906135030+01", true},
        {SYNTAX_UTC_TIME_OID,"200609061350Z", true},
        {SYNTAX_UTC_TIME_OID,"20060906135030Z", true},
        {SYNTAX_UTC_TIME_OID,"20061116135030Z", true},
        {SYNTAX_UTC_TIME_OID,"20061126135030Z", true},
        {SYNTAX_UTC_TIME_OID,"20061231235959Z", true},
        {SYNTAX_UTC_TIME_OID,"20060906135030+0101", true},
        {SYNTAX_UTC_TIME_OID,"20060906135030+2359", true},
        {SYNTAX_UTC_TIME_OID,"20060906135030+3359", false},
        {SYNTAX_UTC_TIME_OID,"20060906135030+2389", false},
        {SYNTAX_UTC_TIME_OID,"20062231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"20061232235959Z", false},
        {SYNTAX_UTC_TIME_OID,"2006123123595aZ", false},
        {SYNTAX_UTC_TIME_OID,"200a1231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"2006j231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"200612-1235959Z", false},
        {SYNTAX_UTC_TIME_OID,"20061231#35959Z", false},
        // tests for the UTC time syntax. This time syntax only uses 2 digits
        // for the year but it is currently implemented using 4 digits
        // disable the tests for now.
        // see issue 637
        /*
        {SYNTAX_UTC_TIME_OID,"060906135030+01", true},
        {SYNTAX_UTC_TIME_OID,"0609061350Z", true},
        {SYNTAX_UTC_TIME_OID,"060906135030Z", true},
        {SYNTAX_UTC_TIME_OID,"061116135030Z", true},
        {SYNTAX_UTC_TIME_OID,"061126135030Z", true},
        {SYNTAX_UTC_TIME_OID,"061231235959Z", true},
        {SYNTAX_UTC_TIME_OID,"060906135030+0101", true},
        {SYNTAX_UTC_TIME_OID,"060906135030+2359", true},
        {SYNTAX_UTC_TIME_OID,"060906135030+3359", false},
        {SYNTAX_UTC_TIME_OID,"060906135030+2389", false},
        {SYNTAX_UTC_TIME_OID,"062231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"061232235959Z", false},
        {SYNTAX_UTC_TIME_OID,"06123123595aZ", false},
        {SYNTAX_UTC_TIME_OID,"0a1231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"06j231235959Z", false},
        {SYNTAX_UTC_TIME_OID,"0612-1235959Z", false},
        {SYNTAX_UTC_TIME_OID,"061231#35959Z", false},
        {SYNTAX_UTC_TIME_OID,"2006", false},
        // generalized time. Not much different from UTC time.
        */
        // generalized time.
        {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+01", true},
        {SYNTAX_GENERALIZED_TIME_OID,"200609061350Z", true},
        {SYNTAX_GENERALIZED_TIME_OID,"20060906135030Z", true},
@@ -94,7 +92,7 @@
        {SYNTAX_GENERALIZED_TIME_OID,"200612-1235959Z", false},
        {SYNTAX_GENERALIZED_TIME_OID,"20061231#35959Z", false},
        {SYNTAX_GENERALIZED_TIME_OID,"2006", false},
        // here starts the data for the tests of the Content rule syntax
        {SYNTAX_DIT_CONTENT_RULE_OID,
          "( 2.5.6.4 DESC 'content rule for organization' NOT "
@@ -152,35 +150,77 @@
                 + " MUST cn "
                 + "( this is an extra parameter )"
             , true},
         // Here start the data for the tests of the matching rule syntaxes
         // Here start the data for the tests of the matching rule syntaxes
         {SYNTAX_MATCHING_RULE_OID,
               "( 1.2.3.4 NAME 'full matching rule' "
               + " DESC 'description of matching rule' OBSOLETE "
               + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
               + " ( this is an extension ) )", true},
               + " ( this is an extension ) )", true},
         {SYNTAX_MATCHING_RULE_OID,
               "( 1.2.3.4 NAME 'missing closing parenthesis' "
               + " DESC 'description of matching rule' "
               + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
               + " ( this is an extension ) ", false},
         // Here start the data for the tests of the matching rule use syntaxes
         // Here start the data for the tests of the matching rule use syntaxes
         {SYNTAX_MATCHING_RULE_USE_OID,
               "( 2.5.13.10 NAME 'full matching rule' "
               + " DESC 'description of matching rule' OBSOLETE "
               + " APPLIES 2.5.4.3 "
               + " ( this is an extension ) )", true},
               + " ( this is an extension ) )", true},
         {SYNTAX_MATCHING_RULE_USE_OID,
                     "( 2.5.13.10 NAME 'missing closing parenthesis' "
                     + " DESC 'description of matching rule' "
                     + " SYNTAX 2.5.4.3 "
                     + " ( this is an extension ) ", false},
         {SYNTAX_BIT_STRING_OID, "\'0\'B", true},
         {SYNTAX_BIT_STRING_OID, "\'1\'B", true},
         {SYNTAX_BIT_STRING_OID, "invalid", false},
         // disabled because test is failing :
         // {SYNTAX_LDAP_SYNTAX_OID,
         //   "( 2.5.4.3 DESC 'full syntax description' "
         //  + "( this is an extension ) )", true},
         {SYNTAX_LDAP_SYNTAX_OID,
             "( 2.5.4.3 DESC 'full syntax description' )", true},
         {SYNTAX_LDAP_SYNTAX_OID,
               "   (    2.5.4.3    DESC  ' syntax description'    )", true},
         {SYNTAX_LDAP_SYNTAX_OID,
               "( 2.5.4.3 DESC syntax description )", false},
         {SYNTAX_LDAP_SYNTAX_OID,
                 "($%^*&!@ DESC 'syntax description' )", false},
         {SYNTAX_LDAP_SYNTAX_OID,
                   "(temp-oid DESC 'syntax description' )", true},
         {SYNTAX_LDAP_SYNTAX_OID,
                   "2.5.4.3 DESC 'syntax description' )", false},
         {SYNTAX_LDAP_SYNTAX_OID,
                     "(2.5.4.3 DESC 'syntax description' ", false},
         {SYNTAX_GUIDE_OID, "sn$EQ|!(sn$EQ)", true},
         {SYNTAX_GUIDE_OID, "!(sn$EQ)", true},
         {SYNTAX_GUIDE_OID, "person#sn$EQ", true},
         {SYNTAX_GUIDE_OID, "(sn$EQ)", true},
         {SYNTAX_GUIDE_OID, "sn$EQ", true},
         {SYNTAX_GUIDE_OID, "sn$SUBSTR", true},
         {SYNTAX_GUIDE_OID, "sn$GE", true},
         {SYNTAX_GUIDE_OID, "sn$LE", true},
         {SYNTAX_GUIDE_OID, "sn$ME", false},
         {SYNTAX_GUIDE_OID, "?true", true},
         {SYNTAX_GUIDE_OID, "?false", true},
         {SYNTAX_GUIDE_OID, "true|sn$GE", false},
         {SYNTAX_GUIDE_OID, "sn$APPROX", true},
         {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ)", true},
         {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ", false},
         {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ)|sn$EQ", true},
         {SYNTAX_GUIDE_OID, "sn$EQ|(cn$APPROX&?false)", true},
         {SYNTAX_GUIDE_OID, "sn$EQ|(cn$APPROX&|?false)", false},
        
    };
  }
  /**
   * Test the normalization and the approximate comparison.
   */
@@ -195,7 +235,7 @@
    Boolean liveResult = rule.valueIsAcceptable(
        new ASN1OctetString(value), new StringBuilder());
    assertEquals(result, liveResult);
    // call the getters to increase code coverage...
    rule.getApproximateMatchingRule();
    rule.getDescription();
@@ -206,7 +246,7 @@
    rule.getSyntaxName();
    rule.toString();
  }
  /**
   * Set up the environment for performing the tests in this suite.
   *