ASF Bugzilla – Attachment 29708 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), 3.26 KB, created by
Sheldon Shao
on 2012-12-06 06:03:46 UTC
(
hide
)
Description:
Test case for ELInterpreterFactory
Filename:
MIME Type:
Creator:
Sheldon Shao
Created:
2012-12-06 06:03:46 UTC
Size:
3.26 KB
patch
obsolete
>/* > * 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.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()); > > 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