Package org.xmldb.api.modules

Examples of org.xmldb.api.modules.CollectionManagementService


    @Test
    public void collectionCreate() throws XMLDBException {
        final IndexQueryService idxConf = (IndexQueryService) root.getService("IndexQueryService", "1.0");
        idxConf.configureCollection(COLLECTION_CONFIG);

        final CollectionManagementService service = (CollectionManagementService) testCollection.getService("CollectionManagementService", "1.0");
        final Collection collection = service.createCollection("test");
        assertNotNull(collection);

        // remove the trigger for the Collection under test
        idxConf.configureCollection(EMPTY_COLLECTION_CONFIG);
View Full Code Here


    @Test
    public void collectionDelete() throws XMLDBException {
        final IndexQueryService idxConf = (IndexQueryService) testCollection.getService("IndexQueryService", "1.0");
        idxConf.configureCollection(COLLECTION_CONFIG);

        final CollectionManagementService service = (CollectionManagementService) testCollection.getService("CollectionManagementService", "1.0");
        final Collection collection = service.createCollection("test");
        assertNotNull(collection);

        service.removeCollection("test");

        // remove the trigger for the Collection under test
        idxConf.configureCollection(EMPTY_COLLECTION_CONFIG);

        final XPathQueryService query = (XPathQueryService) root.getService("XPathQueryService", "1.0");
View Full Code Here

        final Database database = (Database) cl.newInstance();
        database.setProperty("create-database", "true");
        DatabaseManager.registerDatabase(database);

        root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
        final CollectionManagementService service = (CollectionManagementService) root
                .getService("CollectionManagementService", "1.0");
        testCollection = service.createCollection(TEST_COLLECTION);
        assertNotNull(testCollection);
    }
View Full Code Here

    /** create "log" document that will be updated by the trigger,
     * and store the XQuery module implementing the trigger under test */
    @Before
    public void storePreliminaryDocuments() throws XMLDBException {
        TestUtils.cleanupDB();
        final CollectionManagementService service = (CollectionManagementService) root
                .getService("CollectionManagementService", "1.0");
        testCollection = service.createCollection(TEST_COLLECTION);
        assertNotNull(testCollection);

        final XMLResource doc = (XMLResource) testCollection.createResource(LOG_NAME, "XMLResource" );
        doc.setContent(EMPTY_LOG);
        testCollection.storeResource(doc);
View Full Code Here

    @After
    public void cleanDB() {
        try {
            Collection config = DatabaseManager.getCollection(BASE_URI + "/db/system/config" + testCollection, "admin", null);
            if (config != null) {
                CollectionManagementService mgmt = (CollectionManagementService) config.getService("CollectionManagementService", "1.0");
                mgmt.removeCollection(".");
            }
            Collection root = DatabaseManager.getCollection(BASE_URI + testCollection, "admin", "");
            Resource resource = root.getResource("messages.xml");
            if (resource != null) {
                root.removeResource(resource);
View Full Code Here

            Database database = (Database) cl.newInstance();
            database.setProperty("create-database", "true");
            DatabaseManager.registerDatabase(database);

            Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
            CollectionManagementService mgmt = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
            Collection testCol = mgmt.createCollection("triggers");

            for (int i = 1; i <= 2; i++) {
                mgmt = (CollectionManagementService) testCol.getService("CollectionManagementService", "1.0");
                testCol = mgmt.createCollection("sub" + i);
            }

        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

            database.setProperty("create-database", "true");
            DatabaseManager.registerDatabase(database);
           
            Collection root =
                DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
            CollectionManagementService service =
                (CollectionManagementService) root.getService(
                        "CollectionManagementService",
                "1.0");
            testCollection = root.getChildCollection(TEST_COLLECTION_NAME);
            if (testCollection == null) {
                testCollection = service.createCollection(TEST_COLLECTION_NAME);
                assertNotNull(testCollection);
                IndexQueryService idxConf = (IndexQueryService)
                testCollection.getService("IndexQueryService", "1.0");
                idxConf.configureCollection(COLLECTION_CONFIG);
            }
View Full Code Here

//        myWorkingCopyName = repositoryID;
//        myWorkingCopyPath = "/"+myWorkingCopyName;
     
      org.xmldb.api.base.Collection root = DatabaseManager.getCollection(
          XmldbURI.LOCAL_DB, "admin", "");
      CollectionManagementService mgmt = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
      try {
        mgmt.removeCollection(myWorkingCopyName);
        mgmt.removeCollection(importDirName);
      } catch (XMLDBException e) {
      }

    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

            fail(e.getMessage());
        }
    }

    private void storeDocs(String collectionName) throws XMLDBException {
        CollectionManagementService service = (CollectionManagementService) test.getService("CollectionManagementService", "1.0");
        Collection collection = service.createCollection(collectionName);
        IndexQueryService iqs = (IndexQueryService) collection.getService("IndexQueryService", "1.0");
        iqs.configureCollection(COLLECTION_CONFIG1);

        String existHome = System.getProperty("exist.home");
        File existDir = existHome==null ? new File(".") : new File(existHome);
View Full Code Here

            Database database = (Database) cl.newInstance();
            database.setProperty("create-database", "true");
            DatabaseManager.registerDatabase(database);

            org.xmldb.api.base.Collection root = DatabaseManager.getCollection(XmldbURI.LOCAL_DB, "admin", "");
            CollectionManagementService mgmt = (CollectionManagementService) root.getService("CollectionManagementService", "1.0");
            test = mgmt.createCollection("test");
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.xmldb.api.modules.CollectionManagementService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.