sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1594914 - in /sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl: ContentDeploymentTest.java file-custom-mimetype.xml
Date Thu, 15 May 2014 13:43:53 GMT
Author: rombert
Date: Thu May 15 13:43:53 2014
New Revision: 1594914

URL: http://svn.apache.org/r1594914
Log:
SLING-3566 - Properties from extended file aggregates are not
synchronized

Add a test to validate that properties from extended file aggregates are
synchronized.

Added:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
  (with props)
Modified:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentDeploymentTest.java

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentDeploymentTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentDeploymentTest.java?rev=1594914&r1=1594913&r2=1594914&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentDeploymentTest.java
(original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentDeploymentTest.java
Thu May 15 13:43:53 2014
@@ -19,6 +19,7 @@ package org.apache.sling.ide.test.impl;
 import static org.apache.sling.ide.test.impl.helpers.jcr.JcrMatchers.hasChildrenCount;
 import static org.apache.sling.ide.test.impl.helpers.jcr.JcrMatchers.hasPath;
 import static org.apache.sling.ide.test.impl.helpers.jcr.JcrMatchers.hasPrimaryType;
+import static org.apache.sling.ide.test.impl.helpers.jcr.JcrMatchers.hasPropertyValue;
 import static org.hamcrest.CoreMatchers.allOf;
 import static org.hamcrest.CoreMatchers.nullValue;
 
@@ -168,13 +169,49 @@ public class ContentDeploymentTest {
                 allOf(hasPath("/test"), hasPrimaryType("sling:Folder"), hasChildrenCount(1)));
     }
 
+    @Test
+    public void deployFileWithAttachedMetadata() throws Exception {
+
+        wstServer.waitForServerToStart();
+
+        // create faceted project
+        IProject contentProject = projectRule.getProject();
+
+        ProjectAdapter project = new ProjectAdapter(contentProject);
+        project.addNatures(JavaCore.NATURE_ID, "org.eclipse.wst.common.project.facet.core.nature");
+
+        project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.esp"), new
ByteArrayInputStream(
+                "// not really javascript".getBytes()));
+
+        // install bundle facet
+        project.installFacet("sling.content", "1.0");
+
+        ServerAdapter server = new ServerAdapter(wstServer.getServer());
+        server.installModule(contentProject);
+
+        // verify that file is created
+        final RepositoryAccessor repo = new RepositoryAccessor(config);
+        Poller poller = new Poller();
+        assertThatNode(repo, poller, "/test/hello.esp", hasPrimaryType("nt:file"));
+
+        InputStream contentXml = getClass().getResourceAsStream("file-custom-mimetype.xml");
+        try {
+            project.createOrUpdateFile(Path.fromPortableString("jcr_root/test/hello.esp.dir/.content.xml"),
contentXml);
+        } finally {
+            IOUtils.closeQuietly(contentXml);
+        }
+
+        assertThatNode(repo, poller, "/test/hello.esp/jcr:content", hasPropertyValue("jcr:mimeType",
"text/javascript"));
+    }
+
     private void assertThatNode(final RepositoryAccessor repo, Poller poller, final String
nodePath, Matcher<Node> matcher)
             throws InterruptedException {
 
         poller.pollUntil(new Callable<Node>() {
             @Override
             public Node call() throws RepositoryException {
-                return repo.getNode(nodePath);
+                Node node = repo.getNode(nodePath);
+                return node;
 
             }
         }, matcher);

Added: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml?rev=1594914&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
(added)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
Thu May 15 13:43:53 2014
@@ -0,0 +1,7 @@
+<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+    jcr:primaryType="nt:file">
+    <jcr:content
+        jcr:lastModifiedBy="admin"
+        jcr:mimeType="text/javascript"
+        jcr:primaryType="nt:resource"/>
+</jcr:root>
\ No newline at end of file

Propchange: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/file-custom-mimetype.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message