RepositoryNodeTypeManager implements ChangeSetListener, NodeTypes.Supplier { List<JcrNodeType> registerNodeTypes( Iterable<NodeTypeDefinition> nodeTypeDefns ) throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, RepositoryException { return registerNodeTypes(nodeTypeDefns, true, false, true); } RepositoryNodeTypeManager( JcrRepository.RunningState repository,
                               boolean includeColumnsForInheritedProperties,
                               boolean includePseudoColumnsInSelectStar ); @Override NodeTypes getNodeTypes(); @Override void notify( ChangeSet changeSet ); @Override String toString();  }
@Test @FixFor( "MODE-1807" ) public void shouldAllowOverridingChildDefinitionWithSubtypeOfOriginalDefinition() throws Exception { InputStream cndStream = getClass().getResourceAsStream("/cnd/orc.cnd"); assertThat(cndStream, is(notNullValue())); nodeTypeManager().registerNodeTypes(cndStream, true); }
@Test @FixFor( "MODE-1857" ) public void shouldAllowOverridingOfPropertyDefinitions() throws Exception { InputStream cnd = getClass().getClassLoader().getResourceAsStream("cnd/overridingPropertyDefinition.cnd"); assertThat(cnd, is(notNullValue())); session.getWorkspace().getNodeTypeManager().registerNodeTypes(cnd, true); Node car = session.getRootNode().addNode("car", "car"); car.setProperty("engine", "4CYL"); Node cycle = session.getRootNode().addNode("cycle", "motorcycle"); cycle.setProperty("engine", "2CYL"); session.save(); try { car.setProperty("engine", "2CYL"); fail("Should not have allowed setting the 'engine' property on a node of type 'car' to \"2CYL\""); } catch (ConstraintViolationException e) { } try { cycle.setProperty("engine", "4CYL"); fail("Should not have allowed setting the 'engine' property on a node of type 'car' to \"2CYL\""); } catch (ConstraintViolationException e) { } }
@Test @FixFor( "MODE-1857" ) public void shouldAllowOverridingOfPropertyDefinitionsWithResidualDefinitions() throws Exception { InputStream cnd = getClass().getClassLoader().getResourceAsStream("cnd/overridingPropertyDefinitionWithResidual.cnd"); assertThat(cnd, is(notNullValue())); session.getWorkspace().getNodeTypeManager().registerNodeTypes(cnd, true); Node car = session.getRootNode().addNode("car", "car"); car.setProperty("engine", "4CYL"); Node cycle = session.getRootNode().addNode("cycle", "motorcycle"); cycle.setProperty("engine", "2CYL"); session.save(); try { car.setProperty("engine", "2CYL"); fail("Should not have allowed setting the 'engine' property on a node of type 'car' to \"2CYL\""); } catch (ConstraintViolationException e) { } try { cycle.setProperty("engine", "4CYL"); fail("Should not have allowed setting the 'engine' property on a node of type 'car' to \"2CYL\""); } catch (ConstraintViolationException e) { } }