You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by lu...@apache.org on 2011/04/25 23:06:57 UTC
svn commit: r1096602 - in /turbine/core/trunk:
conf/test/CompleteTurbineResourcesWithEncoding.properties
src/test/org/apache/turbine/TurbineTest.java
Author: ludwig
Date: Mon Apr 25 21:06:57 2011
New Revision: 1096602
URL: http://svn.apache.org/viewvc?rev=1096602&view=rev
Log:
Added input encoding tests
Added:
turbine/core/trunk/conf/test/CompleteTurbineResourcesWithEncoding.properties
Modified:
turbine/core/trunk/src/test/org/apache/turbine/TurbineTest.java
Added: turbine/core/trunk/conf/test/CompleteTurbineResourcesWithEncoding.properties
URL: http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/CompleteTurbineResourcesWithEncoding.properties?rev=1096602&view=auto
==============================================================================
--- turbine/core/trunk/conf/test/CompleteTurbineResourcesWithEncoding.properties (added)
+++ turbine/core/trunk/conf/test/CompleteTurbineResourcesWithEncoding.properties Mon Apr 25 21:06:57 2011
@@ -0,0 +1,2 @@
+input.encoding=UTF-8
+include=CompleteTurbineResources.properties
\ No newline at end of file
Modified: turbine/core/trunk/src/test/org/apache/turbine/TurbineTest.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/TurbineTest.java?rev=1096602&r1=1096601&r2=1096602&view=diff
==============================================================================
--- turbine/core/trunk/src/test/org/apache/turbine/TurbineTest.java (original)
+++ turbine/core/trunk/src/test/org/apache/turbine/TurbineTest.java Mon Apr 25 21:06:57 2011
@@ -1,6 +1,5 @@
package org.apache.turbine;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,9 +19,9 @@ package org.apache.turbine;
* under the License.
*/
-
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
import org.apache.turbine.test.BaseTestCase;
import org.apache.turbine.test.EnhancedMockHttpServletResponse;
@@ -31,41 +30,63 @@ import org.apache.turbine.util.TurbineCo
import com.mockobjects.servlet.MockHttpServletRequest;
/**
- * This testcase verifies that TurbineConfig can be used to startup Turbine in
- * a non servlet environment properly.
- *
+ * This testcase verifies that TurbineConfig can be used to startup Turbine in a
+ * non servlet environment properly.
+ *
* @author <a href="mailto:epugh@opensourceconnections.com">Eric Pugh </a>
* @author <a href="mailto:peter@courcoux.biz">Peter Courcoux </a>
* @version $Id$
*/
-public class TurbineTest extends BaseTestCase {
+public class TurbineTest extends BaseTestCase
+{
- public TurbineTest(String name) throws Exception {
+ public TurbineTest(String name) throws Exception
+ {
super(name);
}
- public void testTurbineAndFirstGet() throws Exception {
- TurbineConfig tc =
- new TurbineConfig(
- ".",
- "/conf/test/CompleteTurbineResources.properties");
- tc.initialize();
+ public void testTurbineAndFirstGet() throws Exception
+ {
+ TurbineConfig tc = new TurbineConfig(".",
+ "/conf/test/CompleteTurbineResources.properties");
+ tc.initialize();
ServletConfig config = (ServletConfig) tc;
ServletContext context = config.getServletContext();
assertNotNull(Turbine.getDefaultServerData());
- assertEquals("",Turbine.getServerName());
- assertEquals("80",Turbine.getServerPort());
- assertEquals("",Turbine.getScriptName());
+ assertEquals("", Turbine.getServerName());
+ assertEquals("80", Turbine.getServerPort());
+ assertEquals("", Turbine.getScriptName());
Turbine t = tc.getTurbine();
MockHttpServletRequest request = getMockRequest();
EnhancedMockHttpServletResponse resp = new EnhancedMockHttpServletResponse();
- t.doGet(request,resp);
-
- assertEquals("8080",Turbine.getServerPort());
+ t.doGet(request, resp);
+ assertEquals("8080", Turbine.getServerPort());
+ t.destroy();
+ }
+ public void testDefaultInputEncoding() throws Exception
+ {
+ TurbineConfig tc = new TurbineConfig(".",
+ "/conf/test/CompleteTurbineResources.properties");
+ tc.initialize();
+ Turbine t = tc.getTurbine();
+ assertNotNull(t.getDefaultInputEncoding());
+ assertEquals(TurbineConstants.PARAMETER_ENCODING_DEFAULT, t.getDefaultInputEncoding());
+ t.destroy();
+ }
+
+ public void testNonDefaultEncoding() throws ServletException
+ {
+ TurbineConfig tc = new TurbineConfig(".",
+ "/conf/test/CompleteTurbineResourcesWithEncoding.properties");
+ tc.initialize();
+ Turbine t = tc.getTurbine();
+ assertNotNull(t.getDefaultInputEncoding());
+ assertEquals("UTF-8", t.getDefaultInputEncoding());
}
+
}