Author: markt
Date: Wed Jan 13 18:01:26 2010
New Revision: 898863

URL: http://svn.apache.org/viewvc?rev=898863&view=rev
Log:
Add a test for method invocation with parameters

Added:
    tomcat/trunk/test/org/apache/el/TesterBeanA.java   (with props)
    tomcat/trunk/test/org/apache/el/TesterBeanB.java   (with props)
    tomcat/trunk/test/webapp/el-method.jsp   (with props)
Modified:
    tomcat/trunk/test/org/apache/el/TestELInJsp.java

Modified: tomcat/trunk/test/org/apache/el/TestELInJsp.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELInJsp.java?rev=898863&r1=898862&r2=898863&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELInJsp.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELInJsp.java Wed Jan 13 18:01:26 2010
@@ -312,7 +312,6 @@
         ByteChunk res = getUrl("http://localhost:"; + getPort() +
                 "/test/script-expr.jsp");
         String result = res.toString();
-        System.out.println(result);
         assertTrue(result.indexOf("00-hello world") > 0);
         assertTrue(result.indexOf("01-hello \"world") > 0);
         assertTrue(result.indexOf("02-hello \\\"world") > 0);
@@ -327,4 +326,21 @@
         assertTrue(result.indexOf("11-hello %> world") > 0);
     }
 
+    public void testELMethod() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir = 
+            new File("test/webapp");
+        // app dir is relative to server home
+        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
+        
+        tomcat.start();
+
+        ByteChunk res = getUrl("http://localhost:"; + getPort() +
+                "/test/el-method.jsp");
+        String result = res.toString();
+        assertTrue(result.indexOf("00-Hello JUnit from Tomcat") > 0);
+        assertTrue(result.indexOf("01-Hello JUnit from Tomcat") > 0);
+        assertTrue(result.indexOf("02-Hello JUnit from Tomcat") > 0);
+    }
 }

Added: tomcat/trunk/test/org/apache/el/TesterBeanA.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TesterBeanA.java?rev=898863&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/el/TesterBeanA.java (added)
+++ tomcat/trunk/test/org/apache/el/TesterBeanA.java Wed Jan 13 18:01:26 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.el;
+
+public class TesterBeanA {
+    private TesterBeanB bean;
+
+    public TesterBeanB getBean() {
+        return bean;
+    }
+
+    public void setBean(TesterBeanB bean) {
+        this.bean = bean;
+    }
+}

Propchange: tomcat/trunk/test/org/apache/el/TesterBeanA.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/test/org/apache/el/TesterBeanA.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Added: tomcat/trunk/test/org/apache/el/TesterBeanB.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TesterBeanB.java?rev=898863&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/el/TesterBeanB.java (added)
+++ tomcat/trunk/test/org/apache/el/TesterBeanB.java Wed Jan 13 18:01:26 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.el;
+
+public class TesterBeanB {
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public String sayHello(String to) {
+        return "Hello " + to + " from " + name;
+    }
+}

Propchange: tomcat/trunk/test/org/apache/el/TesterBeanB.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/test/org/apache/el/TesterBeanB.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Added: tomcat/trunk/test/webapp/el-method.jsp
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/el-method.jsp?rev=898863&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/el-method.jsp (added)
+++ tomcat/trunk/test/webapp/el-method.jsp Wed Jan 13 18:01:26 2010
@@ -0,0 +1,35 @@
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<%@ page import="org.apache.el.TesterBeanA" %>
+<%@ page import="org.apache.el.TesterBeanB" %>
+<%--
+ 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.
+--%>
+<html>
+  <head><title>EL method test cases</title></head>
+  <body>
+    <%
+    TesterBeanA beanA = new TesterBeanA();
+    TesterBeanB beanB = new TesterBeanB();
+    beanB.setName("Tomcat");
+    beanA.setBean(beanB);
+    pageContext.setAttribute("testBeanA", beanA);
+    pageContext.setAttribute("testBeanB", beanB);
+    %>
+    <tags:echo echo="00-${testBeanA[\"bean\"].sayHello('JUnit')}" />
+    <tags:echo echo="01-${testBeanA.bean.sayHello('JUnit')}" />
+    <tags:echo echo="02-${testBeanB.sayHello('JUnit')}" />
+  </body>
+</html>
\ No newline at end of file

Propchange: tomcat/trunk/test/webapp/el-method.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/test/webapp/el-method.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision

Propchange: tomcat/trunk/test/webapp/el-method.jsp
------------------------------------------------------------------------------
    svn:mergeinfo = 



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

Reply via email to