Author: rombert Date: Thu Feb 19 13:43:17 2015 New Revision: 1660881 URL: http://svn.apache.org/r1660881 Log: SLING-3781 - Fix unstable Eclipse-based tests
Ensure that when a deleted resource is turned into an update ( see SLING-3741 ) the parents are created if needed. Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/SlingLaunchpadBehaviour.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=1660881&r1=1660880&r2=1660881&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 Thu Feb 19 13:43:17 2015 @@ -424,7 +424,13 @@ public class SlingLaunchpadBehaviour ext execute(command); break; case IModuleResourceDelta.REMOVED: - execute(removeFileCommand(repository, resourceDelta.getModuleResource())); + Command<?> removeCmd = removeFileCommand(repository, resourceDelta.getModuleResource()); + if (removeCmd != null && isAddOrUpdateCommand(removeCmd)) { + ensureParentIsPublished(resourceDelta.getModuleResource(), repository, allResources, + handledPaths); + addedOrUpdatedResources.add(resourceDelta.getModuleResource()); + } + execute(removeCmd); break; } } @@ -459,6 +465,11 @@ public class SlingLaunchpadBehaviour ext // setServerPublishState(IServer.PUBLISH_STATE_NONE); } + private boolean isAddOrUpdateCommand(Command<?> removeCmd) { + // TODO - this is fragile and lacks extensibility + return removeCmd.getClass().getName().endsWith("AddOrUpdateNodeCommand"); + } + /** * Ensures that the parent of this resource has been published to the repository *