[Httpunit-commit] CVS: httpunit/src/com/meterware/servletunit InvocationContextFactory.java,1.2,1.3
Brought to you by:
russgold
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit In directory usw-pr-cvs1:/tmp/cvs-serv9683/src/com/meterware/servletunit Modified Files: InvocationContextFactory.java InvocationContextImpl.java ServletRunner.java ServletUnitClient.java ServletUnitWebResponse.java Log Message: Support link.click and form.submit Index: InvocationContextFactory.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/InvocationContextFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InvocationContextFactory.java 4 Feb 2002 22:33:55 -0000 1.2 +++ InvocationContextFactory.java 1 Aug 2002 14:58:59 -0000 1.3 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * - * Copyright (c) 2001, Russell Gold + * Copyright (c) 2001-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -38,6 +38,6 @@ /** * Creates and returns a new invocation context to test calling of servlet methods. **/ - public InvocationContext newInvocation( WebRequest request, Cookie[] clientCookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException; + public InvocationContext newInvocation( ServletUnitClient client, WebRequest request, Cookie[] clientCookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException; } Index: InvocationContextImpl.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/InvocationContextImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- InvocationContextImpl.java 23 Jun 2002 23:52:39 -0000 1.6 +++ InvocationContextImpl.java 1 Aug 2002 14:58:59 -0000 1.7 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2001, Russell Gold +* Copyright (c) 2001-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -93,7 +93,7 @@ if (session != null && session.isNew()) { _response.addCookie( new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() ) ); } - _webResponse = new ServletUnitWebResponse( _target, _requestURL, _response ); + _webResponse = new ServletUnitWebResponse( _client, _target, _requestURL, _response ); } return _webResponse; } @@ -130,10 +130,11 @@ * Constructs a servlet invocation context for a specified servlet container, * request, and cookie headers. **/ - InvocationContextImpl( ServletRunner runner, WebRequest request, Cookie[] cookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException { - _application = runner.getApplication(); - _requestURL = request.getURL(); - _target = request.getTarget(); + InvocationContextImpl( ServletUnitClient client, ServletRunner runner, WebRequest request, Cookie[] cookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException { + _client = client; + _application = runner.getApplication(); + _requestURL = request.getURL(); + _target = request.getTarget(); _request = new ServletUnitHttpRequest( _application.getServletRequest( _requestURL ), request, runner.getContext(), clientHeaders, messageBody ); @@ -149,6 +150,8 @@ //------------------------------ private members --------------------------------------- + + private ServletUnitClient _client; private WebApplication _application; private ServletUnitHttpRequest _request; Index: ServletRunner.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletRunner.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ServletRunner.java 23 Jun 2002 23:52:39 -0000 1.17 +++ ServletRunner.java 1 Aug 2002 14:58:59 -0000 1.18 @@ -185,8 +185,8 @@ private ServletUnitContext _context; private InvocationContextFactory _factory = new InvocationContextFactory() { - public InvocationContext newInvocation( WebRequest request, Cookie[] clientCookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException { - return new InvocationContextImpl( ServletRunner.this, request, clientCookies, clientHeaders, messageBody ); + public InvocationContext newInvocation( ServletUnitClient client, WebRequest request, Cookie[] clientCookies, Dictionary clientHeaders, byte[] messageBody ) throws IOException, MalformedURLException { + return new InvocationContextImpl( client, ServletRunner.this, request, clientCookies, clientHeaders, messageBody ); } }; Index: ServletUnitClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitClient.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ServletUnitClient.java 23 Jun 2002 23:52:39 -0000 1.6 +++ ServletUnitClient.java 1 Aug 2002 14:58:59 -0000 1.7 @@ -72,7 +72,7 @@ public InvocationContext newInvocation( WebRequest request ) throws IOException, MalformedURLException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeMessageBody( request, baos ); - return _invocationContextFactory.newInvocation( request, getCookies(), this.getHeaderFields(), baos.toByteArray() ); + return _invocationContextFactory.newInvocation( this, request, getCookies(), this.getHeaderFields(), baos.toByteArray() ); } Index: ServletUnitWebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitWebResponse.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ServletUnitWebResponse.java 6 Mar 2002 04:59:52 -0000 1.9 +++ ServletUnitWebResponse.java 1 Aug 2002 14:58:59 -0000 1.10 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -52,8 +52,8 @@ * @param url the url from which the response was received * @param response the response populated by the servlet **/ - ServletUnitWebResponse( String target, URL url, HttpServletResponse response ) throws IOException { - super( target, url ); + ServletUnitWebResponse( ServletUnitClient client, String target, URL url, HttpServletResponse response ) throws IOException { + super( client, target, url ); _response = (ServletUnitHttpResponse) response; defineRawInputStream( new ByteArrayInputStream( _response.getContents() ) ); } |