diff options
author | Olivier Lamy <olamy@apache.org> | 2014-01-06 05:31:47 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-01-06 05:31:47 +0000 |
commit | d0bd0ec1189e8f1819059034f5725e2bc6708912 (patch) | |
tree | e71538954d5ad89afbcb3bfe2082bf0ff8bd2bc3 /archiva-modules/archiva-web/archiva-webdav | |
parent | 8ceb67abc93ba1bba058fc447b257941e4be6086 (diff) | |
download | archiva-d0bd0ec1189e8f1819059034f5725e2bc6708912.tar.gz archiva-d0bd0ec1189e8f1819059034f5725e2bc6708912.zip |
take care of http method
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555673 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java | 25 |
1 files changed, 19 insertions, 6 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 8ac5e6bf8..15ac54326 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 @@ -539,15 +539,29 @@ public abstract class AbstractRepositoryServletTestCase protected WebResponse getWebResponse( String path ) throws Exception { + return getWebResponse( new GetMethodWebRequest( "http://localhost" + path ) ); + } + + protected WebResponse getWebResponse( WebRequest webRequest ) + throws Exception + { //WebClient client = newClient(); //client.getPage( "http://localhost:" + port + "/reinit/reload" ); //return client.getPage( "http://localhost:" + port + path ).getWebResponse(); MockHttpServletRequest request = new MockHttpServletRequest(); - request.setRequestURI( path ); + request.setRequestURI( webRequest.getUrl().getPath() ); request.addHeader( "User-Agent", "Apache Archiva unit test" ); - request.setMethod( "GET" ); + + request.setMethod( webRequest.getHttpMethod().name() ); + + /* + if (webRequest.getHttpMethod() == HttpMethod.PUT) + { + request.set + } */ + final MockHttpServletResponse response = execute( request ); return new WebResponse( null, null, 1 ) { @@ -580,8 +594,8 @@ public abstract class AbstractRepositoryServletTestCase public String getContentAsString() throws UnsupportedEncodingException { - String errorMessage = getErrorMessage(); - return ( errorMessage != null ) ? errorMessage: super.getContentAsString(); + String errorMessage = getErrorMessage(); + return ( errorMessage != null ) ? errorMessage : super.getContentAsString(); } }; this.unauthenticatedRepositoryServlet.service( request, response ); @@ -612,7 +626,6 @@ public abstract class AbstractRepositoryServletTestCase { super( new URL( url ), HttpMethod.PUT ); this.url = url; - } @@ -631,7 +644,7 @@ public abstract class AbstractRepositoryServletTestCase public WebResponse getResponse( WebRequest request ) throws Exception { - return abstractRepositoryServletTestCase.getWebResponse( request.getUrl().getPath() ); + return abstractRepositoryServletTestCase.getWebResponse( request ); } public WebResponse getResource( WebRequest request ) |