mirror of
https://github.com/apache/archiva.git
synced 2025-02-22 18:31:43 +00:00
fix deployment and mkcol unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fc087e3f5e
commit
9a0d520266
@ -34,10 +34,12 @@
|
||||
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 @@ protected WebResponse getWebResponse( WebRequest webRequest ) //, boolean follow
|
||||
|
||||
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 static class PutMethodWebRequest
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
|
||||
import com.gargoylesoftware.htmlunit.HttpMethod;
|
||||
import com.gargoylesoftware.htmlunit.WebRequest;
|
||||
|
||||
import java.net.URL;
|
||||
@ -37,8 +38,5 @@ public MkColMethodWebRequest( String urlString )
|
||||
super( new URL( urlString ) );
|
||||
}
|
||||
|
||||
public String getMethod()
|
||||
{
|
||||
return "MKCOL";
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user