Author: bdelacretaz
Date: Tue May 20 08:51:03 2008
New Revision: 658294
URL: http://svn.apache.org/viewvc?rev=658294&view=rev
Log:
SLING-467 - Move HttpTestBase integration test utility to commons/testing
Added:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/
- copied from r658272,
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/commons/testing/integration/
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
(with props)
Removed:
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/commons/testing/integration/
incubator/sling/trunk/launchpad/webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/helpers/HttpAnyMethod.java
Modified:
incubator/sling/trunk/commons/testing/pom.xml
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java
incubator/sling/trunk/launchpad/webapp/pom.xml
incubator/sling/trunk/parent/pom.xml
incubator/sling/trunk/scripting/javascript/pom.xml
Modified: incubator/sling/trunk/commons/testing/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/pom.xml?rev=658294&r1=658293&r2=658294&view=diff
==============================================================================
--- incubator/sling/trunk/commons/testing/pom.xml (original)
+++ incubator/sling/trunk/commons/testing/pom.xml Tue May 20 08:51:03 2008
@@ -66,6 +66,30 @@
</dependency>
<dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>compile</scope>
+ <exclusions>
+ <!--
+ Same problem as JCR-683: commons-httpclient depends on
commons-logging. Since
+ this webapp uses log4j (see the slf4j-log4j12 dependency
below), we need to
+ override this dependency with jcl104-over-sflf4j, found
below
+ -->
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
Added:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java?rev=658294&view=auto
==============================================================================
---
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
(added)
+++
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
Tue May 20 08:51:03 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.commons.testing.integration;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+
+/** Allows any HTTP method for HtttpClient */
+public class HttpAnyMethod extends HttpMethodBase {
+ private final String methodName;
+
+ public HttpAnyMethod(String methodName, String uri) {
+ super(uri);
+ this.methodName = methodName;
+ }
+
+ @Override
+ public String getName() {
+ return methodName;
+ }
+}
Propchange:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpAnyMethod.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev URL
Modified:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java?rev=658294&r1=658272&r2=658294&view=diff
==============================================================================
---
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
(original)
+++
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
Tue May 20 08:51:03 2008
@@ -32,13 +32,12 @@
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.sling.launchpad.webapp.integrationtest.helpers.HttpAnyMethod;
-import org.apache.sling.servlets.post.SlingPostConstants;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;
@@ -58,6 +57,8 @@
public static final String CONTENT_TYPE_CSS = "text/css";
public static final String SLING_RESOURCE_TYPE = "sling:resourceType";
+
+ public static final String SLING_POST_SERVLET_CREATE_SUFFIX = "/";
protected SlingIntegrationTestClient testClient;
protected HttpClient httpClient;
@@ -83,7 +84,7 @@
}
testText = "This is a test node " + System.currentTimeMillis();
properties.put("text", testText);
- nodeUrl = testClient.createNode(parentPath +
SlingPostConstants.DEFAULT_CREATE_SUFFIX, properties);
+ nodeUrl = testClient.createNode(parentPath +
SLING_POST_SERVLET_CREATE_SUFFIX, properties);
resourceType = properties.get(SLING_RESOURCE_TYPE);
scriptPath = "/apps/" + (resourceType == null ? "nt/unstructured"
: resourceType);
testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
Modified:
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java?rev=658294&r1=658272&r2=658294&view=diff
==============================================================================
---
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java
(original)
+++
incubator/sling/trunk/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java
Tue May 20 08:51:03 2008
@@ -34,7 +34,6 @@
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
-import org.apache.sling.launchpad.webapp.integrationtest.helpers.HttpAnyMethod;
/** Client functions to interact with Sling in integration tests */
public class SlingIntegrationTestClient {
@@ -44,7 +43,7 @@
this.httpClient = client;
}
- /** Upload a file to the microsling repository
+ /** Upload a file to the Sling repository
* @return the HTTP status code
*/
public int upload(String toUrl, InputStream is) throws IOException {
@@ -53,7 +52,7 @@
return httpClient.executeMethod(put);
}
- /** Delete a file from the microsling repository
+ /** Delete a file from the Sling repository
* @return the HTTP status code
*/
public int delete(String url) throws IOException {
@@ -101,10 +100,10 @@
return createNode(url, nodeProperties, null, false);
}
- /** Create a node under given path, using a POST to microsling
+ /** Create a node under given path, using a POST to Sling
* @param url under which node is created
* @param multiPart if true, does a multipart POST
- * @return the URL that microsling provides to display the node
+ * @return the URL that Sling provides to display the node
*/
public String createNode(String url, Map<String,String>
clientNodeProperties, Map<String,String> requestHeaders,boolean multiPart)
throws IOException {
Modified: incubator/sling/trunk/launchpad/webapp/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/webapp/pom.xml?rev=658294&r1=658293&r2=658294&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/webapp/pom.xml (original)
+++ incubator/sling/trunk/launchpad/webapp/pom.xml Tue May 20 08:51:03 2008
@@ -421,6 +421,20 @@
</dependency>
<dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.testing</artifactId>
+ <version>2.0.0-incubator-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.json</artifactId>
+ <version>2.0.0-incubator-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.eclipse.equinox.http</groupId>
<artifactId>servlet</artifactId>
<version>1.0.0-v20070606</version>
Modified: incubator/sling/trunk/parent/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/parent/pom.xml?rev=658294&r1=658293&r2=658294&view=diff
==============================================================================
--- incubator/sling/trunk/parent/pom.xml (original)
+++ incubator/sling/trunk/parent/pom.xml Tue May 20 08:51:03 2008
@@ -557,6 +557,12 @@
</dependency>
<dependency>
+ <groupId>rhino</groupId>
+ <artifactId>js</artifactId>
+ <version>1.6R6</version>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.0</version>
Modified: incubator/sling/trunk/scripting/javascript/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript/pom.xml?rev=658294&r1=658293&r2=658294&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/javascript/pom.xml (original)
+++ incubator/sling/trunk/scripting/javascript/pom.xml Tue May 20 08:51:03 2008
@@ -116,7 +116,6 @@
<dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
- <version>1.6R6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>