You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/02/13 08:54:04 UTC
svn commit: r627300 - in /incubator/sling/trunk/launchpad:
launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java
launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java
Author: cziegeler
Date: Tue Feb 12 23:54:03 2008
New Revision: 627300
URL: http://svn.apache.org/viewvc?rev=627300&view=rev
Log:
SLING-244: Apply patch from Tobias Bocanegra for fixing order of execution for moves.
Added:
incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java (with props)
Modified:
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java
Modified: incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java?rev=627300&r1=627299&r2=627300&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java (original)
+++ incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/ujax/UjaxPostProcessor.java Tue Feb 12 23:54:03 2008
@@ -287,8 +287,8 @@
public void run() {
try {
processDeletes();
- processMoves();
processContent();
+ processMoves();
if (session.hasPendingChanges()) {
session.save();
}
@@ -316,7 +316,11 @@
if (path.startsWith("/")) {
return path;
}
- return rootPath + "/" + path;
+ if (currentPath == null) {
+ return rootPath + "/" + path;
+ } else {
+ return currentPath + "/" + path;
+ }
}
/**
Added: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java?rev=627300&view=auto
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java (added)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java Tue Feb 12 23:54:03 2008
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.ujax;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.sling.launchpad.webapp.integrationtest.HttpTestBase;
+
+/** Test node move via the MicrojaxPostServlet */
+public class PostServletMoveTest extends HttpTestBase {
+ public static final String TEST_BASE_PATH = "/ujax-tests";
+ private String testPath;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ testPath = TEST_BASE_PATH + "/" + System.currentTimeMillis();
+ }
+
+ public void testMoveNodeAbsolute() throws IOException {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("text", "Hello");
+ testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
+
+ props.clear();
+ props.put("ujax:moveSrc", testPath + "/src");
+ props.put("ujax:moveDest", testPath + "/dest");
+ testClient.createNode(HTTP_BASE_URL + testPath, props);
+ String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
+ assertJavascript("Hello", content, "out.println(data.text)");
+ }
+
+ public void testMoveNodeRelative() throws IOException {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("text", "Hello");
+ testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
+
+ props.clear();
+ props.put("ujax:moveSrc", "src");
+ props.put("ujax:moveDest", "dest");
+ testClient.createNode(HTTP_BASE_URL + testPath, props);
+ String content = getContent(HTTP_BASE_URL + testPath + "/dest.json", CONTENT_TYPE_JSON);
+ assertJavascript("Hello", content, "out.println(data.text)");
+ }
+
+ public void testMoveNodeNew() throws IOException {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("text", "Hello");
+ testClient.createNode(HTTP_BASE_URL + testPath + "/src", props);
+
+ props.clear();
+ props.put("ujax:moveSrc", testPath + "/src");
+ props.put("ujax:moveDest", "new");
+ // special case - need force creation of the new node
+ props.put("jcr:created", "");
+ String newNode = testClient.createNode(HTTP_BASE_URL + testPath + "/*", props);
+ String content = getContent(newNode + "/new.json", CONTENT_TYPE_JSON);
+ assertJavascript("Hello", content, "out.println(data.text)");
+ }
+
+ }
\ No newline at end of file
Propchange: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ujax/PostServletMoveTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url