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:12:21 UTC

svn commit: r1575015 - in /tomcat/tc7.0.x/trunk: ./ test/org/apache/jasper/compiler/TestELInterpreterFactory.java

Author: markt
Date: Thu Mar  6 19:12:21 2014
New Revision: 1575015

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

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1575012

Modified: tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java?rev=1575015&r1=1575014&r2=1575015&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestELInterpreterFactory.java Thu Mar  6 19:12:21 2014
@@ -19,11 +19,14 @@ 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;
 
 import org.apache.catalina.Context;
+import org.apache.catalina.deploy.ApplicationListener;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.jasper.JspCompilationContext;
@@ -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