Author: rhauch
Date: 2008-08-17 18:12:24 -0400 (Sun, 17 Aug 2008)
New Revision: 436
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
Log:
DNA-203 - Unit tests for dna-example-sequencers don't work
http://jira.jboss.com/jira/browse/DNA-203
This must have regressed when we upgraded to Jackrabbit 1.4.5, but the unit tests for the
examples were apparently not included in the continuous builds. (See DNA-204 for that.)
We're blindly setting the "jcr:primaryType" property (along with all other
properties) on all the nodes, but since that's supplied when creating the node,
resetting the "jcr:primaryType" property is not necessary (and apparently no
longer allowed). Added a check in the StreamSequencerAdapter to skip (re)setting this
property on each node.
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java 2008-08-16
17:53:35 UTC (rev 435)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/StreamSequencerAdapter.java 2008-08-17
22:12:24 UTC (rev 436)
@@ -183,6 +183,7 @@
final PathFactory pathFactory = context.getValueFactories().getPathFactory();
final NamespaceRegistry namespaceRegistry = context.getNamespaceRegistry();
final Path outputNodePath = pathFactory.create(outputNode.getPath());
+ final Name jcrPrimaryTypePropertyName =
context.getValueFactories().getNameFactory().create("jcr:primaryType");
// Iterate over the entries in the output, in Path's natural order (shorter
paths first and in lexicographical order by
// prefix and name)
@@ -223,6 +224,14 @@
for (SequencerOutputMap.PropertyValue property : entry.getPropertyValues())
{
String propertyName = property.getName().getString(namespaceRegistry,
Path.NO_OP_ENCODER);
Object value = property.getValue();
+ if (jcrPrimaryTypePropertyName.equals(property.getName())) {
+ // Skip the primary type property (which is protected in Jackrabbit
1.5)
+ Logger.getLogger(this.getClass()).trace("Skipping property
{0}/{1}={2}",
+ targetNode.getPath(),
+ propertyName,
+ value);
+ continue;
+ }
Logger.getLogger(this.getClass()).trace("Writing property
{0}/{1}={2}", targetNode.getPath(), propertyName, value);
if (value instanceof Boolean) {
targetNode.setProperty(propertyName,
((Boolean)value).booleanValue());