Search in sources :

Example 46 with CollectionManagementService

use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.

the class XMLDBBackupTest method deleteCollection.

private void deleteCollection(final XmldbURI collectionUri) throws XMLDBException {
    final Collection parent = DatabaseManager.getCollection(collectionUri.removeLastSegment().toString(), TestUtils.ADMIN_DB_USER, TestUtils.ADMIN_DB_PWD);
    final CollectionManagementService colService = (CollectionManagementService) parent.getService("CollectionManagementService", "1.0");
    colService.removeCollection(collectionUri.lastSegment().toString());
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService) Collection(org.xmldb.api.base.Collection)

Example 47 with CollectionManagementService

use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.

the class FilterInputStreamCacheMonitorTest method cleanup.

@AfterClass
public static void cleanup() throws XMLDBException {
    final CollectionManagementService cms = (CollectionManagementService) existXmldbEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
    cms.removeCollection(TEST_COLLECTION_NAME);
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService) AfterClass(org.junit.AfterClass)

Example 48 with CollectionManagementService

use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.

the class ProtectedModeTest method setupDb.

@BeforeClass
public static void setupDb() throws XMLDBException, SAXException {
    CollectionManagementService mgmt = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
    final Collection collection = mgmt.createCollection("protected");
    mgmt = (CollectionManagementService) collection.getService("CollectionManagementService", "1.0");
    final TestDataGenerator generator = new TestDataGenerator("xdb", DOCUMENT_COUNT);
    for (int i = 0; i < COLLECTION_COUNT; i++) {
        Collection currentColl = mgmt.createCollection("test" + i);
        final Path[] files = generator.generate(currentColl, generateXQ);
        for (int j = 0; j < files.length; j++) {
            final XMLResource resource = (XMLResource) currentColl.createResource("xdb" + j + ".xml", "XMLResource");
            resource.setContent(files[j].toFile());
            currentColl.storeResource(resource);
        }
    }
}
Also used : Path(java.nio.file.Path) CollectionManagementService(org.xmldb.api.modules.CollectionManagementService) Collection(org.xmldb.api.base.Collection) XMLResource(org.xmldb.api.modules.XMLResource) TestDataGenerator(org.exist.TestDataGenerator) BeforeClass(org.junit.BeforeClass)

Example 49 with CollectionManagementService

use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.

the class TestXPathOpOrSpecialCase method setUp.

@Before
public void setUp() throws Exception {
    final CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
    testCollection = service.createCollection("blah");
    assertNotNull(testCollection);
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService)

Example 50 with CollectionManagementService

use of org.xmldb.api.modules.CollectionManagementService in project exist by eXist-db.

the class TestXPathOpOrSpecialCase method tearDown.

@After
public void tearDown() throws Exception {
    final CollectionManagementService service = (CollectionManagementService) existEmbeddedServer.getRoot().getService("CollectionManagementService", "1.0");
    service.removeCollection("blah");
    testCollection = null;
}
Also used : CollectionManagementService(org.xmldb.api.modules.CollectionManagementService)

Aggregations

CollectionManagementService (org.xmldb.api.modules.CollectionManagementService)148 Collection (org.xmldb.api.base.Collection)84 XMLResource (org.xmldb.api.modules.XMLResource)33 Resource (org.xmldb.api.base.Resource)25 Before (org.junit.Before)23 EXistCollectionManagementService (org.exist.xmldb.EXistCollectionManagementService)21 After (org.junit.After)21 Test (org.junit.Test)19 UserManagementService (org.exist.xmldb.UserManagementService)14 ResourceSet (org.xmldb.api.base.ResourceSet)14 BinaryResource (org.xmldb.api.modules.BinaryResource)13 XPathQueryService (org.xmldb.api.modules.XPathQueryService)9 Account (org.exist.security.Account)7 IndexQueryService (org.exist.xmldb.IndexQueryService)6 AfterClass (org.junit.AfterClass)6 Database (org.xmldb.api.base.Database)6 XMLDBException (org.xmldb.api.base.XMLDBException)6 Path (java.nio.file.Path)5 BeforeClass (org.junit.BeforeClass)5 InputStream (java.io.InputStream)4