use of ch.qos.logback.core.AppenderBase in project jackrabbit-oak by apache.
the class RepositoryTest method largeMultiValueProperty.
@Test
public void largeMultiValueProperty() throws Exception {
final List<String> logMessages = Lists.newArrayList();
Appender<ILoggingEvent> a = new AppenderBase<ILoggingEvent>() {
@Override
protected void append(ILoggingEvent e) {
if (Level.WARN.isGreaterOrEqual(e.getLevel())) {
logMessages.add(e.getFormattedMessage());
}
}
};
a.start();
rootLogger().addAppender(a);
Session session = getAdminSession();
Node node = session.getRootNode().addNode("largeMultiValueProperty", "nt:unstructured");
//ItemImpl.MV_PROPERTY_WARN_THRESHOLD - 1000
String[] largeArray = new String[1000 + 1];
Arrays.fill(largeArray, "x");
Property p = node.setProperty("fooProp", largeArray);
Property p2 = node.setProperty("barProp", new String[] { "x" });
p2.setValue(largeArray);
session.save();
rootLogger().detachAppender(a);
a.stop();
assertTrue(logMessages.size() >= 2);
assertThat("Warn log message must contains a reference to the large array property path", logMessages.toString(), containsString(p.getPath()));
assertThat("Warn log message must contains a reference to the large array property path", logMessages.toString(), containsString(p2.getPath()));
}
Aggregations