added test case to validate the existing regex rewrite rule as wired up

This commit is contained in:
Jesse McConnell 2012-10-31 10:24:47 -05:00
parent 6108d0df0c
commit b5fd095055
1 changed files with 14 additions and 0 deletions

View File

@ -77,6 +77,20 @@ public class RewriteHandlerTest extends AbstractRuleTestCase
@Test
public void test() throws Exception
{
_response.setStatus(200);
_request.setHandled(false);
_handler.setOriginalPathAttribute("/before");
_handler.setRewriteRequestURI(true);
_handler.setRewritePathInfo(true);
_request.setRequestURI("/xxx/bar");
_request.setPathInfo("/xxx/bar");
_handler.handle("/xxx/bar",_request,_request, _response);
assertEquals(201,_response.getStatus());
assertEquals("/bar/zzz",_request.getAttribute("target"));
assertEquals("/bar/zzz",_request.getAttribute("URI"));
assertEquals("/bar/zzz",_request.getAttribute("info"));
assertEquals(null,_request.getAttribute("before"));
_response.setStatus(200);
_request.setHandled(false);
_handler.setOriginalPathAttribute("/before");