anchela commented on code in PR #1013:
URL: https://github.com/apache/jackrabbit-oak/pull/1013#discussion_r1260759955
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java:
##########
@@ -324,4 +326,34 @@ public void malformedUUID() throws CommitFailedException {
assertTrue(e.isConstraintViolation());
}
}
+
+ @Test
+ public void addChildNodeNotStrictDefaultPrimaryTypeIfUnspecified() throws
CommitFailedException {
+ // set strict to 'false' to allow unset jcr:primaryType on new node
Review Comment:
maybe saying "to allow for a missing jcr:primaryType on a new node" would be
easier to understand.
i am not a native speaker and to me it was not clear what 'unset' means.
##########
oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeEditorTest.java:
##########
@@ -324,4 +326,34 @@ public void malformedUUID() throws CommitFailedException {
assertTrue(e.isConstraintViolation());
}
}
+
+ @Test
+ public void addChildNodeNotStrictDefaultPrimaryTypeIfUnspecified() throws
CommitFailedException {
+ // set strict to 'false' to allow unset jcr:primaryType on new node
+ EditorHook hook = new EditorHook(new TypeEditorProvider(false));
+
+ NodeState root = INITIAL_CONTENT;
+ NodeBuilder builder = root.builder();
+
+ NodeBuilder policyBuilder = builder.child("conf")
+ .setProperty(JCR_PRIMARYTYPE, "nt:folder", Type.NAME)
+ .setProperty(JCR_MIXINTYPES,
ImmutableList.of(AccessControlConstants.MIX_REP_ACCESS_CONTROLLABLE),
Type.NAMES)
+ .child("rep:policy")
+ // create the policy node with the correct primary type in the
before state
+ .setProperty(JCR_PRIMARYTYPE,
AccessControlConstants.NT_REP_ACL, Type.NAME);
+
+ NodeState before = builder.getNodeState();
+ policyBuilder.child("allow")
Review Comment:
please add a comment here as well: because the crucial piece is that this
'allow' child has no jcr:primaryType property and with 'strict' false it should
be set to the default primary type defined by the parent.
so, it's the combination of the parent having a primary type that defines a
default-primary-type for child nodes and the fact that this 'allow' child lacks
the primary type. and extra comment here would make the test a lot easier to
read.... (i had to go back to your bug report to understand it)
--
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]