private Collection storeDocs(DBBroker broker, TransactionManager transact) throws Exception {
Txn transaction = transact.beginTransaction();
assertNotNull(transaction);
System.out.println("Transaction started ...");
Collection test = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
assertNotNull(test);
broker.saveCollection(transaction, test);
CollectionConfigurationManager mgr = broker.getBrokerPool().getConfigurationManager();
mgr.addConfiguration(transaction, broker, test, COLLECTION_CONFIG);
InputSource is = new InputSource(new File("samples/shakespeare/hamlet.xml").toURI().toASCIIString());
assertNotNull(is);
IndexInfo info = test.validateXMLResource(transaction, broker, XmldbURI.create("hamlet.xml"), is);
assertNotNull(info);
test.store(transaction, broker, info, is, false);
transact.commit(transaction);
System.out.println("Transaction commited ...");
transaction = transact.beginTransaction();
TestDataGenerator generator = new TestDataGenerator("xdb", COUNT);
System.out.println("Generating " + COUNT + " files...");
File[] files = generator.generate(broker, test, generateXQ);
for (int i = 0; i < files.length; i++) {
File file = files[i];
is = new InputSource(file.toURI().toASCIIString());
assertNotNull(is);
info = test.validateXMLResource(transaction, broker, XmldbURI.create(file.getName()), is);
assertNotNull(info);
test.store(transaction, broker, info, is, false);
}
generator.releaseAll();
transact.commit(transaction);
System.out.println("Transaction commited ...");
return test;