mirror of https://github.com/apache/archiva.git
take care of http method
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555673 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8ceb67abc9
commit
d0bd0ec118
|
@ -539,15 +539,29 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
protected WebResponse getWebResponse( String path )
|
protected WebResponse getWebResponse( String path )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
return getWebResponse( new GetMethodWebRequest( "http://localhost" + path ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebResponse getWebResponse( WebRequest webRequest )
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
//WebClient client = newClient();
|
//WebClient client = newClient();
|
||||||
//client.getPage( "http://localhost:" + port + "/reinit/reload" );
|
//client.getPage( "http://localhost:" + port + "/reinit/reload" );
|
||||||
//return client.getPage( "http://localhost:" + port + path ).getWebResponse();
|
//return client.getPage( "http://localhost:" + port + path ).getWebResponse();
|
||||||
|
|
||||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||||
request.setRequestURI( path );
|
request.setRequestURI( webRequest.getUrl().getPath() );
|
||||||
request.addHeader( "User-Agent", "Apache Archiva unit test" );
|
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 );
|
final MockHttpServletResponse response = execute( request );
|
||||||
return new WebResponse( null, null, 1 )
|
return new WebResponse( null, null, 1 )
|
||||||
{
|
{
|
||||||
|
@ -580,8 +594,8 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
public String getContentAsString()
|
public String getContentAsString()
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
String errorMessage = getErrorMessage();
|
String errorMessage = getErrorMessage();
|
||||||
return ( errorMessage != null ) ? errorMessage: super.getContentAsString();
|
return ( errorMessage != null ) ? errorMessage : super.getContentAsString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.unauthenticatedRepositoryServlet.service( request, response );
|
this.unauthenticatedRepositoryServlet.service( request, response );
|
||||||
|
@ -612,7 +626,6 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
super( new URL( url ), HttpMethod.PUT );
|
super( new URL( url ), HttpMethod.PUT );
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -631,7 +644,7 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
public WebResponse getResponse( WebRequest request )
|
public WebResponse getResponse( WebRequest request )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
return abstractRepositoryServletTestCase.getWebResponse( request.getUrl().getPath() );
|
return abstractRepositoryServletTestCase.getWebResponse( request );
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebResponse getResource( WebRequest request )
|
public WebResponse getResource( WebRequest request )
|
||||||
|
|
Loading…
Reference in New Issue