ASF Bugzilla – Attachment 29696 Details for
Bug 54239
Extensible EL Interpreter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test case for ELInterpreterFactory
TestELInterpreterFactory.java (text/plain), 2.82 KB, created by
Sheldon Shao
on 2012-12-05 09:39:24 UTC
(
hide
)
Description:
Test case for ELInterpreterFactory
Filename:
MIME Type:
Creator:
Sheldon Shao
Created:
2012-12-05 09:39:24 UTC
Size:
2.82 KB
patch
obsolete
>package org.apache.jasper.compiler; > >import static org.junit.Assert.*; > >import java.io.File; > >import javax.servlet.ServletContext; > >import org.apache.catalina.Context; >import org.apache.catalina.startup.Tomcat; >import org.apache.catalina.startup.TomcatBaseTest; >import org.apache.jasper.JspCompilationContext; >import org.junit.Test; > >public class TestELInterpreterFactory extends TomcatBaseTest { > > public static class SimpleELInterpreter implements ELInterpreter { > > @Override > public String interpreterCall(JspCompilationContext context, > boolean isTagFile, String expression, Class<?> expectedType, > String fnmapvar, boolean xmlEscape) { > return expression; > } > } > > @Test > public void testBug54239() throws Exception { > Tomcat tomcat = getTomcatInstance(); > > File appDir = new File("test/webapp-3.0"); > Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); > tomcat.start(); > > ServletContext context = ctx.getServletContext(); > > ELInterpreter interpreter = ELInterpreterFactory.getELInterpreter(context); > assertNotNull(interpreter); > assertTrue(interpreter instanceof ELInterpreterFactory.DefaultELInterpreter); > > context.removeAttribute(ELInterpreter.class.getName()); > > System.setProperty(ELInterpreter.class.getName(), SimpleELInterpreter.class.getName()); > interpreter = ELInterpreterFactory.getELInterpreter(context); > assertNotNull(interpreter); > assertTrue(interpreter instanceof SimpleELInterpreter); > > context.removeAttribute(ELInterpreter.class.getName()); > > > context.setAttribute(ELInterpreter.class.getName(), SimpleELInterpreter.class.getName()); > interpreter = ELInterpreterFactory.getELInterpreter(context); > assertNotNull(interpreter); > assertTrue(interpreter instanceof SimpleELInterpreter); > > context.removeAttribute(ELInterpreter.class.getName()); > > SimpleELInterpreter simpleInterpreter = new SimpleELInterpreter(); > context.setAttribute(ELInterpreter.class.getName(), simpleInterpreter); > interpreter = ELInterpreterFactory.getELInterpreter(context); > assertNotNull(interpreter); > assertTrue(interpreter instanceof SimpleELInterpreter); > assertTrue(interpreter == simpleInterpreter); > > context.removeAttribute(ELInterpreter.class.getName()); > > > context.setInitParameter(ELInterpreter.class.getName(), SimpleELInterpreter.class.getName()); > > interpreter = ELInterpreterFactory.getELInterpreter(context); > assertNotNull(interpreter); > assertTrue(interpreter instanceof SimpleELInterpreter); > > context.removeAttribute(ELInterpreter.class.getName()); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 54239
:
29684
|
29685
|
29686
|
29693
|
29694
|
29695
|
29696
|
29704
|
29705
|
29706
|
29707
|
29708