use of org.exist.Database in project exist by eXist-db.
the class BlobStoreImplTest method newBlobStore.
private static BlobStore newBlobStore(final Path blobDbx, final Path blobDir) {
final Database database = createNiceMock(Database.class);
expect(database.getThreadGroup()).andReturn(Thread.currentThread().getThreadGroup());
expect(database.getId()).andReturn("BlobStoreTest").times(2);
expect(database.getJournalManager()).andReturn(Optional.empty()).anyTimes();
replay(database);
return new BlobStoreImpl(database, blobDbx, blobDir, DIGEST_TYPE);
}
use of org.exist.Database in project exist by eXist-db.
the class DebuggerTest method store.
private static void store(final String name, final String data) throws EXistException, PermissionDeniedException, IOException, TriggerException, LockException {
final Database pool = BrokerPool.getInstance();
final TransactionManager transact = pool.getTransactionManager();
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
final Txn transaction = transact.beginTransaction()) {
Collection root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
broker.saveCollection(transaction, root);
assertNotNull(root);
broker.storeDocument(transaction, XmldbURI.create(name), new StringInputSource(data), MimeType.XML_TYPE, root);
transact.commit(transaction);
}
}
Aggregations