List of usage examples for org.apache.commons.configuration.resolver CatalogResolver setCatalogFiles
public void setCatalogFiles(String catalogs)
From source file:io.datalayer.conf.XmlConfigurationTest.java
/** * Tests modifying an XML document and saving it with schema validation * enabled./*from ww w . ja va 2 s. c o m*/ */ @Test @Ignore public void testSaveWithValidation() throws Exception { CatalogResolver resolver = new CatalogResolver(); resolver.setCatalogFiles(CATALOG_FILES); conf = new XMLConfiguration(); conf.setEntityResolver(resolver); conf.setFileName(testFile2); conf.setSchemaValidation(true); conf.load(); conf.setProperty("Employee.SSN", "123456789"); conf.validate(); conf.save(testSaveConf); conf = new XMLConfiguration(testSaveConf); assertEquals("123456789", conf.getString("Employee.SSN")); }
From source file:io.datalayer.conf.XmlConfigurationTest.java
/** * Tests modifying an XML document and validating it against the schema. *//* w ww .j av a2s. c o m*/ @Test @Ignore public void testSaveWithValidationFailure() throws Exception { CatalogResolver resolver = new CatalogResolver(); resolver.setCatalogFiles(CATALOG_FILES); conf = new XMLConfiguration(); conf.setEntityResolver(resolver); conf.setFileName(testFile2); conf.setSchemaValidation(true); conf.load(); conf.setProperty("Employee.Email", "JohnDoe@apache.org"); try { conf.validate(); fail("No validation failure on save"); } catch (Exception e) { Throwable cause = e.getCause(); assertNotNull("No cause for exception on save", cause); assertTrue("Incorrect exception on save", cause instanceof SAXParseException); } }