[dna-commits] DNA SVN: r1029 - in trunk/dna-repository/src: test/java/org/jboss/dna/repository/sequencer and 1 other directory.
dna-commits at lists.jboss.org
dna-commits at lists.jboss.org
Wed Jun 10 11:01:21 EDT 2009
Author: rhauch
Date: 2009-06-10 11:01:21 -0400 (Wed, 10 Jun 2009)
New Revision: 1029
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
Log:
DNA-443 Java sequencer is not saving content correctly
Corrected a JavaDoc error and removed unused import in a test case.
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java
===================================================================
--- trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-06-10 14:53:55 UTC (rev 1028)
+++ trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapter.java 2009-06-10 15:01:21 UTC (rev 1029)
@@ -212,7 +212,7 @@
* Save the sequencing output to the supplied node. This method does not need to save the output, as that is done by the
* caller of this method.
*
- * @param outputNode the existing node onto (or below) which the output is to be written; never null
+ * @param nodePath the existing node onto (or below) which the output is to be written; never null
* @param output the (immutable) sequencing output; never null
* @param context the execution context for this sequencing operation; never null
* @param builtPaths a set of the paths that have already been created but not submitted in this batch
@@ -267,7 +267,8 @@
Path path = factories.getPathFactory().create(input.getLocation().getPath());
Set<org.jboss.dna.graph.property.Property> props = new HashSet<org.jboss.dna.graph.property.Property>(
- input.getPropertiesByName().values());
+ input.getPropertiesByName()
+ .values());
props = Collections.unmodifiableSet(props);
String mimeType = getMimeType(context, sequencedProperty, path.getLastSegment().getName().getLocalName());
return new StreamSequencerContext(context.getExecutionContext(), path, props, mimeType, problems);
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-06-10 14:53:55 UTC (rev 1028)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-06-10 15:01:21 UTC (rev 1029)
@@ -37,7 +37,6 @@
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jboss.dna.common.collection.Problems;
@@ -530,16 +529,16 @@
problems);
assertThat(sequencerContext.getMimeType(), is("text/plain"));
}
-
- private Name nameFor(String raw) {
+
+ private Name nameFor( String raw ) {
return context.getValueFactories().getNameFactory().create(raw);
}
-
+
@Test
public void shouldNotCreateExtraNodesWhenSavingOutput() throws Exception {
SequencerOutputMap output = new SequencerOutputMap(context.getValueFactories());
Map<Name, Property> props;
-
+
/*
* Create several output properties and make sure the resulting graph
* does not contain duplicate nodes
@@ -549,38 +548,38 @@
output.setProperty("a/b", "property2", "value2");
output.setProperty("a/b[2]", "property1", "value1");
output.setProperty("a/b[2]/c", "property1", "value1");
-
+
Set<Path> builtPaths = new HashSet<Path>();
sequencer.saveOutput("/", output, seqContext, builtPaths);
seqContext.getDestination().submit();
-
+
Node rootNode = graph.getNodeAt("/");
assertThat(rootNode.getChildren().size(), is(1));
-
+
Node nodeA = graph.getNodeAt("/a");
props = nodeA.getPropertiesByName();
assertThat(nodeA.getChildren().size(), is(2));
- assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
+ assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
assertThat(props.get(nameFor("property1")).getFirstValue().toString(), is("value1"));
Node nodeB = graph.getNodeAt("/a/b[1]");
props = nodeB.getPropertiesByName();
-
- assertThat(props.size(), is(3)); // Need to add one to account for dna:uuid
+
+ assertThat(props.size(), is(3)); // Need to add one to account for dna:uuid
assertThat(props.get(nameFor("property1")).getFirstValue().toString(), is("value1"));
assertThat(props.get(nameFor("property2")).getFirstValue().toString(), is("value2"));
Node nodeB2 = graph.getNodeAt("/a/b[2]");
props = nodeB2.getPropertiesByName();
-
- assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
+
+ assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
assertThat(props.get(nameFor("property1")).getFirstValue().toString(), is("value1"));
Node nodeC = graph.getNodeAt("/a/b[2]/c");
props = nodeC.getPropertiesByName();
-
- assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
+
+ assertThat(props.size(), is(2)); // Need to add one to account for dna:uuid
assertThat(props.get(nameFor("property1")).getFirstValue().toString(), is("value1"));
}
More information about the dna-commits
mailing list