use of org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData in project jackrabbit-oak by apache.
the class RDBDocumentStoreJDBCTest method queryIteratorConsumedTest.
@Test
public void queryIteratorConsumedTest() throws SQLException {
insertTestResource(this.getClass().getName() + "." + name.getMethodName());
LogCustomizer customLogs = LogCustomizer.forLogger(RDBDocumentStoreJDBC.class.getName()).enable(Level.DEBUG).contains("Query on ").create();
customLogs.starting();
MyConnectionHandler ch = new MyConnectionHandler(super.rdbDataSource);
RDBTableMetaData tmd = ((RDBDocumentStore) super.ds).getTable(Collection.NODES);
List<QueryCondition> conditions = Collections.emptyList();
try {
Iterator<RDBRow> qi = jdbc.queryAsIterator(ch, tmd, null, null, RDBDocumentStore.EMPTY_KEY_PATTERN, conditions, Integer.MAX_VALUE, null);
assertTrue(qi instanceof Closeable);
assertEquals(1, ch.cnt.get());
while (qi.hasNext()) {
qi.next();
}
assertEquals(0, ch.cnt.get());
assertEquals("should have a DEBUG level log entry", 1, customLogs.getLogs().size());
} finally {
customLogs.finished();
customLogs = null;
}
}
use of org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData in project jackrabbit-oak by apache.
the class RDBDocumentStoreJDBCTest method queryIteratorNotStartedTest.
@Test
public void queryIteratorNotStartedTest() throws SQLException {
insertTestResource(this.getClass().getName() + "." + name.getMethodName());
MyConnectionHandler ch = new MyConnectionHandler(super.rdbDataSource);
RDBTableMetaData tmd = ((RDBDocumentStore) super.ds).getTable(Collection.NODES);
List<QueryCondition> conditions = Collections.emptyList();
Iterator<RDBRow> qi = jdbc.queryAsIterator(ch, tmd, null, null, RDBDocumentStore.EMPTY_KEY_PATTERN, conditions, Integer.MAX_VALUE, null);
assertTrue(qi instanceof Closeable);
assertEquals(1, ch.cnt.get());
Utils.closeIfCloseable(qi);
assertEquals(0, ch.cnt.get());
}
use of org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData in project jackrabbit-oak by apache.
the class RDBDocumentStoreSchemaUpgradeTest method initDefault.
@Test
public void initDefault() {
RDBOptions op = new RDBOptions().tablePrefix("T00").initialSchema(0).upgradeToSchema(0).dropTablesOnClose(true);
RDBDocumentStore rdb = null;
try {
rdb = new RDBDocumentStore(this.ds, new DocumentMK.Builder(), op);
RDBTableMetaData meta = rdb.getTable(Collection.NODES);
assertEquals(op.getTablePrefix() + "_NODES", meta.getName());
assertFalse(meta.hasVersion());
} finally {
if (rdb != null) {
rdb.dispose();
}
}
}
use of org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData in project jackrabbit-oak by apache.
the class RDBDocumentStoreSchemaUpgradeTest method init01.
@Test
public void init01() {
LogCustomizer logCustomizer = LogCustomizer.forLogger(RDBDocumentStore.class.getName()).enable(Level.INFO).contains("to DB level 1").create();
logCustomizer.starting();
RDBOptions op = new RDBOptions().tablePrefix("T01").initialSchema(0).upgradeToSchema(1).dropTablesOnClose(true);
RDBDocumentStore rdb = null;
try {
rdb = new RDBDocumentStore(this.ds, new DocumentMK.Builder(), op);
RDBTableMetaData meta = rdb.getTable(Collection.NODES);
assertEquals(op.getTablePrefix() + "_NODES", meta.getName());
assertTrue(meta.hasVersion());
assertEquals("unexpected # of log entries: " + logCustomizer.getLogs(), RDBDocumentStore.getTableNames().size(), logCustomizer.getLogs().size());
} finally {
logCustomizer.finished();
if (rdb != null) {
rdb.dispose();
}
}
}
use of org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.RDBTableMetaData in project jackrabbit-oak by apache.
the class RDBDocumentStoreSchemaUpgradeTest method init11.
@Test
public void init11() {
LogCustomizer logCustomizer = LogCustomizer.forLogger(RDBDocumentStore.class.getName()).enable(Level.INFO).contains("to DB level 1").create();
logCustomizer.starting();
RDBOptions op = new RDBOptions().tablePrefix("T11").initialSchema(1).upgradeToSchema(1).dropTablesOnClose(true);
RDBDocumentStore rdb = null;
try {
rdb = new RDBDocumentStore(this.ds, new DocumentMK.Builder(), op);
RDBTableMetaData meta = rdb.getTable(Collection.NODES);
assertEquals(op.getTablePrefix() + "_NODES", meta.getName());
assertTrue(meta.hasVersion());
assertEquals("unexpected # of log entries: " + logCustomizer.getLogs(), 0, logCustomizer.getLogs().size());
} finally {
logCustomizer.finished();
if (rdb != null) {
rdb.dispose();
}
}
}
Aggregations