See https://issues.apache.org/jira/browse/OAK-4741

On 1.9.16 3:44 , Michael Dürig wrote:

The reason for this is that MemoryNodeStore requires as MemoryNodeState
passed to its constructor. Apparently this is not the case here:

        NodeState base =
ModifiedNodeState.squeeze(builder.getNodeState());
        NodeStore store = new MemoryNodeStore(base);
        NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot(
                store, new EditorHook(new CompositeEditorProvider(
                new NamespaceEditorProvider(),
                new TypeEditorProvider())), null, null, null, null));

This is not documented nor does that constructor have the right
signature. This is a bug and I'll file an issue for it once I come
around to it.

Michael

On 1.9.16 2:37 , Robert Munteanu wrote:
On Thu, 2016-09-01 at 12:19 +0200, Michael Dürig wrote:



I have a failing test in my fork at

  https://github.com/rombert/jackrabbit-oak/

If I run ReadWriteNamespaceRegistryTest from Eclipse it picks up
all
fixtures - including the Multiplexing one I added - and fails with
that
one.

Getting this isolated would be hard since it requires a full
NodeStore
implementation whose NodeState and NodeBuilder implementations
don't
extend the memory-based ones.

Can you share the stack trace of the failing test? Or is this not
helpful as there are too many modifications of Oak's core parts in
your
fork? Otherwise please share and indicate which revision of Oak this
fork is based on.

I've pasted the stack trace at the end.

As for my changes I have not touched the core parts of oak, the 'java'
part is contained in plugins/multiplex and spi/mount . I've recently
merged trunk up to r1758729.

I am wondering whether the InitialContent wraps the NodeState in a new
NodeStore only because it does not have access to the originating
NodeStore. That would give an indication of a possible solution.

Robert

ReadWriteNamespaceRegistryTest.testMappings
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest
[MultiplexingSegmentFixture with a mount under /tmp]
testMappings[MultiplexingSegmentFixture with a mount under
/tmp](org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
Test)
java.lang.IllegalArgumentException
    at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:7
7)
    at
org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(MemoryNo
deStore.java:126)
    at
org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)
    at
org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
    at
org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:260)
    at
org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
    at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.regis
terNamespace(ReadWriteNamespaceRegistry.java:94)
    at
org.apache.jackrabbit.commons.cnd.TemplateBuilderFactory.setNamespace(T
emplateBuilderFactory.java:92)
    at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doNameSpace(
CompactNodeTypeDefReader.java:246)
    at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(Compac
tNodeTypeDefReader.java:200)
    at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
ctNodeTypeDefReader.java:163)
    at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
ctNodeTypeDefReader.java:139)
    at
org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes(CndImpo
rter.java:147)
    at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
terNodeTypes(NodeTypeRegistry.java:109)
    at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
ter(NodeTypeRegistry.java:104)
    at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
terBuiltIn(NodeTypeRegistry.java:86)
    at
org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.initial
ize(InitialContent.java:120)
    at
org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer.initialize
(CompositeInitializer.java:48)
    at
org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakIn
itializer.java:42)
    at
org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:635)
    at
org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:623)
    at
org.apache.jackrabbit.oak.Oak.createContentSession(Oak.java:737)
    at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.c
reateContentSession(ReadWriteNamespaceRegistryTest.java:42)
    at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.t
estMappings(ReadWriteNamespaceRegistryTest.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
thod.java:50)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
ble.java:12)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
od.java:47)
    at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
d.java:17)
    at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
:27)
    at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:78)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Te
stReference.java:86)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.j
ava:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:459)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:678)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu
nner.java:382)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR
unner.java:192)


Michaelo




Thanks,

Robert



Michael




Robert




Michael


On 1.9.16 9:36 , Robert Munteanu wrote:



Hi,

I'm working on implementing a custom node store which
multiplexes
other
node stores.

Adding it as a fixture in oak-it results in a test failure
in

  ReadWriteNamespaceRegistryTest.testMappings [1]

The reason is
that
org.apache.jackrabbit.oak.plugins.nodetype.write.InitialCon
tent
class wraps the passed nodeStore into a MemoryNodeStore,
and
that
memory node store later on receives a builder which is not
MemoryNodeBuilder [2] → IllegalArgumentException.

I'm not familiar enough with that class to propose a fix,
but
effectively it forces all builders to be
MemoryNodeBuilders,
which
is
too restrictive IMO.

Is this a bug to file or something that I need to live with
when
implementing a new NodeStore?

Thanks,

Robert


[1]: https://github.com/apache/jackrabbit-oak/blob/64f48874
ac4a
ab6e
0ffb
085e07642ffa44d8c7ca/oak-
it/src/test/java/org/apache/jackrabbit/oak/plugins/name/Rea
dWri
teNa
mesp
aceRegistryTest.java#L46
[2]: https://github.com/apache/jackrabbit-oak/blob/64f48874
ac4a
ab6e
0ffb
085e07642ffa44d8c7ca/oak-
core/src/main/java/org/apache/jackrabbit/oak/plugins/nodety
pe/w
rite
/Ini
tialContent.java#L119




Reply via email to