Author: bayard
Date: Mon Jan 29 16:12:33 2007
New Revision: 501245

URL: http://svn.apache.org/viewvc?view=rev&rev=501245
Log:
Adding unit test for Bug 33054 - however the assertion is turned off because 
this is not something we can fix. It's being added as an example of how to do a 
sql tag test so it doesn't get lost. 

Added:
    
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/
    
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/Test33054.java
    
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/
    
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp
Modified:
    jakarta/taglibs/proper/standard/trunk/build-tests.xml
    jakarta/taglibs/proper/standard/trunk/build_sample_standard.properties

Modified: jakarta/taglibs/proper/standard/trunk/build-tests.xml
URL: 
http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/build-tests.xml?view=diff&rev=501245&r1=501244&r2=501245
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/build-tests.xml (original)
+++ jakarta/taglibs/proper/standard/trunk/build-tests.xml Mon Jan 29 16:12:33 
2007
@@ -246,6 +246,7 @@
     <copy file="${cactus.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
     <copy file="${httpclient.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
     <copy file="${aspectjrt.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
+    <copy file="${derby.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
 
     <!-- copy the all important web.xml -->
     <echo message="out.test.dir ${out.test.dir}" />

Modified: jakarta/taglibs/proper/standard/trunk/build_sample_standard.properties
URL: 
http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/build_sample_standard.properties?view=diff&rev=501245&r1=501244&r2=501245
==============================================================================
--- jakarta/taglibs/proper/standard/trunk/build_sample_standard.properties 
(original)
+++ jakarta/taglibs/proper/standard/trunk/build_sample_standard.properties Mon 
Jan 29 16:12:33 2007
@@ -71,6 +71,7 @@
 aspectjrt.jar=${cactus.home}/lib/aspectjrt-1.1.1.jar
 httpclient.jar=${cactus.home}/lib/commons-httpclient-2.0.jar
 commons-logging.jar=${cactus.home}/lib/commons-logging-1.0.3.jar
+derby.jar=${cactus.home}/lib/derby-10.2.2.0.jar
 
 # --------------------------------------------------
 #   RUN-TIME COMPONENTS FOR UNIT TESTS

Added: 
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/Test33054.java
URL: 
http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/Test33054.java?view=auto&rev=501245
==============================================================================
--- 
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/Test33054.java
 (added)
+++ 
jakarta/taglibs/proper/standard/trunk/test/org/apache/taglibs/standard/tag/el/sql/Test33054.java
 Mon Jan 29 16:12:33 2007
@@ -0,0 +1,68 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ *
+ * Licensed 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.taglibs.standard.tag.el.sql;
+
+import java.sql.*;
+import javax.servlet.jsp.*;
+import org.apache.cactus.*;
+import org.apache.taglibs.standard.testutil.TestUtil;
+
+public class Test33054 extends JspTestCase {
+
+    public Test33054(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+        Connection conn = 
DriverManager.getConnection("jdbc:derby:cactustest;create=true");
+        Statement stmt = conn.createStatement();
+        try { stmt.execute("DROP TABLE Bug33054"); } catch(SQLException sqle) 
{ } // ignore
+        stmt.execute("CREATE TABLE Bug33054 ( id int primary key, name 
varchar(80) )");
+        stmt.execute("INSERT INTO Bug33054 VALUES(1, 'a')");
+
+        ResultSet rs = stmt.executeQuery("SELECT * FROM Bug33054");
+        rs.next();
+        assertEquals( 1, rs.getInt(1) );
+        assertEquals( "a", rs.getString(2) );
+
+        rs.close();
+        stmt.close();
+        conn.close();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Connection conn = DriverManager.getConnection("jdbc:derby:cactustest");
+        Statement stmt = conn.createStatement();
+        stmt.execute("DROP TABLE Bug33054");
+        stmt.close();
+        conn.close();
+    }
+
+    public void test33054() throws Exception {
+        String toInclude = TestUtil.getTestJsp(this);
+        pageContext.include(toInclude);
+
+        String data = (String) pageContext.getAttribute("bug33054", 
PageContext.APPLICATION_SCOPE);
+
+       // This fails and isn't something that can easily be fixed. 
+       // See: http://issues.apache.org/bugzilla/show_bug.cgi?id=33054
+        //assertEquals( "ID=1NAME=1" + "ID1=1NAME1=a" + "ID2=1NAME2=a", data );
+    }
+}

Added: 
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp
URL: 
http://svn.apache.org/viewvc/jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp?view=auto&rev=501245
==============================================================================
--- 
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp
 (added)
+++ 
jakarta/taglibs/proper/standard/trunk/test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp
 Mon Jan 29 16:12:33 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
+<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"; %>
+
+
+  <sql:setDataSource url="jdbc:derby:cactustest" 
driver="org.apache.derby.jdbc.EmbeddedDriver"/>
+
+  <sql:query var="db">
+    SELECT id, name, id as id1, name as name1, id as id2, name as name2 FROM 
Bug33054
+  </sql:query>
+
+  <c:set var="bug33054" value="" scope="application"/>
+  <c:forEach var="row" items="${db.rows}">
+      <c:forEach var="column" items="${row}">
+        <c:set var="bug33054" value="${bug33054}${column}" 
scope="application"/>
+      </c:forEach>
+  </c:forEach>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to