XUpdateProcessor proc = new XUpdateProcessor();
XUpdateProcessor proc = new XUpdateProcessor(broker, docs);
    public void testStore() throws Exception {        BrokerPool.FORCE_CORRUPTION = true;        BrokerPool pool = startDB();                DBBroker broker = null;        try {            broker = pool.get(SecurityManager.SYSTEM_USER);                        TransactionManager transact = pool.getTransactionManager();            Txn transaction = transact.beginTransaction();                        System.out.println("Transaction started ...");                        Collection root = broker.getOrCreateCollection(transaction, "/db/test");            broker.saveCollection(transaction, root);                        Collection test = broker.getOrCreateCollection(transaction, "/db/test/test2");            broker.saveCollection(transaction, test);                        IndexInfo info;            info = test.validate(transaction, broker, "test.xml", TEST_XML);            test.store(transaction, broker, info, TEST_XML, false);                        transact.commit(transaction);                        transaction = transact.beginTransaction();                        DocumentSet docs = new DocumentSet();            docs.add(info.getDocument());            XUpdateProcessor proc = new XUpdateProcessor();                        String xupdate;            Modification modifications[];                        System.out.println("Inserting new items  ...");            // insert some nodes            for (int i = 1; i <= 200; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:insert-before select=\"/products/product[1]\">" +                    "       <product>" +                    "           <description>Product " + i + "</description>" +                    "           <price>" + (i * 2.5) + "</price>" +                    "           <stock>" + (i * 10) + "</stock>" +                    "       </product>" +                    "   </xu:insert-before>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                modifications[0].process(transaction);                proc.reset();            }                        System.out.println("Adding attributes  ...");            // add attribute            for (int i = 1; i <= 200; i++) {              xupdate =                  "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                  "   <xu:append select=\"/products/product[" + i + "]\">" +                  "         <xu:attribute name=\"id\">" + i + "</xu:attribute>" +                  " </xu:append>" +                  "</xu:modifications>";              proc.setBroker(broker);              proc.setDocumentSet(docs);              modifications = proc.parse(new InputSource(new StringReader(xupdate)));              modifications[0].process(transaction);              proc.reset();          }                        System.out.println("Replacing elements  ...");            // replace some            for (int i = 1; i <= 100; i++) {              xupdate =                  "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                  "   <xu:replace select=\"/products/product[" + i + "]\">" +                  "     <product id=\"" + i + "\">" +                  "         <description>Replaced product</description>" +                  "         <price>" + (i * 0.75) + "</price>" +                  "     </product>" +                  " </xu:replace>" +                  "</xu:modifications>";              proc.setBroker(broker);              proc.setDocumentSet(docs);              modifications = proc.parse(new InputSource(new StringReader(xupdate)));              long mods = modifications[0].process(transaction);              System.out.println("Modifications: " + mods);              proc.reset();          }                            System.out.println("Removing some elements ...");            // remove some            for (int i = 1; i <= 100; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:remove select=\"/products/product[last()]\"/>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                modifications[0].process(transaction);                proc.reset();            }                        System.out.println("Appending some elements ...");            for (int i = 1; i <= 100; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:append select=\"/products\">" +                    "       <product>" +                    "           <xu:attribute name=\"id\"><xu:value-of select=\"count(/products/product) + 1\"/></xu:attribute>" +                    "           <description>Product " + i + "</description>" +                    "           <price>" + (i * 2.5) + "</price>" +                    "           <stock>" + (i * 10) + "</stock>" +                    "       </product>" +                    "   </xu:append>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                modifications[0].process(transaction);                proc.reset();            }                        System.out.println("Renaming elements  ...");            // rename element "description" to "descript"            xupdate =                "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                "   <xu:rename select=\"/products/product/description\">descript</xu:rename>" +                "</xu:modifications>";            proc.setBroker(broker);            proc.setDocumentSet(docs);            modifications = proc.parse(new InputSource(new StringReader(xupdate)));            modifications[0].process(transaction);            proc.reset();                        System.out.println("Updating attribute values ...");            // update attribute values            for (int i = 1; i <= 200; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:update select=\"/products/product[" + i + "]/@id\">" + i + "u</xu:update>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                long mods = modifications[0].process(transaction);                System.out.println(mods + " records modified.");                proc.reset();            }            System.out.println("Append new element to each item ...");            // append new element to records            for (int i = 1; i <= 200; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:append select=\"/products/product[" + i + "]\">" +                    "       <date><xu:value-of select=\"current-dateTime()\"/></date>" +                    "   </xu:append>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                modifications[0].process(transaction);                proc.reset();            }                        System.out.println("Updating element content ...");            // update element content            for (int i = 1; i <= 200; i++) {                xupdate =                    "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +                    "   <xu:update select=\"/products/product[" + i + "]/price\">19.99</xu:update>" +                    "</xu:modifications>";                proc.setBroker(broker);                proc.setDocumentSet(docs);                modifications = proc.parse(new InputSource(new StringReader(xupdate)));                long mods = modifications[0].process(transaction);                System.out.println(mods + " records modified.");                proc.reset();            }            System.out.println("FINISHED!!!!");//            pool.getTransactionManager().getLogManager().flushToLog(true);            transact.commit(transaction);            System.out.println("Transaction " + transaction.getId() + " completed");        } catch (Exception e) {            System.out.println("EXCEPTION CAUGHT!!!!!!!!");            e.printStackTrace();            throw e;        } finally {            pool.release(broker);        }    }