Skip to content

Commit

Permalink
MODE-1807 - Fixed the validation of residual child definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Horia Chiorean committed Feb 13, 2013
1 parent 5f2f84c commit 61d160d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Expand Up @@ -2521,7 +2521,7 @@ private void validate( JcrNodeDefinition node,
for (Name name : node.requiredPrimaryTypeNames()) {
JcrNodeType npt = findTypeInMapOrList(name, pendingTypes);

if (npt.isNodeType(apt.getName())) {
if (npt != null && npt.isNodeType(apt.getName())) {
found = true;
break;
}
Expand Down
Expand Up @@ -27,6 +27,7 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.InputStream;
Expand Down Expand Up @@ -815,6 +816,21 @@ public void shouldDiscoverCorrectChildNodeTypeButFailOnMandatoryPropertiesWithNo
session.save();
}

@Test
@FixFor( "MODE-1807" )
public void shouldRegisterCNDFileWithResidualChildDefinition() throws Exception {
session = createSession();

InputStream cndStream = getClass().getResourceAsStream("/cnd/orc.cnd");
assertThat(cndStream, is(notNullValue()));
session.getWorkspace().getNodeTypeManager().registerNodeTypes(cndStream, true);

session.getRootNode().addNode("patient", "orc:patient").addNode("patientcase", "orc:patientcase");
session.save();

assertNotNull(session.getNode("/patient/patientcase"));
}

@Test
@FixFor( "MODE-1360" )
public void shouldHandleMultipleConcurrentReadWriteSessions() throws Exception {
Expand Down
13 changes: 13 additions & 0 deletions modeshape-jcr/src/test/resources/cnd/orc.cnd
@@ -0,0 +1,13 @@
<jcr='http://www.jcp.org/jcr/1.0'>
<nt='http://www.jcp.org/jcr/nt/1.0'>
<mix='http://www.jcp.org/jcr/mix/1.0'>
<orc='http://www.orc.org/jcr/orcs/1.0'>

//------------------------------------------------------------------------------
// N O D E T Y P E S
//------------------------------------------------------------------------------
[orc:patient] > nt:unstructured
+ * (orc:patientcase)

[orc:patientcase] > nt:unstructured
- orc:name (string)

0 comments on commit 61d160d

Please sign in to comment.