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 2014/03/06 20:08:24 UTC

svn commit: r1575012 - /tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java

Author: markt
Date: Thu Mar  6 19:08:23 2014
New Revision: 1575012

URL: http://svn.apache.org/r1575012
Log:
Fix broken test, uncovered by the fix for BZ 56223.

Modified:
    tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java

Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java?rev=1575012&r1=1575011&r2=1575012&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java (original)
+++ tomcat/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java Thu Mar  6 19:08:23 2014
@@ -19,6 +19,8 @@ package org.apache.jasper.compiler;
 import java.io.File;
 
 import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -28,6 +30,7 @@ import org.apache.catalina.startup.Tomca
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.compiler.ELInterpreterFactory.DefaultELInterpreter;
+import org.apache.tomcat.util.descriptor.web.ApplicationListener;
 
 public class TestELInterpreterFactory extends TomcatBaseTest {
 
@@ -75,14 +78,27 @@ public class TestELInterpreterFactory ex
 
         context.removeAttribute(ELInterpreter.class.getName());
 
+        ctx.stop();
+        ctx.addApplicationListener((new ApplicationListener(
+                Bug54239Listener.class.getName(), false)));
+        ctx.start();
 
-        context.setInitParameter(ELInterpreter.class.getName(),
-                SimpleELInterpreter.class.getName());
-
-        interpreter = ELInterpreterFactory.getELInterpreter(context);
+        interpreter = ELInterpreterFactory.getELInterpreter(ctx.getServletContext());
         Assert.assertNotNull(interpreter);
         Assert.assertTrue(interpreter instanceof SimpleELInterpreter);
+    }
 
-        context.removeAttribute(ELInterpreter.class.getName());
+    public static class Bug54239Listener implements ServletContextListener {
+
+        @Override
+        public void contextInitialized(ServletContextEvent sce) {
+            sce.getServletContext().setInitParameter(ELInterpreter.class.getName(),
+                    SimpleELInterpreter.class.getName());
+        }
+
+        @Override
+        public void contextDestroyed(ServletContextEvent sce) {
+            // NO-OP
+        }
     }
 }



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