Return-Path: Delivered-To: apmail-velocity-commits-archive@locus.apache.org Received: (qmail 85524 invoked from network); 30 Oct 2007 03:38:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2007 03:38:01 -0000 Received: (qmail 97430 invoked by uid 500); 30 Oct 2007 03:37:49 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 97397 invoked by uid 500); 30 Oct 2007 03:37:49 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 97388 invoked by uid 99); 30 Oct 2007 03:37:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2007 20:37:49 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Oct 2007 03:38:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 60DA91A9832; Mon, 29 Oct 2007 20:37:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r589949 - /velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java Date: Tue, 30 Oct 2007 03:37:40 -0000 To: commits@velocity.apache.org From: wglass@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071030033740.60DA91A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wglass Date: Mon Oct 29 20:37:39 2007 New Revision: 589949 URL: http://svn.apache.org/viewvc?rev=589949&view=rev Log: as long as we're using svn as a run-time debugging tool, let's get the details of the Gump failure Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java?rev=589949&r1=589948&r2=589949&view=diff ============================================================================== --- velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java (original) +++ velocity/engine/trunk/src/test/org/apache/velocity/test/BuiltInEventHandlerTestCase.java Mon Oct 29 20:37:39 2007 @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; +import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestSuite; @@ -257,46 +258,58 @@ */ public void testEscapeReferenceMatch() throws Exception { - // set up HTML match on everything, JavaScript match on _js* - VelocityEngine ve = new VelocityEngine(); - ve.setProperty(RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION, "org.apache.velocity.app.event.implement.EscapeHtmlReference,org.apache.velocity.app.event.implement.EscapeJavaScriptReference"); - ve.setProperty("eventhandler.escape.javascript.match", "/.*_js.*/"); - ve.init(); - - System.out.println("Successfully engine init()"); - - Writer writer; - - // Html no JavaScript - writer = new StringWriter(); - ve.evaluate(newEscapeContext(),writer,"test","$test1"); - System.out.println("Escaping test1: "+writer.toString()); - assertEquals("Jimmy's <b>pizza</b>",writer.toString()); - System.out.println("Successfully escaped test1: "); - - // JavaScript and HTML - writer = new StringWriter(); - ve.evaluate(newEscapeContext(),writer,"test","$test1_js"); - System.out.println("Escaping test1_js: "+writer.toString()); - assertEquals("Jimmy\\'s <b>pizza</b>",writer.toString()); - System.out.println("Successfully escaped test1_js"); - - // JavaScript and HTML - writer = new StringWriter(); - ve.evaluate(newEscapeContext(),writer,"test","$test1_js_test"); - System.out.println("Escaping test1_js_test: "+writer.toString()); - assertEquals("Jimmy\\'s <b>pizza</b>",writer.toString()); - System.out.println("Successfully escaped test1_js_test"); - - // JavaScript and HTML (method call) - writer = new StringWriter(); - ve.evaluate(newEscapeContext(),writer,"test","$test1_js.substring(0,7)"); - System.out.println("Escaping test1_js.substring(0,7): "+writer.toString()); - assertEquals("Jimmy\\'s",writer.toString()); - System.out.println("Successfully escaped test1_js.substring(0,7)"); - - System.out.println("Escape selected references (global configuration)"); - + try + { + // set up HTML match on everything, JavaScript match on _js* + VelocityEngine ve = new VelocityEngine(); + ve.setProperty(RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION, "org.apache.velocity.app.event.implement.EscapeHtmlReference,org.apache.velocity.app.event.implement.EscapeJavaScriptReference"); + ve.setProperty("eventhandler.escape.javascript.match", "/.*_js.*/"); + ve.init(); + + System.out.println("Successfully engine init()"); + + Writer writer; + + // Html no JavaScript + writer = new StringWriter(); + ve.evaluate(newEscapeContext(),writer,"test","$test1"); + System.out.println("Escaping test1: "+writer.toString()); + assertEquals("Jimmy's <b>pizza</b>",writer.toString()); + System.out.println("Successfully escaped test1: "); + + // JavaScript and HTML + writer = new StringWriter(); + ve.evaluate(newEscapeContext(),writer,"test","$test1_js"); + System.out.println("Escaping test1_js: "+writer.toString()); + assertEquals("Jimmy\\'s <b>pizza</b>",writer.toString()); + System.out.println("Successfully escaped test1_js"); + + // JavaScript and HTML + writer = new StringWriter(); + ve.evaluate(newEscapeContext(),writer,"test","$test1_js_test"); + System.out.println("Escaping test1_js_test: "+writer.toString()); + assertEquals("Jimmy\\'s <b>pizza</b>",writer.toString()); + System.out.println("Successfully escaped test1_js_test"); + + // JavaScript and HTML (method call) + writer = new StringWriter(); + ve.evaluate(newEscapeContext(),writer,"test","$test1_js.substring(0,7)"); + System.out.println("Escaping test1_js.substring(0,7): "+writer.toString()); + assertEquals("Jimmy\\'s",writer.toString()); + System.out.println("Successfully escaped test1_js.substring(0,7)"); + + System.out.println("Escape selected references (global configuration)"); + + } + + catch (AssertionFailedError e) + { + System.out.println(e.getMessage()); + e.printStackTrace(); + + throw e; + } + } private Context newEscapeContext()