| | |
| | | import org.forgerock.opendj.config.ConfigTestCase; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class DNPropertyDefinitionTest extends ConfigTestCase { |
| | | |
| | | @BeforeClass |
| | | public void setUp() throws Exception { |
| | | disableClassValidationForProperties(); |
| | | } |
| | | |
| | | @DataProvider(name = "baseDN") |
| | | public Object[][] createBuilderSetBaseDN() { |
| | | return new Object[][] { |
| | |
| | | "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition propertyDef = localBuilder.getInstance(); |
| | | propertyDef.validateValue(DN.valueOf(valueToValidate)); |
| | | propertyDef.validateValue(DN.valueOf(valueToValidate), PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @Test(dataProvider = "illegalValues", expectedExceptions = IllegalPropertyValueException.class) |
| | |
| | | "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition propertyDef = localBuilder.getInstance(); |
| | | propertyDef.validateValue(DN.valueOf(valueToValidate)); |
| | | propertyDef.validateValue(DN.valueOf(valueToValidate), PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @Test(dataProvider = "legalValues") |
| | |
| | | "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition propertyDef = localBuilder.getInstance(); |
| | | propertyDef.decodeValue(valueToValidate); |
| | | propertyDef.decodeValue(valueToValidate, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | |
| | | @Test(dataProvider = "illegalValues", expectedExceptions = IllegalPropertyValueStringException.class) |
| | |
| | | "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition propertyDef = localBuilder.getInstance(); |
| | | propertyDef.decodeValue(valueToValidate); |
| | | propertyDef.decodeValue(valueToValidate, PropertyDefinitionsOptions.NO_VALIDATION_OPTIONS); |
| | | } |
| | | } |