Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E28B17DA2 for ; Wed, 1 Oct 2014 20:09:55 +0000 (UTC) Received: (qmail 18743 invoked by uid 500); 1 Oct 2014 20:09:50 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 18679 invoked by uid 500); 1 Oct 2014 20:09:50 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 18670 invoked by uid 99); 1 Oct 2014 20:09:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2014 20:09:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2014 20:09:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BB3BC23888FE; Wed, 1 Oct 2014 20:09:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1628826 - in /sling/trunk/tooling/ide: eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java Date: Wed, 01 Oct 2014 20:09:25 -0000 To: commits@sling.apache.org From: rombert@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141001200925.BB3BC23888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rombert Date: Wed Oct 1 20:09:25 2014 New Revision: 1628826 URL: http://svn.apache.org/r1628826 Log: SLING-3990 - Content Navigator does not correctly escape os names for nodes with special characters Fix and tests. Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java?rev=1628826&r1=1628825&r2=1628826&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java (original) +++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/JcrNodeCreationTest.java Wed Oct 1 20:09:25 2014 @@ -130,6 +130,33 @@ public class JcrNodeCreationTest { assertThat(project, hasFile("/jcr_root/content/test-root/holder/org.apache.sling.SomeComponent.xml")); } + @Test + public void createUnstructuredNodeWithSpecialName() throws Exception { + + JcrNode contentNode = syncDirNode.getNode("/content/test-root"); + contentNode.createChild("sling:stuff", "nt:unstructured"); + + assertThat(projectRule.getProject(), hasFile("/jcr_root/content/test-root/_sling_stuff/.content.xml")); + } + + @Test + public void createFullCoverageNodeWithSpecialName() throws Exception { + + JcrNode contentNode = syncDirNode.getNode("/content/test-root"); + contentNode.createChild("sling:stuff", "sling:OsgiConfig"); + + assertThat(projectRule.getProject(), hasFile("/jcr_root/content/test-root/_sling_stuff.xml")); + } + + @Test + public void createSlingFolderNodeWithSpecialName() throws Exception { + + JcrNode contentNode = syncDirNode.getNode("/content/test-root"); + contentNode.createChild("sling:stuff", "sling:Folder"); + + assertThat(projectRule.getProject(), hasFile("/jcr_root/content/test-root/_sling_stuff/.content.xml")); + } + @After public void cleanup() throws Exception { new RepositoryAccessor(config).tryDeleteResource("/content/test-root"); Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java?rev=1628826&r1=1628825&r2=1628826&view=diff ============================================================================== --- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java (original) +++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/nav/model/JcrNode.java Wed Oct 1 20:09:25 2014 @@ -49,6 +49,7 @@ import org.apache.sling.ide.filter.Filte import org.apache.sling.ide.log.Logger; import org.apache.sling.ide.serialization.SerializationKind; import org.apache.sling.ide.serialization.SerializationKindManager; +import org.apache.sling.ide.serialization.SerializationManager; import org.apache.sling.ide.transport.NodeTypeRegistry; import org.apache.sling.ide.transport.Repository; import org.apache.sling.ide.transport.RepositoryException; @@ -844,6 +845,8 @@ public class JcrNode implements IAdaptab String thisNodeType = getPrimaryType(); final SerializationKind parentSk = getSerializationKind(thisNodeType); final SerializationKind childSk = getSerializationKind(childNodeType); + + final SerializationManager serializationManager = Activator.getDefault().getSerializationManager(); if (parentSk==SerializationKind.METADATA_FULL) { createDomChild(childNodeName, childNodeType); @@ -891,7 +894,7 @@ public class JcrNode implements IAdaptab } } else if ((parentSk == SerializationKind.FOLDER || parentSk == SerializationKind.METADATA_PARTIAL) && childSk == SerializationKind.METADATA_FULL) { - createVaultFile((IFolder)resource, childNodeName+".xml", childNodeType); + createVaultFile((IFolder) resource, serializationManager.getOsPath(childNodeName) + ".xml", childNodeType); } else if (parentSk==SerializationKind.FOLDER && childSk==SerializationKind.METADATA_PARTIAL) { // createVaultFile((IFolder)resource, childNodeName+".xml", childNodeType); @@ -901,7 +904,7 @@ public class JcrNode implements IAdaptab public void run(IProgressMonitor monitor) throws CoreException { IFolder f = (IFolder)resource; IFolder newFolder = null; - newFolder = f.getFolder(childNodeName); + newFolder = f.getFolder(serializationManager.getOsPath(childNodeName)); newFolder.create(true, true, new NullProgressMonitor()); createVaultFile(newFolder, ".content.xml", childNodeType); }