try {
broker = pool.get(pool.getSecurityManager().getSystemSubject());
transact = pool.getTransactionManager();
assertNotNull(transact);
TestDataGenerator generator = new TestDataGenerator("xdb", docCount);
Collection coll;
int fileCount = 0;
for (int i = 0; i < collectionCount; i++) {
transaction = transact.beginTransaction();
coll = broker.getOrCreateCollection(transaction,
TestConstants.TEST_COLLECTION_URI.append(Integer
.toString(i)));
assertNotNull(coll);
broker.saveCollection(transaction, coll);
transact.commit(transaction);
transaction = transact.beginTransaction();
System.out.println("Generating " + docCount + " files...");
File[] files = generator.generate(broker, coll, generateXQ);
for (int j = 0; j < files.length; j++, fileCount++) {
InputSource is = new InputSource(files[j].toURI()
.toASCIIString());
assertNotNull(is);
IndexInfo info = coll.validateXMLResource(transaction,
broker, XmldbURI.create("test" + fileCount
+ ".xml"), is);
assertNotNull(info);
coll.store(transaction, broker, info, is, false);
transact.commit(transaction);
}
generator.releaseAll();
}
} catch (Exception e) {
transact.abort(transaction);
e.printStackTrace();
// fail(e.getMessage());