use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class DuplicateAttributesTest method setup.
@BeforeClass
public static void setup() throws XMLDBException {
final CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
testCollection = service.createCollection("test");
assertNotNull(testCollection);
Resource resource = testCollection.createResource("stored1.xml", "XMLResource");
resource.setContent(STORED_DOC1);
testCollection.storeResource(resource);
resource = testCollection.createResource("stored2.xml", "XMLResource");
resource.setContent(STORED_DOC2);
testCollection.storeResource(resource);
resource = testCollection.createResource("docdtd.xml", "XMLResource");
resource.setContent(DOC_WITH_DTD);
testCollection.storeResource(resource);
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class RemoveAppendTest method setUp.
@Before
public void setUp() throws Exception {
rootCol = existXmldbEmbeddedServer.getRoot();
testCol = rootCol.getChildCollection(XmldbURI.ROOT_COLLECTION + "/test");
if (testCol != null) {
CollectionManagementService mgr = DBUtils.getCollectionManagementService(rootCol);
mgr.removeCollection(XmldbURI.ROOT_COLLECTION + "/test");
}
testCol = DBUtils.addCollection(rootCol, "test");
assertNotNull(testCol);
DBUtils.addXMLResource(testCol, "test.xml", "<test/>");
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class StressTest method setUp.
@Before
public void setUp() throws XMLDBException {
final Collection rootCol = existXmldbEmbeddedServer.getRoot();
testCol = rootCol.getChildCollection(XmldbURI.ROOT_COLLECTION + "/test");
if (testCol != null) {
final CollectionManagementService mgr = DBUtils.getCollectionManagementService(rootCol);
mgr.removeCollection(XmldbURI.ROOT_COLLECTION + "/test");
}
testCol = DBUtils.addCollection(rootCol, "test");
assertNotNull(testCol);
tags = IntStream.range(0, RUNS).mapToObj(i -> "TAG" + i).toArray(String[]::new);
DBUtils.addXMLResource(testCol, "test.xml", XML);
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class XmldbBinariesTest method removeCollection.
@Override
protected void removeCollection(final XmldbURI collectionUri) throws Exception {
Collection colRoot = null;
try {
colRoot = DatabaseManager.getCollection(getBaseUri() + "/db", ADMIN_DB_USER, ADMIN_DB_PWD);
final Collection colTest = colRoot.getChildCollection("test");
try {
final CollectionManagementService cms = (CollectionManagementService) colTest.getService("CollectionManagementService", "1.0");
final String testCollectionName = collectionUri.lastSegment().toString();
cms.removeCollection(testCollectionName);
} finally {
if (colTest != null) {
colTest.close();
}
}
} finally {
if (colRoot != null) {
colRoot.close();
}
}
}
use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.
the class XmldbBinariesTest method getOrCreateCollection.
private Collection getOrCreateCollection(final Collection parent, final String childName) throws XMLDBException {
Collection child = parent.getChildCollection(childName);
if (child == null) {
final CollectionManagementService cms = (CollectionManagementService) parent.getService("CollectionManagementService", "1.0");
child = cms.createCollection(childName);
}
return child;
}
Aggregations