anchela commented on code in PR #1000:
URL: https://github.com/apache/jackrabbit-oak/pull/1000#discussion_r1237137908
##########
oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java:
##########
@@ -29,10 +31,13 @@
import org.apache.jackrabbit.oak.OakBaseTest;
import org.apache.jackrabbit.oak.api.ContentSession;
import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.commons.junit.LogCustomizer;
import org.apache.jackrabbit.oak.fixture.NodeStoreFixture;
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
import org.junit.Test;
+import ch.qos.logback.classic.Level;
Review Comment:
is that import covered by a test-dependency in the pom?
##########
oak-it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java:
##########
@@ -90,4 +86,37 @@ protected void refresh() {
// expected
}
}
+
+ @Test
+ public void testInvalidNamespace() throws Exception {
+ final ContentSession session = createContentSession();
+ final Root root = session.getLatestRoot();
+ NamespaceRegistry r = getNamespaceRegistry(session, root);
+
+ LogCustomizer customLogs =
LogCustomizer.forLogger("org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry").enable(Level.ERROR).create();
+ try {
+ customLogs.starting();
+ r.registerNamespace("foo", "example.com");
+ r.unregisterNamespace("foo");
+ List<String> myLogs = customLogs.getLogs();
+ assertEquals(1, myLogs.size());
+ assertTrue(myLogs.get(0).contains("Registering invalid namespace
name 'example.com' for prefix 'foo', please see"));
+ }
+ finally {
+ customLogs.finished();
+ }
+ }
+
+ private NamespaceRegistry getNamespaceRegistry(ContentSession session,
Root root) {
Review Comment:
that could be static, no?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]