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 2014/10/11 00:18:00 UTC

svn commit: r1631002 - in /sling/trunk/tooling/ide: eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/ eclipse-test/src/org/apache/sling/ide/test/impl/

Author: rombert
Date: Fri Oct 10 22:17:59 2014
New Revision: 1631002

URL: http://svn.apache.org/r1631002
Log:
SLING-4025 - Investigate fully deploying content packages on server
startup/module deployment

Allow a content module to be fully published if deployed when the server
is started.

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

Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java?rev=1631002&r1=1631001&r2=1631002&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java (original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.java Fri Oct 10 22:17:59 2014
@@ -80,8 +80,6 @@ public class SlingLaunchpadBehaviour ext
 
     public void start(IProgressMonitor monitor) throws CoreException {
 
-        
-        
         boolean success = false;
         Result<ResourceProxy> result = null;
         monitor.beginTask("Starting server", 5);
@@ -223,12 +221,6 @@ public class SlingLaunchpadBehaviour ext
             }
         } else if (ProjectHelper.isContentProject(module[0].getProject())) {
 
-            if (kind == IServer.PUBLISH_FULL && deltaKind == ServerBehaviourDelegate.ADDED) {
-                logger.trace("Ignoring request to fully publish an added content module");
-                setModulePublishState(module, IServer.PUBLISH_STATE_NONE);
-                return;
-            }
-
             try {
                 publishContentModule(kind, deltaKind, module, monitor);
                 BundleStateHelper.resetBundleState(getServer(), module[0].getProject());

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=1631002&r1=1631001&r2=1631002&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 Fri Oct 10 22:17:59 2014
@@ -30,7 +30,6 @@ import java.io.InputStream;
 import java.util.concurrent.Callable;
 
 import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
 
 import org.apache.commons.httpclient.HttpException;
@@ -197,8 +196,8 @@ public class ContentDeploymentTest {
         assertThatNode(repo, poller, "/test/hello.esp/jcr:content", hasPropertyValue("jcr:mimeType", "text/javascript"));
     }
 
-    @Test(expected = PathNotFoundException.class)
-    public void deployFileBeforeModuleDeploymentIsIgnored() throws Throwable {
+    @Test
+    public void fileDeployedBeforeAddingModuleToServerIsPublished() throws Throwable {
 
         wstServer.waitForServerToStart();
 
@@ -220,18 +219,12 @@ public class ContentDeploymentTest {
         // verify that file is created
         final RepositoryAccessor repo = new RepositoryAccessor(config);
         Poller poller = new Poller();
-        try {
-            poller.pollUntil(new Callable<Node>() {
-                @Override
-                public Node call() throws RepositoryException {
-                    return repo.getNode("/test/hello.txt");
-                }
-            }, nullValue(Node.class));
-        } catch (RuntimeException e) {
-            // unwrap the underlying repository exception, since the poller does not do that
-            if (e.getCause() != null)
-                throw e.getCause();
-        }
+        poller.pollUntil(new Callable<Node>() {
+            @Override
+            public Node call() throws RepositoryException {
+                return repo.getNode("/test/hello.txt");
+            }
+        }, hasFileContent("hello, world"));
 
     }
 

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=1631002&r1=1631001&r2=1631002&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 Oct 10 22:17:59 2014
@@ -96,6 +96,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.createNode("/content/test-root/en", "nt:folder");
@@ -129,6 +131,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.createNode("/content/test-root/de", "nt:folder");
@@ -161,6 +165,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.createNode("/content/test-root/en", "nt:folder");
@@ -196,6 +202,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.createNode("/content/test-root/en", "nt:folder");
@@ -241,6 +249,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.tryDeleteResource("/content/test-root");
@@ -308,6 +318,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.doWithSession(new SessionRunnable<Void>() {
@@ -352,6 +364,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         // create server-side content
         RepositoryAccessor repo = new RepositoryAccessor(config);
         repo.createNode("/content/test-root/en", "nt:folder");
@@ -359,6 +373,9 @@ public class ContentImportTest {
         repo.createFile("/content/test-root/en/files/first.txt", "first file".getBytes());
         repo.createFile("/content/test-root/en/files/second.txt", "second file".getBytes());
 
+        // delete file since it was deployed when the module was added to the server
+        repo.tryDeleteResource("/content/test-root/hello.txt");
+
         // run initial import
         runImport(contentProject);
 
@@ -395,6 +412,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         repo.createNode("/content/test-root/folder", "sling:Folder");
         repo.createNode("/content/test-root/folder/jcr:content", "nt:unstructured");
         repo.createFile("/content/test-root/folder/jcr:content/some_file.txt", "dummy contents".getBytes());
@@ -447,6 +466,8 @@ public class ContentImportTest {
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.installModule(contentProject);
 
+        deh.clearUnexpectedEventsAfterSettling();
+
         repo.createFile("/content/test-root/sling:file", "some_content".getBytes());
 
         runImport(contentProject);