You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/09/29 17:51:04 UTC
svn commit: r1705883 - in
/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl:
JcrContentContentProviderTest.java nt-unstructured-with-folder-child.xml
Author: rombert
Date: Tue Sep 29 15:51:04 2015
New Revision: 1705883
URL: http://svn.apache.org/viewvc?rev=1705883&view=rev
Log:
SLING-4988 - Not all folders are displayed in Project Explorer
Added ignored
JcrContentContentProviderTest.listChildrenOnNtFolderIncludedUnderJcrContentNode
Added:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-with-folder-child.xml
Modified:
sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrContentContentProviderTest.java
Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrContentContentProviderTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrContentContentProviderTest.java?rev=1705883&r1=1705882&r2=1705883&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrContentContentProviderTest.java (original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrContentContentProviderTest.java Tue Sep 29 15:51:04 2015
@@ -31,6 +31,7 @@ import org.eclipse.core.resources.IFolde
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
import org.hamcrest.CoreMatchers;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -166,6 +167,46 @@ public class JcrContentContentProviderTe
Object[] children2 = contentProvider.getChildren(contentNode);
assertChildrenHavePaths(children2, "/content/child1.txt", "/content/child2.txt");
}
+
+ @Test
+ @Ignore("SLING-4998")
+ public void listChildrenOnNtFolderIncludedUnderJcrContentNode() throws Exception {
+
+ // create faceted project
+ IProject contentProject = projectRule.getProject();
+
+ ProjectAdapter project = new ProjectAdapter(contentProject);
+ project.addNatures("org.eclipse.wst.common.project.facet.core.nature");
+
+ // install content facet
+ project.installFacet("sling.content", "1.0");
+
+ // create .content.xml structure
+ project.createOrUpdateFile(Path.fromPortableString("jcr_root/content/.content.xml"),
+ getClass().getResourceAsStream("nt-unstructured-with-folder-child.xml")); // TODO - rename xml file
+
+ project.ensureDirectoryExists(Path.fromPortableString("jcr_root/content/_jcr_content/first-folder/second-folder"));
+
+ // instantiate the content provider
+ JcrContentContentProvider contentProvider = new JcrContentContentProvider();
+
+ // directly create the root node
+ SyncDir syncDirNode = new SyncDir((IFolder) contentProject.findMember("jcr_root"));
+
+ // test children of '/'
+ Object[] children = contentProvider.getChildren(syncDirNode);
+ assertChildrenHavePaths(children, "/content");
+
+ // test children of '/content'
+ JcrNode contentNode = (JcrNode) children[0];
+ Object[] children2 = contentProvider.getChildren(contentNode);
+ assertChildrenHavePaths(children2, "/content/jcr:content");
+
+ // test children of '/content/first-child'
+ JcrNode folderNode = (JcrNode) children2[0];
+ Object[] children3 = contentProvider.getChildren(folderNode);
+ assertChildrenHavePaths(children3, "/content/jcr:content/first-folder");
+ }
private void assertChildrenHavePaths(Object[] children, String... paths) {
assertThat("Unexpected number of children found", children.length, CoreMatchers.equalTo(paths.length));
Added: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-with-folder-child.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-with-folder-child.xml?rev=1705883&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-with-folder-child.xml (added)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/nt-unstructured-with-folder-child.xml Tue Sep 29 15:51:04 2015
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+-->
+<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="sling:Folder">
+ <jcr:content jcr:primaryType="nt:unstructured">
+ <first-folder/>
+ </jcr:content>
+</jcr:root>
\ No newline at end of file