Author: rombert
Date: Mon May 26 09:20:56 2014
New Revision: 1597537
URL: http://svn.apache.org/r1597537
Log:
SLING-3081 - Do not re-publish modules when starting the launchpad for
the first time
Prevent full publishing of content modules when first added + add test.
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
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=1597537&r1=1597536&r2=1597537&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
Mon May 26 09:20:56 2014
@@ -172,6 +172,12 @@ 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=1597537&r1=1597536&r2=1597537&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
Mon May 26 09:20:56 2014
@@ -29,6 +29,7 @@ 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;
@@ -195,6 +196,44 @@ 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 {
+
+ 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.txt"),
new ByteArrayInputStream(
+ "hello, world".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();
+ 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();
+ }
+
+ }
+
private void assertThatNode(final RepositoryAccessor repo, Poller poller,
final String nodePath, Matcher<Node> matcher)
throws InterruptedException {