| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | } |
| | | |
| | | //Check if we find our OID. |
| | | assertTrue(syntaxList.contains("9.9.9")); |
| | | assertThat(syntaxList).contains("9.9.9"); |
| | | //DirectoryString. |
| | | assertTrue(syntaxList.contains("1.3.6.1.4.1.1466.115.121.1.15")); |
| | | assertThat(syntaxList).contains("1.3.6.1.4.1.1466.115.121.1.15"); |
| | | //IA5String. |
| | | assertTrue(syntaxList.contains("1.3.6.1.4.1.1466.115.121.1.26")); |
| | | assertThat(syntaxList).contains("1.3.6.1.4.1.1466.115.121.1.26"); |
| | | } |
| | | finally |
| | | { |
| | |
| | | "add: objectclasses", |
| | | "objectclasses: ( oc-oid NAME 'testOC' SUP top AUXILIARY MUST test-attr)" |
| | | ); |
| | | assertTrue(resultCode == 0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | TestCaseUtils.addEntry( |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the ordering-based search using enum syntax. |
| | | */ |
| | |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | List<SearchResultEntry> entries = searchOperation.getSearchEntries(); |
| | | assertThat(entries).as("expected one entry to be returned").isNotEmpty(); |
| | | assertTrue(entries.get(0).getName().equals(DN.valueOf("cn=test1,o=test"))); |
| | | assertThat(entries.get(0).getName()).isEqualTo(DN.valueOf("cn=test1,o=test")); |
| | | } |
| | | finally |
| | | { |
| | |
| | | "add: ldapsyntaxes", |
| | | "ldapsyntaxes: ( 9.9.9 DESC 'Unimplemented Syntax' " + |
| | | " X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )"); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** Deletes the substitutionSyntax from the schema. */ |
| | | private void deleteSubstitutionSyntax() throws Exception |
| | | { |
| | |
| | | "delete: ldapsyntaxes", |
| | | "ldapsyntaxes: ( 9.9.9 DESC 'Unimplemented Syntax' " + |
| | | " X-SUBST '1.3.6.1.4.1.1466.115.121.1.15' )"); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | |
| | | /** Adds a regex syntax to the schema. */ |
| | | private void addRegexSyntax() throws Exception |
| | | { |
| | |
| | | "add: ldapsyntaxes", |
| | | "ldapSyntaxes: ( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' " + |
| | | "X-PATTERN '^[a-z-A-Z]+:[0-9.]+\\d$' )"); |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | "add: objectclasses", |
| | | "objectclasses: ( oc-oid NAME 'testOC' SUP top AUXILIARY MUST test-attr-regex)" |
| | | ); |
| | | assertTrue(resultCode == 0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** Deletes the regex syntax from the schema. */ |
| | | private void deleteRegexSyntax() throws Exception |
| | | { |
| | |
| | | "delete: attributetypes", |
| | | "attributetypes: ( test-attr-oid NAME 'test-attr-regex' SYNTAX 1.1.1 )" |
| | | ); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | "delete: ldapsyntaxes", |
| | | "ldapSyntaxes: ( 1.1.1 DESC 'Host and Port in the format of HOST:PORT' " + |
| | | "X-PATTERN '^[a-z-A-Z]+:[0-9.]+\\d$' )"); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** Adds an enum syntax to the schema. */ |
| | | private void addEnumSyntax() throws Exception |
| | | { |
| | |
| | | "add: ldapsyntaxes", |
| | | "ldapSyntaxes: ( 3.3.3 DESC 'Day Of The Week' " + |
| | | "X-ENUM ( 'monday' 'tuesday' 'wednesday' 'thursday' 'friday' 'saturday' 'sunday') )"); |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | "add: objectclasses", |
| | | "objectclasses: ( oc-oid NAME 'testOC' SUP top AUXILIARY MUST test-attr-enum)" |
| | | ); |
| | | assertTrue(resultCode == 0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** Deletes the enum syntax from the schema. */ |
| | | private void deleteEnumSyntax() throws Exception |
| | | { |
| | |
| | | "delete: attributetypes", |
| | | "attributetypes: ( test-attr-oid NAME 'test-attr-enum' SYNTAX 3.3.3 )" |
| | | ); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | "delete: ldapsyntaxes", |
| | | "ldapSyntaxes: ( 3.3.3 DESC 'Day Of The Week' " + |
| | | "X-ENUM ( 'monday' 'tuesday' 'wednesday' 'thursday' 'friday' 'saturday' 'sunday') )"); |
| | | |
| | | assertTrue(resultCode==0); |
| | | assertThat(resultCode).isEqualTo(0); |
| | | } |
| | | } |