summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-01-06 05:32:27 +0000
committerOlivier Lamy <olamy@apache.org>2014-01-06 05:32:27 +0000
commit9a0d5202666ce9d274d8aa055461ea2b3f19b58d (patch)
treea0a6e2758d07e9ef95b0856cdf6c91597741aa7e /archiva-modules
parentfc087e3f5ecf5ba27be9a6fc43a31403bc29f926 (diff)
downloadarchiva-9a0d5202666ce9d274d8aa055461ea2b3f19b58d.tar.gz
archiva-9a0d5202666ce9d274d8aa055461ea2b3f19b58d.zip
fix deployment and mkcol unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555677 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java20
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java6
2 files changed, 22 insertions, 4 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
index ed6782e79..c1dbd95b1 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -34,10 +34,12 @@ import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest;
import org.apache.archiva.webdav.util.MavenIndexerCleaner;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
@@ -520,6 +522,18 @@ public abstract class AbstractRepositoryServletTestCase
request.setMethod( webRequest.getHttpMethod().name() );
+ if (webRequest.getHttpMethod() == HttpMethod.PUT )
+ {
+ PutMethodWebRequest putRequest = PutMethodWebRequest.class.cast( webRequest );
+ request.setContentType( putRequest.contentType );
+ request.setContent( IOUtils.toByteArray( putRequest.inputStream ) );
+ }
+
+ if ( webRequest instanceof MkColMethodWebRequest )
+ {
+ request.setMethod( "MKCOL" );
+ }
+
final MockHttpServletResponse response = execute( request );
if ( response.getStatus() == HttpServletResponse.SC_MOVED_PERMANENTLY
@@ -594,11 +608,17 @@ public abstract class AbstractRepositoryServletTestCase
{
String url;
+ InputStream inputStream;
+
+ String contentType;
+
public PutMethodWebRequest( String url, InputStream inputStream, String contentType )
throws Exception
{
super( new URL( url ), HttpMethod.PUT );
this.url = url;
+ this.inputStream = inputStream;
+ this.contentType = contentType;
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java
index 40c62b6cf..383585374 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/httpunit/MkColMethodWebRequest.java
@@ -20,6 +20,7 @@ package org.apache.archiva.webdav.httpunit;
*/
+import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.WebRequest;
import java.net.URL;
@@ -37,8 +38,5 @@ public class MkColMethodWebRequest
super( new URL( urlString ) );
}
- public String getMethod()
- {
- return "MKCOL";
- }
+
}