public static DataSource forJdbcUrl(String url, String username, String passwd) { return forJdbcUrl(url, username, passwd, null); }
public static DataSource forJdbcUrl(String url, String username, String passwd) { return forJdbcUrl(url, username, passwd, null); }
private DataSource getDataSource(Closer closer) { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcUri, user, password); if (ds instanceof Closeable) { closer.register((Closeable)ds); } return ds; }
private DataSource getDataSource(Closer closer) { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcUri, user, password); if (ds instanceof Closeable) { closer.register((Closeable)ds); } return ds; }
public MyFixture(String name, String url, String username, String passwd) { this.name = name; try { dataSource = new RDBDataSourceWrapper(RDBDataSourceFactory.forJdbcUrl(url, username, passwd)); } catch (Exception ex) { LOG.info("Database instance not available at " + url + ", skipping tests...", ex); } }
public RDBFixture(String name, String url, String username, String passwd) { this.name = name; try { dataSource = new RDBDataSourceWrapper(RDBDataSourceFactory.forJdbcUrl(url, username, passwd)); } catch (Exception ex) { LOG.info("Database instance not available at " + url + ", skipping tests...", ex); } }
private BlobStore getBlobStore(StatisticsProvider statsProvider) { try { if (useDataStore) { initializeBlobStoreFixture(statsProvider); return blobStoreFixture.setUp(); } else { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); return new RDBBlobStore(ds, getOptions(dropDBAfterTest, tablePrefix)); } } catch (Exception e) { throw new RuntimeException(e); } }
private BlobStore getBlobStore(StatisticsProvider statsProvider) { try { if (useDataStore) { initializeBlobStoreFixture(statsProvider); return blobStoreFixture.setUp(); } else { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); return new RDBBlobStore(ds, getOptions(dropDBAfterTest, tablePrefix)); } } catch (Exception e) { throw new RuntimeException(e); } }
@Override public NodeStore createNodeStore() { String prefix = "T" + Long.toHexString(System.currentTimeMillis()); RDBOptions options = new RDBOptions().tablePrefix(prefix).dropTablesOnClose(true); this.jdbcUrl = pUrl.replace("{fname}", fname); DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcUrl, pUser, pPasswd); NodeStore result = new DocumentMK.Builder().setPersistentCache("target/persistentCache,time") .setRDBConnection(ds, options).getNodeStore(); this.dataSources.put(result, ds); return result; }
@Override public Oak[] setUpCluster(int n, StatisticsProvider statsProvider) throws Exception { Oak[] cluster = new Oak[n]; nodeStores = new DocumentNodeStore[cluster.length]; for (int i = 0; i < cluster.length; i++) { BlobStore blobStore = getBlobStore(statsProvider); DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setStatisticsProvider(statsProvider) // FIXME: OAK-3389 .setLeaseCheckMode(LeaseCheckMode.DISABLED) .setClusterId(i + 1).setLogging(false); if (blobStore != null) { builder.setBlobStore(blobStore); } nodeStores[i] = builder.build(); cluster[i] = newOak(nodeStores[i]); } if (vgcMaxAge > 0 && nodeStores.length >= 1) { versionGarbageCollectionJob = new VersionGarbageCollectionJob(nodeStores[0], vgcMaxAge); Thread t = new Thread(versionGarbageCollectionJob); t.setDaemon(true); t.start(); } return cluster; }
@Override public Oak[] setUpCluster(int n, StatisticsProvider statsProvider) throws Exception { Oak[] cluster = new Oak[n]; nodeStores = new DocumentNodeStore[cluster.length]; for (int i = 0; i < cluster.length; i++) { BlobStore blobStore = getBlobStore(statsProvider); DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setStatisticsProvider(statsProvider) // FIXME: OAK-3389 .setLeaseCheckMode(LeaseCheckMode.DISABLED) .setClusterId(i + 1).setLogging(false); if (blobStore != null) { builder.setBlobStore(blobStore); } nodeStores[i] = builder.build(); cluster[i] = newOak(nodeStores[i]); } if (vgcMaxAge > 0 && nodeStores.length >= 1) { versionGarbageCollectionJob = new VersionGarbageCollectionJob(nodeStores[0], vgcMaxAge); Thread t = new Thread(versionGarbageCollectionJob); t.setDaemon(true); t.start(); } return cluster; }
@Override public Oak getOak(int clusterId) throws Exception { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setClusterId(clusterId).setLogging(false); BlobStore blobStore = getBlobStore(StatisticsProvider.NOOP); if (blobStore != null) { builder.setBlobStore(blobStore); } return newOak(builder.build()); }
@Override public Oak getOak(int clusterId) throws Exception { DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcuri, jdbcuser, jdbcpasswd); DocumentNodeStoreBuilder<?> builder = newRDBDocumentNodeStoreBuilder() .setRDBConnection(ds, getOptions(dropDBAfterTest, tablePrefix)).memoryCacheSize(cacheSize) .setClusterId(clusterId).setLogging(false); BlobStore blobStore = getBlobStore(StatisticsProvider.NOOP); if (blobStore != null) { builder.setBlobStore(blobStore); } return newOak(builder.build()); }
@Before public void setUpConnection() throws Exception { dataSource = RDBDataSourceFactory.forJdbcUrl(URL, USERNAME, PASSWD); Revision.setClock(getTestClock()); mk = newBuilder(dataSource).open(); }
@Before @Override public void setUpConnection() throws Exception { dataSource = RDBDataSourceFactory.forJdbcUrl(URL, USERNAME, PASSWD); DocumentMK.Builder builder = new DocumentMK.Builder().clock(getTestClock()).setAsyncDelay(0); RDBOptions opt = new RDBOptions().tablePrefix("T" + Long.toHexString(System.currentTimeMillis())).dropTablesOnClose(true); store = new TestStore(dataSource, builder, opt); mk = builder.setDocumentStore(store).setLeaseCheckMode(LeaseCheckMode.DISABLED).open(); }
} else if (commonOpts.isRDB()) { RDBStoreOptions rdbOpts = options.getOptionBean(RDBStoreOptions.class); DataSource ds = RDBDataSourceFactory.forJdbcUrl(commonOpts.getStoreArg(), rdbOpts.getUser(), rdbOpts.getPassword()); wb.register(DataSource.class, ds, emptyMap());
memoryCacheSize(64 * 1024 * 1024). setPersistentCache("target/persistentCache,time"). setRDBConnection(RDBDataSourceFactory.forJdbcUrl(jdbcUrl, USERNAME, PASSWD), options). getNodeStore(); Jcr jcr = new Jcr(m);
} else if (commonOpts.isRDB()) { RDBStoreOptions rdbOpts = options.getOptionBean(RDBStoreOptions.class); DataSource ds = RDBDataSourceFactory.forJdbcUrl(commonOpts.getStoreArg(), rdbOpts.getUser(), rdbOpts.getPassword()); wb.register(DataSource.class, ds, emptyMap());