You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(11) |
Nov
(97) |
Dec
(35) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(55) |
Mar
(21) |
Apr
(3) |
May
(7) |
Jun
(25) |
Jul
(108) |
Aug
(23) |
Sep
|
Oct
|
Nov
|
Dec
(4) |
2006 |
Jan
|
Feb
|
Mar
(6) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(13) |
Feb
|
Mar
(257) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(38) |
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(63) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Tim P <ti...@us...> - 2008-11-04 22:58:49
|
Update of /cvsroot/webmacro/webmacro/lib In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10319 Added Files: ant-1.7.0.jar Removed Files: ant.jar Log Message: Upgrade ant --- ant.jar DELETED --- --- NEW FILE: ant-1.7.0.jar --- (This appears to be a binary file; contents omitted.) |
From: Tim P <ti...@us...> - 2008-11-04 22:11:35
|
Update of /cvsroot/webmacro/webmacro/test In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31432/test Modified Files: build.xml Log Message: Delete test output Index: build.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/build.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** build.xml 4 Nov 2008 21:18:11 -0000 1.15 --- build.xml 4 Nov 2008 22:11:28 -0000 1.16 *************** *** 36,39 **** --- 36,40 ---- <delete dir="${unit.reports}"/> <delete file='LoadReport.html'/> + <delete file='controls.html'/> <delete file='LoadReportRelease2Features.html'/> <delete file='PerformanceReport.html'/> |
From: Tim P <ti...@us...> - 2008-11-04 21:43:29
|
Update of /cvsroot/webmacro/webmacro In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26374 Modified Files: build.xml Log Message: Increment version Index: build.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/build.xml,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** build.xml 20 Mar 2008 21:11:59 -0000 1.50 --- build.xml 4 Nov 2008 21:42:47 -0000 1.51 *************** *** 43,47 **** </target> ! <property name="version" value="2.0" /> <property name="wm-style" value="classic" /> <!-- can be "minimal" to get webmacro.defaults.minimal into build--> <property name="app.name" value="webmacro" /> --- 43,47 ---- </target> ! <property name="version" value="2.1" /> <property name="wm-style" value="classic" /> <!-- can be "minimal" to get webmacro.defaults.minimal into build--> <property name="app.name" value="webmacro" /> |
From: Tim P <ti...@us...> - 2008-11-04 21:18:15
|
Update of /cvsroot/webmacro/webmacro/test In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22026/test Modified Files: build.xml Log Message: Cleanup Index: build.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/build.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** build.xml 23 Oct 2005 17:22:23 -0000 1.14 --- build.xml 4 Nov 2008 21:18:11 -0000 1.15 *************** *** 36,40 **** <delete dir="${unit.reports}"/> <delete file='LoadReport.html'/> ! <delete file='LoadReport.html'/> <delete file='PerformanceReport.html'/> <delete file='ecomm.html'/> --- 36,40 ---- <delete dir="${unit.reports}"/> <delete file='LoadReport.html'/> ! <delete file='LoadReportRelease2Features.html'/> <delete file='PerformanceReport.html'/> <delete file='ecomm.html'/> |
From: Tim P <ti...@us...> - 2008-11-04 20:59:16
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18410/test/unit/org/webmacro/template Modified Files: TemplateTestCase.java Log Message: Replace assertTrue(false) idiom with fail Index: TemplateTestCase.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TemplateTestCase.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** TemplateTestCase.java 18 Mar 2008 22:36:36 -0000 1.22 --- TemplateTestCase.java 4 Nov 2008 20:59:05 -0000 1.23 *************** *** 131,135 **** executeStringTemplate(template); if (result == null) ! assertTrue(_context.get("assertEvaluationEquals") == null); else assertTrue(result.toString(), result.equals(_context.get("assertEvaluationEquals"))); --- 131,135 ---- executeStringTemplate(template); if (result == null) ! assertNull(_context.get("assertEvaluationEquals")); else assertTrue(result.toString(), result.equals(_context.get("assertEvaluationEquals"))); *************** *** 138,145 **** protected void showError(String templateName, String resultText, String result) { ! System.err.println("/" + templateName + "/ does not " + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); - assertTrue(false); } --- 138,144 ---- protected void showError(String templateName, String resultText, String result) { ! fail("/" + templateName + "/ does not " + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); } *************** *** 183,193 **** catch (Exception e) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); - e.printStackTrace(); - assertTrue(false); } if (result == null) --- 182,191 ---- catch (Exception e) { ! e.printStackTrace(); ! fail("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); } if (result == null) *************** *** 196,203 **** if (result.equals(resultText) != equals) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, " + (equals ? "" : " not ")+ "expecting /" + resultText + "/"); - assertTrue(false); } } --- 194,200 ---- if (result.equals(resultText) != equals) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, " + (equals ? "" : " not ")+ "expecting /" + resultText + "/"); } } *************** *** 245,259 **** if (caught == null) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + exceptionClass); - assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting " + exceptionClass); - assertTrue(false); } else if (messageMatchText != null) --- 242,254 ---- if (caught == null) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + exceptionClass); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! fail("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting " + exceptionClass); } else if (messageMatchText != null) *************** *** 262,269 **** if (!re.match(caught.getMessage())) { ! System.err.println("Exception " + caught.getMessage() + " does not match /" + messageMatchText + "/"); - assertTrue(false); } } --- 257,263 ---- if (!re.match(caught.getMessage())) { ! fail("Exception " + caught.getMessage() + " does not match /" + messageMatchText + "/"); } } *************** *** 296,304 **** catch (Exception e) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "/, expecting match /" + resultPattern + "/"); - e.printStackTrace(System.err); - assertTrue(false); } if (result == null) --- 290,297 ---- catch (Exception e) { ! e.printStackTrace(System.err); ! fail("Execution of /" + templateText + "/" + " threw " + e.getClass() + "/, expecting match /" + resultPattern + "/"); } if (result == null) *************** *** 308,315 **** if (!re.match(result)) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); - assertTrue(false); } } --- 301,307 ---- if (!re.match(result)) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); } } *************** *** 331,338 **** if (!(caught instanceof PropertyException)) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); - assertTrue(false); } else --- 323,329 ---- if (!(caught instanceof PropertyException)) { ! fail("Execution of /" + templateText + "/" + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); } else *************** *** 343,359 **** if (caught == null) { ! System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + "PropertyException with caught exception " + exceptionClass); - assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! System.err.println("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting throw " + "PropertyException with caught exception " + exceptionClass); - assertTrue(false); } } --- 334,348 ---- if (caught == null) { ! fail("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + "PropertyException with caught exception " + exceptionClass); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { ! fail("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting throw " + "PropertyException with caught exception " + exceptionClass); } } |
From: Tim P <ti...@us...> - 2008-11-04 20:58:28
|
Update of /cvsroot/webmacro/webmacro In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18212 Modified Files: pom.xml Log Message: Test has stopped working since last run Index: pom.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/pom.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pom.xml 2 Apr 2008 18:43:39 -0000 1.11 --- pom.xml 4 Nov 2008 20:58:16 -0000 1.12 *************** *** 251,254 **** --- 251,256 ---- <!-- works in eclipse, but not maven --> <exclude>**/TestParseIncludeMacroDistribution.java</exclude> + <!-- works in eclipse, but not maven --> + <exclude>**/TestSetpropsDirective.java</exclude> </excludes> <includes> |
From: Tim P <ti...@us...> - 2008-04-02 18:43:46
|
Update of /cvsroot/webmacro/webmacro In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10641 Modified Files: pom.xml Log Message: Exclude examples from cobertura Index: pom.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/pom.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pom.xml 18 Mar 2008 22:47:35 -0000 1.10 --- pom.xml 2 Apr 2008 18:43:39 -0000 1.11 *************** *** 254,257 **** --- 254,258 ---- <includes> <include>**/Test*.java</include> + <include>**/*Test.java</include> </includes> </configuration> *************** *** 284,287 **** --- 285,308 ---- <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> + <configuration> + <instrumentation> + <!-- Test source shouldnot be included, but seems to be --> + <excludes> + <exclude>**/CheckConfig.class</exclude> + <exclude>**/GuestBook.class</exclude> + <exclude>**/HelloWorld.class</exclude> + <exclude>**/NoServlet.class</exclude> + <exclude>**/Sandbox.class</exclude> + <exclude>**/Standalone.class</exclude> + </excludes> + </instrumentation> + </configuration> + <executions> + <execution> + <goals> + <goal>clean</goal> + </goals> + </execution> + </executions> </plugin> </plugins> |
From: Tim P <ti...@us...> - 2008-03-31 20:29:38
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15768/src/org/webmacro/servlet Modified Files: TextTool.java Log Message: Explicitly use file.encoding to encode and decode URLs, no longer return null if decode throws a runtime exception. Index: TextTool.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/TextTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TextTool.java 18 Mar 2008 10:11:56 -0000 1.15 --- TextTool.java 31 Mar 2008 20:29:34 -0000 1.16 *************** *** 26,29 **** --- 26,30 ---- import org.webmacro.ContextTool; import org.webmacro.PropertyException; + import org.webmacro.WebMacroRuntimeException; import java.io.IOException; *************** *** 157,165 **** public static String URLEncode (String input) { ! return input == null ? null : java.net.URLEncoder.encode(input); } /** ! * Decode a URLEncoded <code>input</code> String.<p> * * If <code>input</code> is <code>null</code>, <code>URLEncode()</code> --- 158,175 ---- public static String URLEncode (String input) { ! if (input == null) ! return null; ! try { ! return java.net.URLEncoder.encode(input, System.getProperty( "file.encoding" )); ! } catch (UnsupportedEncodingException e) { ! throw new WebMacroRuntimeException( "WebMacro bug System.file.encoding not supported", e ); ! } } /** ! * Decode a URLEncoded <code>input</code> String. ! * Assumes that the URL was encoded with URLEncode above. ! * ! * <p> * * If <code>input</code> is <code>null</code>, <code>URLEncode()</code> *************** *** 170,180 **** public static String URLDecode (String input) { ! try ! { ! return input == null ? null : java.net.URLDecoder.decode(input); ! } ! catch (Exception e) ! { ! return null; } } --- 180,189 ---- public static String URLDecode (String input) { ! if (input == null) ! return null; ! try { ! return java.net.URLDecoder.decode(input, System.getProperty( "file.encoding" )); ! } catch (UnsupportedEncodingException e) { ! throw new WebMacroRuntimeException( "WebMacro bug System.file.encoding not supported", e ); } } |
From: Tim P <ti...@us...> - 2008-03-31 17:32:29
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/directive In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16940/src/org/webmacro/directive Modified Files: IfDirective.java Log Message: Eclipse thinks elsifargs could be null, though we know it could not Index: IfDirective.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/directive/IfDirective.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** IfDirective.java 20 Mar 2008 11:54:42 -0000 1.17 --- IfDirective.java 31 Mar 2008 17:32:21 -0000 1.18 *************** *** 115,119 **** // OK, how about no else-if subdirectives? ! if (elseifCount == 0) { // If condition is static and false -- just return the else block --- 115,119 ---- // OK, how about no else-if subdirectives? ! if (elseifArgs == null) { // If condition is static and false -- just return the else block |
From: Tim P <ti...@us...> - 2008-03-28 20:12:23
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7829/src/org/webmacro/util Modified Files: WMEval.java Log Message: Comment out unused private member out, we actually output to supplied outputs Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** WMEval.java 27 Mar 2008 22:51:17 -0000 1.28 --- WMEval.java 28 Mar 2008 20:12:18 -0000 1.29 *************** *** 77,81 **** private Template currentTemplate; ! private OutputStream out = System.out; private Context context; --- 77,81 ---- private Template currentTemplate; ! //private OutputStream out = System.out; private Context context; *************** *** 89,104 **** //-------constructor(s)----- /** ! * The constructor for WebMacro decorator in a servlet context. * Build a WebMacro environment for currentTemplate execution. */ ! public WMEval(Servlet servlet) { try { ! if (servlet == null) ! wm = new WM(); ! else ! wm = new WM(servlet); ! context = wm.getContext(); ! log = wm.getBroker().getBrokerLog(); } catch (Exception e) { throw new IllegalStateException(e); --- 89,100 ---- //-------constructor(s)----- /** ! * Constructor. * Build a WebMacro environment for currentTemplate execution. */ ! public WMEval() { try { ! wm = new WM(); ! init(); } catch (Exception e) { throw new IllegalStateException(e); *************** *** 107,118 **** /** ! * Constructor. ! * Build a WebMacro environment for currentTemplate execution. */ ! public WMEval() { try { wm = new WM(); ! context = wm.getContext(); } catch (Exception e) { throw new IllegalStateException(e); --- 103,114 ---- /** ! * Build a WebMacro environment to evaluate a template given it's name. */ ! public WMEval(String templateName) { try { wm = new WM(); ! init(); ! parseLocalTemplate(templateName); } catch (Exception e) { throw new IllegalStateException(e); *************** *** 121,132 **** /** ! * Build a WebMacro environment to evaluate a template given it's name. */ ! public WMEval(String templateName) { try { ! wm = new WM(); ! context = wm.getContext(); ! parseLocalTemplate(templateName); } catch (Exception e) { throw new IllegalStateException(e); --- 117,131 ---- /** ! * The constructor for WebMacro decorator in a servlet context. ! * Build a WebMacro environment for currentTemplate execution. */ ! public WMEval(Servlet servlet) { try { ! if (servlet == null) ! wm = new WM(); ! else ! wm = new WM(servlet); ! init(); } catch (Exception e) { throw new IllegalStateException(e); *************** *** 134,137 **** --- 133,140 ---- } + private void init() { + context = wm.getContext(); + log = wm.getBroker().getBrokerLog(); + } /** * Return the settings associated with this WebMacro instance. *************** *** 251,258 **** * @param out The new output stream for any output during currentTemplate evaluation. */ ! public void setOutputStream (OutputStream out) ! { ! this.out = out; ! } /** --- 254,261 ---- * @param out The new output stream for any output during currentTemplate evaluation. */ ! //public void setOutputStream (OutputStream out) ! //{ ! // this.out = out; ! //} /** |
From: Tim P <ti...@us...> - 2008-03-28 20:10:25
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7033/test/unit/org/webmacro/servlet/test Added Files: JettyWebTestCase.java InvokeExampleServletsTest.java Log Message: Initial version --- NEW FILE: InvokeExampleServletsTest.java --- /* * $Source: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet/test/InvokeExampleServletsTest.java,v $ * $Revision: 1.1 $ * * Copyright (C) 2008 Tim Pizey * * Part of Melati (http://melati.org), a framework for the rapid * development of clean, maintainable web applications. * * Melati is free software; Permission is granted to copy, distribute * and/or modify this software under the terms either: * * a) the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version, * * or * * b) any version of the Melati Software License, as published * at http://melati.org * * You should have received a copy of the GNU General Public License and * the Melati Software License along with this program; * if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA to obtain the * GNU General Public License and visit http://melati.org to obtain the * Melati Software License. * * Feel free to contact the Developers of Melati (http://melati.org), * if you would like to work out a different arrangement than the options * outlined here. It is our intention to allow Melati to be used by as * wide an audience as possible. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Contact details for copyright holder: * * Tim Pizey <timp At paneris.org> * http://paneris.org/~timp */ package org.webmacro.servlet.test; /** * @author timp * @since 18 Mar 2008 * */ public class InvokeExampleServletsTest extends JettyWebTestCase { /** * Constructor. * * @param name */ public InvokeExampleServletsTest(String name) { super(name); } /** * {@inheritDoc} */ protected void setUp () throws Exception { super.setUp(); } /** * {@inheritDoc} */ protected void tearDown () throws Exception { super.tearDown(); } public void testInvokeHelloWorld () throws Exception { beginAt("/servlet/HelloWorld"); assertTextPresent("WebMacro is working!"); } public void testInvokeCheckConfig () throws Exception { beginAt("/servlet/CheckConfig"); assertTextPresent("WebMacro Configuration"); } public void testInvokeGuestBook () throws Exception { beginAt("/servlet/GuestBook"); assertTextPresent("GuestBook Example"); } public void testInvokeStandalone () throws Exception { beginAt("/servlet/Standalone"); assertTextPresent("WebMacro \"Standalone\" example"); } } --- NEW FILE: JettyWebTestCase.java --- package org.webmacro.servlet.test; import org.mortbay.jetty.Server; import org.mortbay.jetty.webapp.WebAppContext; import net.sourceforge.jwebunit.junit.WebTestCase; /** * * Much thanks to * http://today.java.net/pub/a/today/2007/04/12/embedded-integration-testing-of-web-applications.html * * Run as an application and try http://localhost:8080/wmtest/index.html * or extend for your htmlunit tests. * * @author timp * @since 2008/03/18 * */ public abstract class JettyWebTestCase extends WebTestCase { private static Server server; private static String contextName = "wmtest"; private static String webRoot ="examples"; /** * Constructor. */ public JettyWebTestCase() { super(); } /** * Constructor, with name. * @param name */ public JettyWebTestCase(String name) { super(name); } protected void setUp() throws Exception { // Port 0 means "assign arbitrarily port number" server = new Server(0); startServer(); // getLocalPort returns the port that was actually assigned int actualPort = server.getConnectors()[0].getLocalPort(); getTestContext().setBaseUrl( "http://localhost:" + actualPort + "/" ); } private static void startServer() throws Exception { WebAppContext wac = new WebAppContext( webRoot, "/" + contextName); org.mortbay.resource.FileResource.setCheckAliases(false); server.addHandler(wac); server.start(); wac.dumpUrl(); } protected void tearDown() throws Exception { super.tearDown(); } /** * If you don't know by now. * @param args * @throws Exception */ public static void main(String[] args) throws Exception { server = new Server(8080); startServer(); } /** * Just to say hello. */ public void testIndex() { beginAt("/index.html"); assertTextPresent("Hello World"); } /** * {@inheritDoc} * @see net.sourceforge.jwebunit.junit.WebTestCase#beginAt(java.lang.String) */ public void beginAt(String url) { super.beginAt(contextUrl(url)); } /** * {@inheritDoc} * @see net.sourceforge.jwebunit.junit.WebTestCase#gotoPage(java.lang.String) */ public void gotoPage(String url) { super.gotoPage(contextUrl(url)); } protected String contextUrl(String url) { return "/" + contextName + url; } } |
From: Tim P <ti...@us...> - 2008-03-28 20:10:20
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6970/test/unit/org/webmacro/servlet/test Log Message: Directory /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet/test added to the repository |
From: Tim P <ti...@us...> - 2008-03-28 20:10:15
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6970/test/unit/org/webmacro/servlet Log Message: Directory /cvsroot/webmacro/webmacro/test/unit/org/webmacro/servlet added to the repository |
From: Tim P <ti...@us...> - 2008-03-28 20:09:54
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6603/test/unit/org/webmacro/util/test Modified Files: WMEvalTest.java Added Files: WMEvalTest.wm MockHttpServletResponse.java MockHttpServletRequest.java MockServletConfig.java MockServletContext.java Log Message: Mocks --- NEW FILE: MockServletConfig.java --- /** * */ package org.webmacro.util.test; import java.util.Enumeration; import java.util.Hashtable; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; /** * @author timp * */ public class MockServletConfig implements ServletConfig { private MockServletContext context = null; private String name; /** * Constructor. * @param servletContext * @param servletName */ public MockServletConfig(MockServletContext servletContext, String servletName) { context = servletContext; name = servletName; } /** * Constructor. */ public MockServletConfig() { context = new MockServletContext(); name = "mockServlet"; } /** * {@inheritDoc} * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String) */ public String getInitParameter(String arg0) { return (String)initParameters.get(arg0); } /** * {@inheritDoc} * @see javax.servlet.ServletConfig#getInitParameterNames() */ public Enumeration getInitParameterNames() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } /** * {@inheritDoc} * @see javax.servlet.ServletConfig#getServletContext() */ public ServletContext getServletContext() { return context; } /** * {@inheritDoc} * @see javax.servlet.ServletConfig#getServletName() */ public String getServletName() { return name; } Hashtable initParameters = new Hashtable(); /** * @param name of parameter * @param value of parameter */ public void setInitParameter(String name, String value) { initParameters.put(name, value); } /** * @param string name to set */ public void setServletName(String string) { name = string; } } --- NEW FILE: MockHttpServletResponse.java --- /** * */ package org.webmacro.util.test; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.Locale; import javax.servlet.ServletOutputStream; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; /** * @author timp * @since 2006/12/05 */ public class MockHttpServletResponse implements HttpServletResponse { public void addCookie(Cookie arg0) { } public boolean containsHeader(String arg0) { return false; } public String encodeURL(String arg0) { return null; } public String encodeRedirectURL(String arg0) { return null; } public String encodeUrl(String arg0) { return null; } public String encodeRedirectUrl(String arg0) { return null; } public void sendError(int arg0, String arg1) throws IOException { } public void sendError(int arg0) throws IOException { } public void sendRedirect(String arg0) throws IOException { } public void setDateHeader(String arg0, long arg1) { } public void addDateHeader(String arg0, long arg1) { } public void setHeader(String arg0, String arg1) { } public void addHeader(String arg0, String arg1) { } public void setIntHeader(String arg0, int arg1) { } public void addIntHeader(String arg0, int arg1) { } public void setStatus(int arg0) { } public void setStatus(int arg0, String arg1) { } public String getCharacterEncoding() { return "ISO-8859-1"; } ByteArrayOutputStream bout = new ByteArrayOutputStream(); public ServletOutputStream getOutputStream() throws IOException { return new ServletOutputStream() { public void println(String arg0) throws IOException { super.println(arg0); } public void write(int b) throws IOException { bout.write(b); } }; } /** * @return what was written */ public String getWritten() { return bout.toString(); } public PrintWriter getWriter() throws IOException { return new PrintWriter(getOutputStream()); } public void setContentLength(int arg0) { } String contentType; public void setContentType(String type) { contentType = type; } public void setBufferSize(int arg0) { } public int getBufferSize() { return 0; } public void flushBuffer() throws IOException { } public void resetBuffer() { } public boolean isCommitted() { return false; } public void reset() { } public void setLocale(Locale arg0) { } public Locale getLocale() { return null; } public String getContentType() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } public void setCharacterEncoding(String charset) { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now? " + charset); } } Index: WMEvalTest.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util/test/WMEvalTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WMEvalTest.java 21 Mar 2008 08:35:21 -0000 1.2 --- WMEvalTest.java 28 Mar 2008 20:09:48 -0000 1.3 *************** *** 1,6 **** --- 1,16 ---- package org.webmacro.util.test; + import java.io.ByteArrayOutputStream; + import java.io.FileInputStream; + + import javax.servlet.Servlet; + import javax.servlet.http.HttpServletResponse; + + import org.webmacro.Broker; import org.webmacro.Context; import org.webmacro.Template; + import org.webmacro.WM; + import org.webmacro.servlet.TemplateServlet; + import org.webmacro.servlet.WebContext; import org.webmacro.util.Settings; import org.webmacro.util.WMEval; *************** *** 17,20 **** --- 27,33 ---- { + // FIXME Hardcoded path to tests + private static final String PATH_TO_TESTS = "test/unit/"; + /** * @param name *************** *** 43,48 **** * Test method for {@link org.webmacro.util.WMEval#WMEval(javax.servlet.Servlet)}. */ ! public void testWMEvalServlet() { ! } --- 56,78 ---- * Test method for {@link org.webmacro.util.WMEval#WMEval(javax.servlet.Servlet)}. */ ! public void testWMEvalServlet() throws Exception { ! TemplateServlet ts = new TemplateServlet(); ! ts.init(new MockServletConfig()); ! WMEval it = new WMEval(ts); ! it.getCurrentContext().put("o", "b"); ! assertEquals("b",it.getCurrentContext().get("o")); ! it.getNewContext(); ! assertNull(it.getCurrentContext().get("o")); ! } ! ! /** ! * Test method for {@link org.webmacro.util.WMEval#WMEval(javax.servlet.Servlet)}. ! */ ! public void testWMEvalServletNull() throws Exception { ! WMEval it = new WMEval((Servlet)null); ! it.getCurrentContext().put("o", "b"); ! assertEquals("b",it.getCurrentContext().get("o")); ! it.getNewContext(); ! assertNull(it.getCurrentContext().get("o")); } *************** *** 72,77 **** */ public void testGetLog() { ! assertNull(new WMEval().getLog()); ! } --- 102,106 ---- */ public void testGetLog() { ! assertEquals(new WMEval().getLog(), new WMEval((Servlet)null).getLog()); } *************** *** 79,84 **** * Test method for {@link org.webmacro.util.WMEval#init(java.io.InputStream)}. */ ! public void testInit() { ! } --- 108,115 ---- * Test method for {@link org.webmacro.util.WMEval#init(java.io.InputStream)}. */ ! public void testInit() throws Exception { ! WMEval it = new WMEval(); ! it.init(new FileInputStream(PATH_TO_TESTS + "org/webmacro/util/test/WMEvalTest.wm")); ! assertEquals("Hi!", it.eval(new Context())); } *************** *** 87,91 **** */ public void testError() { ! } --- 118,123 ---- */ public void testError() { ! WMEval it = new WMEval(); ! it.error("See TemplateServlet", new RuntimeException("Maybe it could go?")); } *************** *** 105,108 **** --- 137,145 ---- */ public void testGetNewContextHttpServletRequestHttpServletResponse() { + WMEval it = new WMEval(); + it.getCurrentContext().put("o", "b"); + assertEquals("b",it.getCurrentContext().get("o")); + it.getNewContext(new MockHttpServletRequest(), new MockHttpServletResponse()); + assertNull(it.getCurrentContext().get("o")); } *************** *** 165,170 **** public void testEval() throws Exception { WMEval it = new WMEval("org/webmacro/util/test/WMEvalTest.wm"); ! assertEquals("Hi!", it.eval(new Context())); ! } --- 202,206 ---- public void testEval() throws Exception { WMEval it = new WMEval("org/webmacro/util/test/WMEvalTest.wm"); ! assertEquals("Hi!", it.eval()); } *************** *** 172,176 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context)}. */ ! public void testEvalContext() { } --- 208,217 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context)}. */ ! public void testEvalContext() throws Exception { ! WM wm = new WM(); ! Template t = wm.getTemplate("org/webmacro/util/test/WMEvalTest.wm"); ! WMEval it = new WMEval(); ! it.setCurrentTemplate(t); ! assertEquals("Hi!", it.eval(new Context())); } *************** *** 179,184 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.io.OutputStream)}. */ ! public void testEvalContextStringOutputStream() { ! } --- 220,228 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.io.OutputStream)}. */ ! public void testEvalContextStringOutputStream() throws Exception { ! ByteArrayOutputStream out = new ByteArrayOutputStream(); ! assertEquals("Hi!", new WMEval().eval(new Context(), ! "org/webmacro/util/test/WMEvalTest.wm", out)); ! assertEquals("Hi!", out.toString()); } *************** *** 186,191 **** * Test method for {@link org.webmacro.util.WMEval#eval(java.lang.String)}. */ ! public void testEvalString() { ! } --- 230,235 ---- * Test method for {@link org.webmacro.util.WMEval#eval(java.lang.String)}. */ ! public void testEvalString() throws Exception { ! assertEquals("Hi!", new WMEval().eval("org/webmacro/util/test/WMEvalTest.wm")); } *************** *** 193,198 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.servlet.WebContext, java.lang.String, javax.servlet.http.HttpServletResponse)}. */ ! public void testEvalWebContextStringHttpServletResponse() { ! } --- 237,247 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.servlet.WebContext, java.lang.String, javax.servlet.http.HttpServletResponse)}. */ ! public void testEvalWebContextStringHttpServletResponse() throws Exception { ! WMEval it = new WMEval(); ! HttpServletResponse response = new MockHttpServletResponse(); ! assertEquals("Hi!", it.eval( ! new WebContext(Broker.getBroker(), new MockHttpServletRequest(), response), ! "org/webmacro/util/test/WMEvalTest.wm", ! response)); } *************** *** 200,205 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, org.webmacro.Template)}. */ ! public void testEvalContextTemplate() { ! } --- 249,256 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, org.webmacro.Template)}. */ ! public void testEvalContextTemplate() throws Exception { ! WM wm = new WM(); ! Template t = wm.getTemplate("org/webmacro/util/test/WMEvalTest.wm"); ! assertEquals("Hi!", new WMEval().eval(new Context(), t)); } *************** *** 207,212 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.io.OutputStream, java.lang.String)}. */ ! public void testEvalContextStringOutputStreamString() { ! } --- 258,263 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.io.OutputStream, java.lang.String)}. */ ! public void testEvalContextStringOutputStreamString() throws Exception { ! assertEquals("Hi!", new WMEval().eval(new Context(), "org/webmacro/util/test/WMEvalTest.wm", "T", false, "UTF-8")); } *************** *** 214,219 **** * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.lang.String, boolean, java.lang.String)}. */ ! public void testEvalContextStringStringBooleanString() { ! } --- 265,275 ---- * Test method for {@link org.webmacro.util.WMEval#eval(org.webmacro.Context, java.lang.String, java.lang.String, boolean, java.lang.String)}. */ ! public void testEvalContextStringStringBooleanString() throws Exception { ! assertEquals("Hi!", new WMEval().eval(new Context(), ! "org/webmacro/util/test/WMEvalTest.wm", null, "UTF-8")); ! Context c = new Context(); ! c.put(WMEval.outputContextKey, "t.tmp"); ! assertEquals("Hi!", new WMEval().eval(c, ! "org/webmacro/util/test/WMEvalTest.wm", null, "UTF-8")); } --- NEW FILE: MockServletContext.java --- /** * */ package org.webmacro.util.test; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; import java.util.Hashtable; import java.util.Set; import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; /** * @author timp * @since 26 Jun 2007 * */ public class MockServletContext implements ServletContext { /** * Introduced in 2.4 * @see javax.servlet.ServletContext#getContextPath() */ public String getContextPath() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } /** * */ public MockServletContext() { } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getAttribute(java.lang.String) */ public Object getAttribute(String name) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getAttributeNames() */ public Enumeration getAttributeNames() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getContext(java.lang.String) */ public ServletContext getContext(String uripath) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getInitParameter(java.lang.String) */ public String getInitParameter(String name) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getInitParameterNames() */ public Enumeration getInitParameterNames() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getMajorVersion() */ public int getMajorVersion() { return 0; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getMimeType(java.lang.String) */ public String getMimeType(String file) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getMinorVersion() */ public int getMinorVersion() { return 0; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String) */ public RequestDispatcher getNamedDispatcher(String name) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getRealPath(java.lang.String) */ public String getRealPath(String path) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String) */ public RequestDispatcher getRequestDispatcher(String path) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getResource(java.lang.String) */ public URL getResource(String path) throws MalformedURLException { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String) */ public InputStream getResourceAsStream(String path) { return null; } /** * @see javax.servlet.ServletContext#getResourcePaths(java.lang.String) */ public Set getResourcePaths(String arg0) { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getServerInfo() */ public String getServerInfo() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getServlet(java.lang.String) */ public Servlet getServlet(String name) throws ServletException { return null; } /** * @see javax.servlet.ServletContext#getServletContextName() */ public String getServletContextName() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getServletNames() */ public Enumeration getServletNames() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#getServlets() */ public Enumeration getServlets() { return null; } /** * {@inheritDoc} * @see javax.servlet.ServletContext#log(java.lang.String) */ public void log(String msg) { } /** * {@inheritDoc} * @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String) */ public void log(Exception exception, String msg) { } /** * {@inheritDoc} * @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable) */ public void log(String message, Throwable throwable) { } /** * {@inheritDoc} * @see javax.servlet.ServletContext#removeAttribute(java.lang.String) */ public void removeAttribute(String name) { } /** * {@inheritDoc} * @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object) */ public void setAttribute(String name, Object object) { } Hashtable expectations = new Hashtable(); /** * @param key * @param value */ public void expectAndReturn(String key, String value) { expectations.put(key, value); } } --- NEW FILE: WMEvalTest.wm --- Hi!#if ($var) #begin $var #end --- NEW FILE: MockHttpServletRequest.java --- /** * */ package org.webmacro.util.test; import java.io.BufferedReader; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.Principal; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Locale; import java.util.Map; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; /** * @author timp * @since 2006/12/05 * */ public class MockHttpServletRequest implements HttpServletRequest { Map parameters = new HashMap(); /** * @param map the parameters */ public void setParameters(Map map) { parameters = map; } public String getAuthType() { return null; } public Cookie[] getCookies() { return null; } public long getDateHeader(String arg0) { return 0; } // Note this is not correct, should be a MultiMap Hashtable headers = new Hashtable(); public String getHeader(String arg0) { return (String)headers.get(arg0); } /** * @param key the header key * @param value the value to set it to */ public void setHeader(String key, String value) { headers.put(key, value); } public Enumeration getHeaders(String arg0) { return headers.elements(); } public Enumeration getHeaderNames() { return headers.keys(); } public int getIntHeader(String arg0) { return -1; } public String getMethod() { return null; } String pathInfo; public String getPathInfo() { return pathInfo; } /** * @param info the info to set */ public void setPathInfo(String info) { pathInfo = info; } public String getPathTranslated() { return null; } public String getContextPath() { return ""; // root context } public String getQueryString() { return null; } public String getRemoteUser() { return null; } public boolean isUserInRole(String arg0) { return false; } public Principal getUserPrincipal() { return null; } public String getRequestedSessionId() { return null; } String requestURI = null; public String getRequestURI() { return requestURI; } /** * @param uri the uri to set */ public void setRequestURI(String uri) { requestURI = uri; } public StringBuffer getRequestURL() { return null; } public String getServletPath() { return "/mockServletPath/"; } Object session; /** * @param s the session to set */ public void setSession(Object s){ session = s; } public HttpSession getSession(boolean arg0) { return (HttpSession)session; } public HttpSession getSession() { return (HttpSession)session; } public boolean isRequestedSessionIdValid() { return false; } public boolean isRequestedSessionIdFromCookie() { return false; } public boolean isRequestedSessionIdFromURL() { return false; } public boolean isRequestedSessionIdFromUrl() { return false; } public Object getAttribute(String arg0) { return null; } public Enumeration getAttributeNames() { return null; } String charEncoding = "ISO-8859-1"; public String getCharacterEncoding() { return charEncoding; } public void setCharacterEncoding(String ce) throws UnsupportedEncodingException { if (ce != null && ce.equals("UnsupportedEncoding")) throw new UnsupportedEncodingException(); charEncoding = ce; } public int getContentLength() { return 0; } public String getContentType() { return null; } public ServletInputStream getInputStream() throws IOException { return null; } /** * Set a parameter. */ public void setParameter(String name, String value) { parameters.put(name, value); } public String getParameter(String arg0) { if (parameters.get(arg0) == null) return null; return (String)parameters.get(arg0); } public Enumeration getParameterNames() { return Collections.enumeration(parameters.keySet()); } public String[] getParameterValues(String key) { return new String[] {(String)parameters.get(key)} ; } public Map getParameterMap() { return parameters; } public String getProtocol() { return null; } String scheme = "http"; /** * @param s the scheme to set */ public void setScheme(String s) { scheme = s; } public String getScheme() { return scheme; } public String getServerName() { return "localhost"; } public int getServerPort() { return 80; } public BufferedReader getReader() throws IOException { return null; } public String getRemoteAddr() { return null; } public String getRemoteHost() { return null; } public void setAttribute(String arg0, Object arg1) { } public void removeAttribute(String arg0) { } public Locale getLocale() { return null; } public Enumeration getLocales() { return null; } public boolean isSecure() { return false; } public RequestDispatcher getRequestDispatcher(String arg0) { return new RequestDispatcher() { public void include(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { } public void forward(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { } }; } public String getRealPath(String arg0) { return "test"; } public String getLocalAddr() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } public String getLocalName() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } public int getLocalPort() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } public int getRemotePort() { throw new RuntimeException("TODO No one else has ever called this method." + " Do you really want to start now?"); } } |
From: Tim P <ti...@us...> - 2008-03-28 00:02:38
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22273/src/org/webmacro Modified Files: WebMacroException.java Log Message: Javadoc typo Index: WebMacroException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/WebMacroException.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** WebMacroException.java 18 Mar 2008 16:14:56 -0000 1.9 --- WebMacroException.java 28 Mar 2008 00:02:30 -0000 1.10 *************** *** 26,30 **** /** * This is the base class of all WebMacro exceptions. You could use it ! * to catch any exception enerated by WebMacro code. */ public class WebMacroException extends RethrowableException --- 26,30 ---- /** * This is the base class of all WebMacro exceptions. You could use it ! * to catch any exception generated by WebMacro code. */ public class WebMacroException extends RethrowableException |
From: Tim P <ti...@us...> - 2008-03-27 22:51:24
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22532/src/org/webmacro/util Modified Files: WMEval.java Log Message: Move methods to improve readability, remove code that cannot be reached as template output encoding is specified in defaults Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** WMEval.java 27 Mar 2008 10:19:35 -0000 1.27 --- WMEval.java 27 Mar 2008 22:51:17 -0000 1.28 *************** *** 284,303 **** /** - * Evaluate the named template against the given context - * and return the result as a String. - * If an output stream is specified, the return value is - * also written out to the stream. - * - * @param templateName The name of the template. - * @param out An optional output stream. - * @return The output from the evaluated template - */ - public String eval (Context context, String templateName, OutputStream out) - throws Exception - { - return eval(context, templateName, out, null); - } - - /** * Evaluates the string template against the current context * and returns the value. --- 284,287 ---- *************** *** 311,342 **** /** ! * Evaluates the string template against a new context and writes ! * it to the http Response output stream using the proper encoding. ! * <p> ! * This is an exceptionally useful method for a servlet to use to ! * write out a template. ! * <p> ! * @param context The WM context to use. * @param templateName The name of the template. ! * @param resp The servlet response from which the encoding will be derived. ! * @return The output from the evaluated template. */ ! public String eval (WebContext context, String templateName, ! HttpServletResponse resp) throws ServletException { ! String value = null; ! try { ! resp.setContentType("text/html"); ! String encoding = wm ! .getConfig(WMConstants.TEMPLATE_OUTPUT_ENCODING); ! if (encoding == null) { ! encoding = resp.getCharacterEncoding(); ! } ! value = eval(context, templateName, resp.getOutputStream(), ! encoding); ! } catch (Exception e) { ! throw new ServletException(e); ! } ! return value; } --- 295,311 ---- /** ! * Evaluate the named template against the given context ! * and return the result as a String. ! * If an output stream is specified, the return value is ! * also written out to the stream. ! * * @param templateName The name of the template. ! * @param out An optional output stream. ! * @return The output from the evaluated template */ ! public String eval (Context context, String templateName, OutputStream out) ! throws Exception { ! return eval(context, templateName, out, null); } *************** *** 381,384 **** --- 350,381 ---- return value; } + /** + * Evaluates the string template against a new context and writes + * it to the http Response output stream using the proper encoding. + * <p> + * This is an exceptionally useful method for a servlet to use to + * write out a template. + * <p> + * @param context The WM context to use. + * @param templateName The name of the template. + * @param resp The servlet response from which the encoding will be derived. + * @return The output from the evaluated template. + */ + public String eval (WebContext context, String templateName, + HttpServletResponse resp) throws ServletException + { + String value = null; + try { + resp.setContentType("text/html"); + String encoding = wm + .getConfig(WMConstants.TEMPLATE_OUTPUT_ENCODING); + value = eval(context, templateName, resp.getOutputStream(), + encoding); + } catch (Exception e) { + throw new ServletException(e); + } + return value; + } + /** *************** *** 396,400 **** public String eval (Context context, String templateName, String outputFileName, boolean append, String encoding) ! throws Exception { OutputStream out = new FileOutputStream(outputFileName, append); --- 393,397 ---- public String eval (Context context, String templateName, String outputFileName, boolean append, String encoding) ! throws Exception { OutputStream out = new FileOutputStream(outputFileName, append); |
From: Tim P <ti...@us...> - 2008-03-27 22:43:40
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/tools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv19109/src/org/webmacro/tools Modified Files: EvalTemplates.java Log Message: Throw Exceptions we have nothing to add to Index: EvalTemplates.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/tools/EvalTemplates.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EvalTemplates.java 15 May 2005 02:51:09 -0000 1.8 --- EvalTemplates.java 27 Mar 2008 22:43:34 -0000 1.9 *************** *** 26,44 **** * Evaluates a single template file argument. * Exceptions are reported to standard error, not thrown. */ ! public void run (String inputTemplate) { System.out.println("Template File=" + inputTemplate); ! try ! { ! String s = wm.eval(wm.getNewContext(), inputTemplate, null, null); ! System.out.println("Template Eval Output:\n" + s); ! ! } ! catch (Exception e) ! { ! System.err.println("Unable to evaluate input."); ! e.printStackTrace(); ! } } --- 26,36 ---- * Evaluates a single template file argument. * Exceptions are reported to standard error, not thrown. + * @throws Exception if anything goes wrong */ ! public void run (String inputTemplate) throws Exception { System.out.println("Template File=" + inputTemplate); ! String s = wm.eval(wm.getNewContext(), inputTemplate, null, null); ! System.out.println("Template Eval Output:\n" + s); } *************** *** 53,71 **** * @param append If true, output will be appended to existing file. * @param encoding The encoding to use on the output file, null allowed. */ public Context run (String inputTemplate, String outFile, boolean append, ! String encoding) { - try - { wm.eval(wm.getNewContext(), inputTemplate, outFile, append, encoding); return wm.getCurrentContext(); - } - catch (Exception e) - { - System.err.println("Unable to evaluate input."); - e.printStackTrace(); - return null; - } } --- 45,55 ---- * @param append If true, output will be appended to existing file. * @param encoding The encoding to use on the output file, null allowed. + * @throws Exception if anything goes wrong */ public Context run (String inputTemplate, String outFile, boolean append, ! String encoding) throws Exception { wm.eval(wm.getNewContext(), inputTemplate, outFile, append, encoding); return wm.getCurrentContext(); } |
From: Tim P <ti...@us...> - 2008-03-27 19:40:13
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7095/src/org/webmacro Modified Files: Template.java Log Message: Javadoc Index: Template.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Template.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Template.java 18 Mar 2008 16:14:56 -0000 1.20 --- Template.java 27 Mar 2008 19:40:03 -0000 1.21 *************** *** 44,50 **** * call the parse() function at an appropriate time. Once a template has * been parsed, subsequent calls to this method do not have an effect. If ! * you want to reparse the template, because you know, it has been changed, you * have to create a new Template object and leave this one to the garbage collector. ! * <p> * @exception TemplateException if the sytax was invalid and we could not recover * @exception IOException if we could not successfullly read the parseTool --- 44,50 ---- * call the parse() function at an appropriate time. Once a template has * been parsed, subsequent calls to this method do not have an effect. If ! * you want to reparse the template, because you know it has been changed, you * have to create a new Template object and leave this one to the garbage collector. ! * * @exception TemplateException if the sytax was invalid and we could not recover * @exception IOException if we could not successfullly read the parseTool |
From: Tim P <ti...@us...> - 2008-03-27 10:22:35
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv11427/src/org/webmacro/util Modified Files: WMEval.java Log Message: Javadoc Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** WMEval.java 27 Mar 2008 09:10:37 -0000 1.26 --- WMEval.java 27 Mar 2008 10:19:35 -0000 1.27 *************** *** 90,94 **** /** * The constructor for WebMacro decorator in a servlet context. ! * Build a web macro environment for currentTemplate execution. */ public WMEval(Servlet servlet) --- 90,94 ---- /** * The constructor for WebMacro decorator in a servlet context. ! * Build a WebMacro environment for currentTemplate execution. */ public WMEval(Servlet servlet) *************** *** 108,112 **** /** * Constructor. ! * Build a web macro environment for currentTemplate execution. */ public WMEval() --- 108,112 ---- /** * Constructor. ! * Build a WebMacro environment for currentTemplate execution. */ public WMEval() |
From: Tim P <ti...@us...> - 2008-03-27 09:45:16
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30353/src/org/webmacro/servlet Modified Files: ServletBroker.java Log Message: Whitespace Index: ServletBroker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/ServletBroker.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ServletBroker.java 31 Oct 2005 02:46:41 -0000 1.13 --- ServletBroker.java 27 Mar 2008 09:45:13 -0000 1.14 *************** *** 91,101 **** } ! public static Broker getBroker (Servlet s, Properties additionalProperties) throws InitException { int minorVersion, majorVersion; ! ServletContext sc = s. ! getServletConfig(). ! getServletContext(); try { --- 91,100 ---- } ! public static Broker getBroker (Servlet s, Properties additionalProperties) ! throws InitException { int minorVersion, majorVersion; ! ServletContext sc = s.getServletConfig().getServletContext(); try { |
From: Tim P <ti...@us...> - 2008-03-27 09:26:35
|
Update of /cvsroot/webmacro/webmacro In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23021 Modified Files: checkstyleSuppressions.xml Log Message: Suppress SimplifyBooleanReturn for Expression Index: checkstyleSuppressions.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/checkstyleSuppressions.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** checkstyleSuppressions.xml 20 Mar 2008 23:49:14 -0000 1.5 --- checkstyleSuppressions.xml 27 Mar 2008 09:26:28 -0000 1.6 *************** *** 102,105 **** --- 102,108 ---- files="DirectiveDescriptor.java" /> + <!-- The way we have it is more expressive --> + <suppress checks="SimplifyBooleanReturn" + files="Expression.java" /> </suppressions> |
From: Tim P <ti...@us...> - 2008-03-27 09:10:41
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16877/src/org/webmacro/util Modified Files: WMEval.java Log Message: Unused import Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** WMEval.java 27 Mar 2008 00:16:27 -0000 1.25 --- WMEval.java 27 Mar 2008 09:10:37 -0000 1.26 *************** *** 25,29 **** import java.io.FileOutputStream; import java.io.InputStream; - import java.io.InputStreamReader; import java.io.OutputStream; --- 25,28 ---- |
From: Tim P <ti...@us...> - 2008-03-27 00:17:38
|
Update of /cvsroot/webmacro/webmacro/examples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv7096/examples Modified Files: GuestBook.java Log Message: Eclipse: field hiding Index: GuestBook.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/examples/GuestBook.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GuestBook.java 17 Mar 2008 12:08:11 -0000 1.10 --- GuestBook.java 27 Mar 2008 00:17:34 -0000 1.11 *************** *** 43,49 **** ArrayList book = new ArrayList(); - String name; - String email; - String comment; GuestEntry myGuestEntry; --- 43,46 ---- *************** *** 59,65 **** // get the form variables output = (String) context.getForm("loadFile"); ! name = (String) context.getForm("name"); ! email = (String) context.getForm("email"); ! comment = (String) context.getForm("comment"); if (output == null) { --- 56,62 ---- // get the form variables output = (String) context.getForm("loadFile"); ! String name = (String) context.getForm("name"); ! String email = (String) context.getForm("email"); ! String comment = (String) context.getForm("comment"); if (output == null) { *************** *** 117,122 **** { name = inName; ! email = inEmail; ! comment = inComment; } --- 114,119 ---- { name = inName; ! this.email = inEmail; ! this.comment = inComment; } |
From: Tim P <ti...@us...> - 2008-03-27 00:16:32
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6695/src/org/webmacro/util Modified Files: WMEval.java Log Message: Null context in destroy, use InputStream Template constructor, format, javadoc Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** WMEval.java 26 Mar 2008 09:52:33 -0000 1.24 --- WMEval.java 27 Mar 2008 00:16:27 -0000 1.25 *************** *** 73,80 **** --- 73,85 ---- //-------private and protected members----- private WebMacro wm; + private Log log; + private Template currentTemplate; + private OutputStream out = System.out; + private Context context; + /** * If an output file is not specified as an argument, it *************** *** 84,153 **** //-------constructor(s)----- ! /** ! * The constructor for WebMacro decorator in a servlet context. ! */ ! public WMEval (Servlet servlet) ! { ! // Build a web macro environment for currentTemplate execution. ! try ! { ! if (servlet == null) ! wm = new WM(); ! else ! wm = new WM(servlet); ! context = wm.getContext(); ! log = wm.getBroker().getBrokerLog(); ! } ! catch (Exception e) ! { ! throw new IllegalStateException(e); ! } ! } ! public WMEval () { ! // Build a web macro environment for currentTemplate execution. ! try ! { ! wm = new WM(); ! context = wm.getContext(); ! } ! catch (Exception e) ! { ! throw new IllegalStateException(e); ! } } ! /** * Build a WebMacro environment to evaluate a template given it's name. */ ! public WMEval (String templateName) { ! try { wm = new WM(); context = wm.getContext(); ! parseLocalTemplate(templateName); ! } ! catch (Exception e) { throw new IllegalStateException(e); } } ! /** * Return the settings associated with this WebMacro instance. */ ! public Settings getSettings() { ! return wm.getBroker().getSettings(); } ! /** * Return the log associated with this instance of WMEval. */ ! public Log getLog() { ! return this.log; } - //-------public initializers/destroyers----- /** --- 89,154 ---- //-------constructor(s)----- ! /** ! * The constructor for WebMacro decorator in a servlet context. ! * Build a web macro environment for currentTemplate execution. ! */ ! public WMEval(Servlet servlet) ! { ! try { ! if (servlet == null) ! wm = new WM(); ! else ! wm = new WM(servlet); ! context = wm.getContext(); ! log = wm.getBroker().getBrokerLog(); ! } catch (Exception e) { ! throw new IllegalStateException(e); ! } ! } ! /** ! * Constructor. ! * Build a web macro environment for currentTemplate execution. ! */ ! public WMEval() { ! try { ! wm = new WM(); ! context = wm.getContext(); ! } catch (Exception e) { ! throw new IllegalStateException(e); ! } } ! /** * Build a WebMacro environment to evaluate a template given it's name. */ ! public WMEval(String templateName) ! { ! try { wm = new WM(); context = wm.getContext(); ! parseLocalTemplate(templateName); ! } catch (Exception e) { throw new IllegalStateException(e); } } ! /** * Return the settings associated with this WebMacro instance. */ ! public Settings getSettings () { ! return wm.getBroker().getSettings(); } ! /** * Return the log associated with this instance of WMEval. */ ! public Log getLog () { ! return this.log; } //-------public initializers/destroyers----- /** *************** *** 172,183 **** public Template init (InputStream template) throws Exception { ! // ! Template t = new StreamTemplate(wm.getBroker(), ! new InputStreamReader(template)); t.parse(); this.currentTemplate = t; return t; } - public void error (String msg, Exception e) --- 173,182 ---- public Template init (InputStream template) throws Exception { ! Template t = new StreamTemplate(wm.getBroker(), ! template); t.parse(); this.currentTemplate = t; return t; } public void error (String msg, Exception e) *************** *** 196,200 **** } ! public WebContext getNewContext (HttpServletRequest req, HttpServletResponse resp) { WebContext c = wm.getWebContext(req, resp); --- 195,200 ---- } ! public WebContext getNewContext (HttpServletRequest req, ! HttpServletResponse resp) { WebContext c = wm.getWebContext(req, resp); *************** *** 214,218 **** * Gets the current template. */ ! public Template getCurrentTemplate() { return this.currentTemplate; --- 214,218 ---- * Gets the current template. */ ! public Template getCurrentTemplate () { return this.currentTemplate; *************** *** 221,224 **** --- 221,225 ---- /** * A convenience method to find and parse a template in the local template path. + * FIXME Do not set currentTemplate here */ public Template parseLocalTemplate (String templateName) throws Exception *************** *** 260,269 **** * current template and current output stream using UTF8. */ ! public String eval() throws Exception { ! return eval(context, currentTemplate); } - /** * Evaluate the context supplied against the current template. --- 261,269 ---- * current template and current output stream using UTF8. */ ! public String eval () throws Exception { ! return eval(context, currentTemplate); } /** * Evaluate the context supplied against the current template. *************** *** 272,276 **** public String eval (Context context) throws Exception { ! return eval(context, currentTemplate); } --- 272,276 ---- public String eval (Context context) throws Exception { ! return eval(context, currentTemplate); } *************** *** 284,288 **** } - /** * Evaluate the named template against the given context --- 284,287 ---- *************** *** 295,302 **** * @return The output from the evaluated template */ ! public String eval (Context context, String templateName, OutputStream out) ! throws Exception { ! return eval(context, templateName, out, null); } --- 294,301 ---- * @return The output from the evaluated template */ ! public String eval (Context context, String templateName, OutputStream out) ! throws Exception { ! return eval(context, templateName, out, null); } *************** *** 325,346 **** */ public String eval (WebContext context, String templateName, ! HttpServletResponse resp) throws ServletException { ! String value = null; ! try ! { ! resp.setContentType("text/html"); ! String encoding = wm.getConfig(WMConstants.TEMPLATE_OUTPUT_ENCODING); ! if (encoding == null) ! { ! encoding = resp.getCharacterEncoding(); ! } ! value = eval(context, templateName, resp.getOutputStream(), encoding); ! } ! catch (Exception e) ! { ! throw new ServletException(e); ! } ! return value; } --- 324,343 ---- */ public String eval (WebContext context, String templateName, ! HttpServletResponse resp) throws ServletException { ! String value = null; ! try { ! resp.setContentType("text/html"); ! String encoding = wm ! .getConfig(WMConstants.TEMPLATE_OUTPUT_ENCODING); ! if (encoding == null) { ! encoding = resp.getCharacterEncoding(); ! } ! value = eval(context, templateName, resp.getOutputStream(), ! encoding); ! } catch (Exception e) { ! throw new ServletException(e); ! } ! return value; } *************** *** 350,390 **** * This method is the preferred method when an output stream is to be written * as well as the value of the string is to be returned. * @param context The context to use. * @param templateName The input template file in the resource path. ! * @param out The output stream. If null, an attempt will be ! * made to locate the outputstream in the context using the output stream key if ! * in the context. If no output stream can be resolved, the method does not ! * throw an exception. * @param encoding If null, the platform's encoding will be used. * @return The output from the evaluation of the template. */ ! public String eval (Context context, String templateName, ! OutputStream out, String encoding) throws Exception { ! Template t = wm.getTemplate(templateName); ! String value = t.evaluateAsString(context); ! // output the file ! if (out == null) ! { ! String outputFileName = (String) context.get(outputContextKey); ! if (outputFileName != null) ! { ! out = new FileOutputStream(outputFileName); } ! } ! if (out != null) // write it to out ! { ! if (encoding == null) { ! out.write(value.getBytes()); ! } ! else { ! out.write(value.getBytes(encoding)); } ! out.close(); ! } ! this.currentTemplate = t; ! this.context = context; ! return value; } --- 347,384 ---- * This method is the preferred method when an output stream is to be written * as well as the value of the string is to be returned. + * * @param context The context to use. * @param templateName The input template file in the resource path. ! * @param out The output stream. If null, an attempt will be made to locate ! * the outputstream in the context using the output stream key if ! * in the context. If no output stream can be resolved, the method does not ! * throw an exception. * @param encoding If null, the platform's encoding will be used. * @return The output from the evaluation of the template. */ ! public String eval (Context context, String templateName, OutputStream out, ! String encoding) throws Exception { ! Template t = wm.getTemplate(templateName); ! String value = t.evaluateAsString(context); ! // output the file ! if (out == null) { ! String outputFileName = (String) context.get(outputContextKey); ! if (outputFileName != null) { ! out = new FileOutputStream(outputFileName); ! } } ! if (out != null) // write it to out { ! if (encoding == null) { ! out.write(value.getBytes()); ! } else { ! out.write(value.getBytes(encoding)); ! } ! out.close(); } ! this.currentTemplate = t; ! this.context = context; ! return value; } *************** *** 398,412 **** * @param append whether to apppend output * @param encoding the encoding to use, may be null ! * @return * @throws Exception */ ! public String eval (Context context, String templateName, ! String outputFileName, boolean append, String encoding) ! throws Exception { ! OutputStream out = new FileOutputStream(outputFileName, append); ! return eval(context, templateName, out, encoding); ! } ! /** --- 392,405 ---- * @param append whether to apppend output * @param encoding the encoding to use, may be null ! * @return the String resulting from evaluating the template against the context * @throws Exception */ ! public String eval (Context context, String templateName, ! String outputFileName, boolean append, String encoding) ! throws Exception { ! OutputStream out = new FileOutputStream(outputFileName, append); ! return eval(context, templateName, out, encoding); ! } /** *************** *** 417,420 **** --- 410,414 ---- wm = null; currentTemplate = null; + context = null; } } |
From: Tim P <ti...@us...> - 2008-03-26 09:52:36
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv20099/src/org/webmacro/util Modified Files: WMEval.java Log Message: Javadoc, method order Index: WMEval.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/WMEval.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** WMEval.java 26 Mar 2008 09:44:42 -0000 1.23 --- WMEval.java 26 Mar 2008 09:52:33 -0000 1.24 *************** *** 276,281 **** /** ! * Evaluates the named template against the current context ! * and returns the value. * If an output stream is specified, the return value is * also written out to the stream. --- 276,291 ---- /** ! * Evaluate the supplied template against the supplied context and ! * return the result as a string. ! */ ! public String eval (Context context, Template template) throws Exception ! { ! return template.evaluateAsString(context); ! } ! ! ! /** ! * Evaluate the named template against the given context ! * and return the result as a String. * If an output stream is specified, the return value is * also written out to the stream. *************** *** 336,348 **** /** - * Evaluate the supplied context and template and return the result as a - * as a string. - */ - public String eval (Context context, Template template) throws Exception - { - return template.evaluateAsString(context); - } - - /** * Evaluates the context using a file template sending the output to a disk file. * <p> --- 346,349 ---- |