You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/10/25 13:58:01 UTC

svn commit: r1402115 - in /tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core: AbstractTestTag.java TestOut.java TestSet.java

Author: markt
Date: Thu Oct 25 11:58:00 2012
New Revision: 1402115

URL: http://svn.apache.org/viewvc?rev=1402115&view=rev
Log:
Enable test case for BZ54012 and refactor common code to base class.

Added:
    tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/AbstractTestTag.java
Modified:
    tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestOut.java
    tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestSet.java

Added: tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/AbstractTestTag.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/AbstractTestTag.java?rev=1402115&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/AbstractTestTag.java (added)
+++ tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/AbstractTestTag.java Thu Oct 25 11:58:00 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jasper.tagplugins.jstl.core;
+
+import java.io.File;
+
+import org.junit.Before;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.WebResourceRoot;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.webresources.StandardRoot;
+
+public abstract class AbstractTestTag extends TomcatBaseTest {
+
+    @Before
+    public void setup() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir = new File("test/webapp-3.0");
+        Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
+
+        ctx.setResources(new StandardRoot(ctx));
+
+        // Add the JSTL (we need the TLD)
+        File lib = new File("webapps/examples/WEB-INF/lib");
+        ctx.getResources().createWebResourceSet(
+                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
+                "/WEB-INF/lib", "");
+
+        // Configure the use of the plug-in rather than the standard impl
+        File plugin = new File(
+                "java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml");
+        ctx.getResources().createWebResourceSet(
+                WebResourceRoot.ResourceSetType.POST, plugin.getAbsolutePath(),
+                "/WEB-INF/tagPlugins.xml", "");
+
+        tomcat.start();
+    }
+}

Modified: tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestOut.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestOut.java?rev=1402115&r1=1402114&r2=1402115&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestOut.java (original)
+++ tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestOut.java Thu Oct 25 11:58:00 2012
@@ -16,46 +16,17 @@
  */
 package org.apache.jasper.tagplugins.jstl.core;
 
-import java.io.File;
-
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
 import org.junit.Test;
 
-import org.apache.catalina.Context;
-import org.apache.catalina.WebResourceRoot;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.catalina.webresources.StandardRoot;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestOut extends TomcatBaseTest {
+public class TestOut extends AbstractTestTag {
 
     @Test
     public void testBug54011() throws Exception {
-        Tomcat tomcat = getTomcatInstance();
-
-        File appDir = new File("test/webapp-3.0");
-        Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
-
-        ctx.setResources(new StandardRoot(ctx));
-
-        // Add the JSTL (we need the TLD)
-        File lib = new File("webapps/examples/WEB-INF/lib");
-        ctx.getResources().createWebResourceSet(
-                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
-                "/WEB-INF/lib", "");
-
-        // Configure the use of the plug-in rather than the standard impl
-        File plugin = new File(
-                "java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml");
-        ctx.getResources().createWebResourceSet(
-                WebResourceRoot.ResourceSetType.POST, plugin.getAbsolutePath(),
-                "/WEB-INF/tagPlugins.xml", "");
-
-        tomcat.start();
-
         ByteChunk res = new ByteChunk();
 
         int rc = getUrl("http://localhost:" + getPort() +

Modified: tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestSet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestSet.java?rev=1402115&r1=1402114&r2=1402115&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestSet.java (original)
+++ tomcat/trunk/test/org/apache/jasper/tagplugins/jstl/core/TestSet.java Thu Oct 25 11:58:00 2012
@@ -16,50 +16,17 @@
  */
 package org.apache.jasper.tagplugins.jstl.core;
 
-import java.io.File;
-
 import javax.servlet.http.HttpServletResponse;
 
 import org.junit.Assert;
 import org.junit.Test;
 
-import org.apache.catalina.Context;
-import org.apache.catalina.WebResourceRoot;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.catalina.webresources.StandardRoot;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestSet extends TomcatBaseTest {
+public class TestSet extends AbstractTestTag {
 
     @Test
     public void testBug54011() throws Exception {
-    }
-
-    public void toFix() throws Exception {
-        // TODO: Extract common code from this test and TestOut.java
-        Tomcat tomcat = getTomcatInstance();
-
-        File appDir = new File("test/webapp-3.0");
-        Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
-
-        ctx.setResources(new StandardRoot(ctx));
-
-        // Add the JSTL (we need the TLD)
-        File lib = new File("webapps/examples/WEB-INF/lib");
-        ctx.getResources().createWebResourceSet(
-                WebResourceRoot.ResourceSetType.POST, lib.getAbsolutePath(),
-                "/WEB-INF/lib", "");
-
-        // Configure the use of the plug-in rather than the standard impl
-        File plugin = new File(
-                "java/org/apache/jasper/tagplugins/jstl/tagPlugins.xml");
-        ctx.getResources().createWebResourceSet(
-                WebResourceRoot.ResourceSetType.POST, plugin.getAbsolutePath(),
-                "/WEB-INF/tagPlugins.xml", "");
-
-        tomcat.start();
-
         ByteChunk res = new ByteChunk();
 
         int rc = getUrl("http://localhost:" + getPort() +



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org