Author: rombert
Date: Wed May 21 12:05:19 2014
New Revision: 1596547
URL: http://svn.apache.org/r1596547
Log:
SLING-3590 - Exception when processing reordering of content nodes for
partial coverage aggregates
Added:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
(with props)
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
(with props)
Modified:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrPartialCoverageAggregatesDeploymentTest.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
Modified:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrPartialCoverageAggregatesDeploymentTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrPartialCoverageAggregatesDeploymentTest.java?rev=1596547&r1=1596546&r2=1596547&view=diff
==============================================================================
---
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrPartialCoverageAggregatesDeploymentTest.java
(original)
+++
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrPartialCoverageAggregatesDeploymentTest.java
Wed May 21 12:05:19 2014
@@ -121,6 +121,61 @@ public class JcrPartialCoverageAggregate
}
+ @Test
+ public void deployNodeWithChildrenAndOrderableNodeTypes() throws Exception
{
+
+ wstServer.waitForServerToStart();
+
+ // create faceted project
+ IProject contentProject = projectRule.getProject();
+
+ ProjectAdapter project = new ProjectAdapter(contentProject);
+ project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
+
+ // create a sling:Folder at /content/test-root
+
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/.content.xml"),
getClass()
+ .getResourceAsStream("sling-folder-nodetype.xml"));
+
+ // create a nt:unstructured at /content/test-root/nested
+
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/.content.xml"),
+
getClass().getResourceAsStream("nt-unstructured-nodetype.xml"));
+
+ // create a nt:unstructured at /content/test-root/nested/nested
+
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/nested/.content.xml"),
+
getClass().getResourceAsStream("nt-unstructured-nodetype.xml"));
+
+ // install content facet
+ project.installFacet("sling.content", "1.0");
+
+ ServerAdapter server = new ServerAdapter(wstServer.getServer());
+ server.installModule(contentProject);
+
+ Matcher<Node> postConditions =
allOf(hasPath("/content/test-root/nested"), hasPrimaryType("nt:unstructured"),
+ hasChildrenCount(1));
+
+ final RepositoryAccessor repo = new RepositoryAccessor(config);
+ Poller poller = new Poller();
+ poller.pollUntil(new Callable<Node>() {
+ @Override
+ public Node call() throws RepositoryException {
+ return repo.getNode("/content/test-root/nested");
+
+ }
+ }, postConditions);
+
+ // update jcr:title for /content/test-root
+
project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/test-root/nested/.content.xml"),
+
getClass().getResourceAsStream("nt-unstructured-nodetype-with-title.xml"));
+
+ poller.pollUntil(new Callable<Node>() {
+ @Override
+ public Node call() throws RepositoryException {
+ return repo.getNode("/content/test-root/nested");
+
+ }
+ }, allOf(hasPath("/content/test-root/nested"), hasChildrenCount(1),
hasPropertyValue("jcr:title", "Some Folder")));
+ }
+
@After
public void cleanup() throws Exception {
Added:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml?rev=1596547&view=auto
==============================================================================
---
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
(added)
+++
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
Wed May 21 12:05:19 2014
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:vlt="http://www.day.com/jcr/vault/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="nt:unstructured"
+ jcr:title="Some Folder">
+</jcr:root>
\ No newline at end of file
Propchange:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype-with-title.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml?rev=1596547&view=auto
==============================================================================
---
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
(added)
+++
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
Wed May 21 12:05:19 2014
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:vlt="http://www.day.com/jcr/vault/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ jcr:primaryType="nt:unstructured">
+</jcr:root>
\ No newline at end of file
Propchange:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-nodetype.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified:
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java?rev=1596547&r1=1596546&r2=1596547&view=diff
==============================================================================
---
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
(original)
+++
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/AddOrUpdateNodeCommand.java
Wed May 21 12:05:19 2014
@@ -159,6 +159,13 @@ public class AddOrUpdateNodeCommand exte
private void reorderChildNodes(Node node, ResourceProxy resource2) throws
RepositoryException {
ListIterator<ResourceProxy> coveredResourceChildren =
getCoveredChildren(resource2).listIterator();
+
+ // do not process
+ if (!coveredResourceChildren.hasNext()) {
+ Activator.getDefault().getPluginLogger()
+ .trace("Resource at {0} has no covered children, child
node reordering", resource2.getPath());
+ return;
+ }
List<Node> nodeChildren = new LinkedList<Node>();
NodeIterator nodeChildrenIt = node.getNodes();
while (nodeChildrenIt.hasNext()) {