sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1595208 - /sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java
Date Fri, 16 May 2014 14:21:37 GMT
Author: rombert
Date: Fri May 16 14:21:36 2014
New Revision: 1595208

URL: http://svn.apache.org/r1595208
Log:
SLING-3161 - SlingIDE Import Content wizard should respect .vltignore
files

Added ContentImportTest.importFilesAndFoldersRespectsVltFilters

Modified:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java?rev=1595208&r1=1595207&r2=1595208&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java
(original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/ContentImportTest.java
Fri May 16 14:21:36 2014
@@ -18,6 +18,7 @@ package org.apache.sling.ide.test.impl;
 
 import static org.apache.sling.ide.test.impl.helpers.EclipseResourceMatchers.hasFile;
 import static org.apache.sling.ide.test.impl.helpers.EclipseResourceMatchers.hasFolder;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 import java.io.ByteArrayInputStream;
@@ -36,12 +37,14 @@ import org.eclipse.core.resources.IProje
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.JavaCore;
+import org.hamcrest.CoreMatchers;
 import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 
+
 public class ContentImportTest {
 
     private final LaunchpadConfig config = LaunchpadConfig.getInstance();
@@ -94,6 +97,42 @@ public class ContentImportTest {
         assertThat(contentProject, hasFile("jcr_root/content/test-root/en/files/first.txt",
"first file".getBytes()));
     }
 
+    @Test
+    public void importFilesAndFoldersRespectsVltFilters() throws Exception {
+
+        // 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/content/test-root/en/hello.txt"),
+                new ByteArrayInputStream("hello, world".getBytes()));
+
+        project.createOrUpdateFile(Path.fromPortableString("META-INF/vault/filter.xml"),
getClass()
+                .getResourceAsStream("filter-only-content-test-root-en.xml"));
+
+        // install bundle facet
+        project.installFacet("sling.content", "1.0");
+
+        ServerAdapter server = new ServerAdapter(wstServer.getServer());
+        server.installModule(contentProject);
+
+        // create server-side content
+        RepositoryAccessor repo = new RepositoryAccessor(config);
+        repo.createNode("/content/test-root", "nt:folder");
+        repo.createNode("/content/test-root/de", "nt:folder");
+        repo.createNode("/content/test-root/de/files", "nt:folder");
+        repo.createFile("/content/test-root/de/files/first.txt", "first file".getBytes());
+
+        ImportRepositoryContentAction action = new ImportRepositoryContentAction(wstServer.getServer(),
+                Path.fromPortableString("/content/test-root"), contentProject, Activator.getDefault()
+                        .getSerializationManager());
+        action.run(new NullProgressMonitor());
+
+        assertThat(contentProject.findMember("jcr_root/content/test-root/de"), nullValue());
+    }
+
     @After
     public void cleanUp() throws Exception {
         new RepositoryAccessor(config).tryDeleteResource("/content/test-root");



Mime
View raw message