use of org.exist.util.Configuration in project exist by eXist-db.
the class DatabaseImpl method configure.
/**
* In embedded mode: configure the database instance
*
* @throws XMLDBException Description of the Exception
*/
private void configure(final String instanceName) throws XMLDBException {
try {
final Configuration config = new Configuration(configuration, Optional.empty());
if (dataDir != null) {
config.setProperty(BrokerPool.PROPERTY_DATA_DIR, Paths.get(dataDir));
}
if (journalDir != null) {
config.setProperty(Journal.PROPERTY_RECOVERY_JOURNAL_DIR, Paths.get(journalDir));
}
BrokerPool.configure(instanceName, 1, 5, config);
if (shutdown != null) {
BrokerPool.getInstance(instanceName).registerShutdownListener(shutdown);
}
currentInstanceName = instanceName;
} catch (final Exception e) {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "configuration error: " + e.getMessage(), e);
}
}
use of org.exist.util.Configuration in project exist by eXist-db.
the class DatabaseInsertResources_NoValidation_Test method insertValidationResources_dtd.
@Test
public void insertValidationResources_dtd() throws IOException {
final Configuration config = existEmbeddedServer.getBrokerPool().getConfiguration();
config.setProperty(XMLReaderObjectFactory.PROPERTY_VALIDATION_MODE, "no");
try (final InputStream is = SAMPLES.getSample("validation/dtd/hamlet.dtd")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/" + TestTools.VALIDATION_DTD_COLLECTION + "/hamlet.dtd");
}
try (final InputStream is = SAMPLES.getSample("validation/dtd/catalog.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/" + TestTools.VALIDATION_DTD_COLLECTION + "/catalog.xml");
}
try (final InputStream is = SAMPLES.getSample("validation/dtd/hamlet_valid.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/hamlet_valid.xml");
}
try (final InputStream is = SAMPLES.getSample("validation/dtd/hamlet_invalid.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/hamlet_invalid.xml");
}
}
use of org.exist.util.Configuration in project exist by eXist-db.
the class DatabaseInsertResources_NoValidation_Test method insertValidationResource_dtd_badDocType.
@Test
public void insertValidationResource_dtd_badDocType() throws IOException {
final Configuration config = existEmbeddedServer.getBrokerPool().getConfiguration();
config.setProperty(XMLReaderObjectFactory.PROPERTY_VALIDATION_MODE, "no");
try (final InputStream is = SAMPLES.getSample("validation/dtd/hamlet_nodoctype.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/hamlet_nodoctype.xml");
}
try (final InputStream is = SAMPLES.getSample("validation/dtd/hamlet_wrongdoctype.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/hamlet_wrongdoctype.xml");
}
}
use of org.exist.util.Configuration in project exist by eXist-db.
the class DatabaseInsertResources_NoValidation_Test method insertValidationResources_xsd.
/**
* Insert all documents into database, switch of validation.
*/
@Test
public void insertValidationResources_xsd() throws IOException {
final Configuration config = existEmbeddedServer.getBrokerPool().getConfiguration();
config.setProperty(XMLReaderObjectFactory.PROPERTY_VALIDATION_MODE, "no");
try (final InputStream is = SAMPLES.getSample("validation/addressbook/addressbook.xsd")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/" + TestTools.VALIDATION_XSD_COLLECTION + "/addressbook.xsd");
}
try (final InputStream is = SAMPLES.getSample("validation/addressbook/catalog.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/" + TestTools.VALIDATION_XSD_COLLECTION + "/catalog.xml");
}
try (final InputStream is = SAMPLES.getSample("validation/addressbook/addressbook_valid.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/addressbook_valid.xml");
}
try (final InputStream is = SAMPLES.getSample("validation/addressbook/addressbook_invalid.xml")) {
TestTools.insertDocumentToURL(is, "xmldb:exist://" + VALIDATION_HOME_COLLECTION_URI + "/addressbook_invalid.xml");
}
}
use of org.exist.util.Configuration in project exist by eXist-db.
the class JavaFunctionsTest method setUp.
@Before
public void setUp() throws Exception {
// Check the configuration file to see if Java binding is enabled
// if it is not enabled then we expect an exception when trying to
// perform Java binding.
Configuration config = new Configuration();
String javabinding = (String) config.getProperty(FunctionFactory.PROPERTY_ENABLE_JAVA_BINDING);
if (javabinding != null) {
if (javabinding.equals("yes")) {
javabindingenabled = true;
}
}
}
Aggregations