use of org.apache.jackrabbit.oak.commons.junit.LogCustomizer in project jackrabbit-oak by apache.
the class ObservationQueueFullWarnTest method warnOnQueueFull.
@Test
public void warnOnQueueFull() throws RepositoryException, InterruptedException, ExecutionException {
LogCustomizer customLogs = LogCustomizer.forLogger(ChangeProcessor.class.getName()).filter(Level.WARN).contains(OBS_QUEUE_FULL_WARN).create();
observationManager.addEventListener(listener, NODE_ADDED, TEST_PATH, true, null, null, false);
try {
customLogs.starting();
addNodeToFillObsQueue();
assertTrue("Observation queue full warning must get logged", customLogs.getLogs().size() > 0);
customLogs.finished();
} finally {
observationManager.removeEventListener(listener);
}
}
use of org.apache.jackrabbit.oak.commons.junit.LogCustomizer in project jackrabbit-oak by apache.
the class SegmentDataStoreBlobGCIT method checkMark.
@Test
public void checkMark() throws Exception {
LogCustomizer customLogs = LogCustomizer.forLogger(MarkSweepGarbageCollector.class.getName()).enable(Level.TRACE).filter(Level.TRACE).create();
DataStoreState state = setUp(10);
log.info("{} blobs available : {}", state.blobsPresent.size(), state.blobsPresent);
customLogs.starting();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10);
String rootFolder = folder.newFolder().getAbsolutePath();
MarkSweepGarbageCollector gcObj = init(0, executor, rootFolder);
gcObj.collectGarbage(true);
customLogs.finished();
assertBlobReferenceRecords(state.blobsPresent, rootFolder);
}
use of org.apache.jackrabbit.oak.commons.junit.LogCustomizer 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.commons.junit.LogCustomizer 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.commons.junit.LogCustomizer in project jackrabbit-oak by apache.
the class IndexUpdateTest method reindexForDisabledIndexes.
@Test
public void reindexForDisabledIndexes() throws Exception {
EditorHook hook = new EditorHook(new IndexUpdateProvider(new CompositeIndexEditorProvider(new PropertyIndexEditorProvider(), new ReferenceEditorProvider())));
NodeState before = builder.getNodeState();
createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "fooIndex", true, false, ImmutableSet.of("foo"), null);
builder.child("testRoot").setProperty("foo", "abc");
NodeState after = builder.getNodeState();
NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
before = indexed;
builder = before.builder();
builder.getChildNode("oak:index").getChildNode("fooIndex").setProperty(TYPE_PROPERTY_NAME, TYPE_DISABLED);
builder.getChildNode("oak:index").getChildNode("fooIndex").setProperty(REINDEX_PROPERTY_NAME, true);
after = builder.getNodeState();
LogCustomizer customLogs = LogCustomizer.forLogger(IndexUpdate.class.getName()).filter(Level.INFO).create();
customLogs.starting();
before = after;
builder = before.builder();
builder.child("testRoot2").setProperty("foo", "abc");
after = builder.getNodeState();
indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
assertTrue(customLogs.getLogs().isEmpty());
customLogs.finished();
}
Aggregations