View | Details | Raw Unified | Return to bug 33054
Collapse All | Expand All

(-)test/org/apache/taglibs/standard/tag/el/sql/Test33054.java (+66 lines)
Line 0 Link Here
1
/*
2
 * Copyright 1999,2004 The Apache Software Foundation.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package org.apache.taglibs.standard.tag.el.sql;
18
19
import java.sql.*;
20
import javax.servlet.jsp.*;
21
import org.apache.cactus.*;
22
import org.apache.taglibs.standard.testutil.TestUtil;
23
24
public class Test33054 extends JspTestCase {
25
26
    public Test33054(String name) {
27
        super(name);
28
    }
29
30
    protected void setUp() throws Exception {
31
        super.setUp();
32
        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
33
        Connection conn = DriverManager.getConnection("jdbc:derby:cactustest;create=true");
34
        Statement stmt = conn.createStatement();
35
        try { stmt.execute("DROP TABLE Bug33054"); } catch(SQLException sqle) { } // ignore
36
        stmt.execute("CREATE TABLE Bug33054 ( id int primary key, name varchar(80) )");
37
        stmt.execute("INSERT INTO Bug33054 VALUES(1, 'a')");
38
39
        ResultSet rs = stmt.executeQuery("SELECT * FROM Bug33054");
40
        rs.next();
41
        assertEquals( 1, rs.getInt(1) );
42
        assertEquals( "a", rs.getString(2) );
43
44
        rs.close();
45
        stmt.close();
46
        conn.close();
47
    }
48
49
    protected void tearDown() throws Exception {
50
        super.tearDown();
51
        Connection conn = DriverManager.getConnection("jdbc:derby:cactustest");
52
        Statement stmt = conn.createStatement();
53
        stmt.execute("DROP TABLE Bug33054");
54
        stmt.close();
55
        conn.close();
56
    }
57
58
    public void test33054() throws Exception {
59
        String toInclude = TestUtil.getTestJsp(this);
60
        pageContext.include(toInclude);
61
62
        String data = (String) pageContext.getAttribute("bug33054", PageContext.APPLICATION_SCOPE);
63
64
        assertEquals( "ID=1NAME=1" + "ID1=1NAME1=a" + "ID2=1NAME2=a", data );
65
    }
66
}
(-)test/web/org/apache/taglibs/standard/tag/el/sql/Test33054.jsp (+17 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
4
5
6
  <sql:setDataSource url="jdbc:derby:cactustest" driver="org.apache.derby.jdbc.EmbeddedDriver"/>
7
8
  <sql:query var="db">
9
    SELECT id, name, id as id1, name as name1, id as id2, name as name2 FROM Bug33054
10
  </sql:query>
11
12
  <c:set var="bug33054" value="" scope="application"/>
13
  <c:forEach var="row" items="${db.rows}">
14
      <c:forEach var="column" items="${row}">
15
        <c:set var="bug33054" value="${bug33054}${column}" scope="application"/>
16
      </c:forEach>
17
  </c:forEach>
(-)build_sample_standard.properties (+1 lines)
Lines 68-73 Link Here
68
aspectjrt.jar=${cactus.home}/lib/aspectjrt-1.1.1.jar
68
aspectjrt.jar=${cactus.home}/lib/aspectjrt-1.1.1.jar
69
httpclient.jar=${cactus.home}/lib/commons-httpclient-2.0.jar
69
httpclient.jar=${cactus.home}/lib/commons-httpclient-2.0.jar
70
commons-logging.jar=${cactus.home}/lib/commons-logging-1.0.3.jar
70
commons-logging.jar=${cactus.home}/lib/commons-logging-1.0.3.jar
71
derby.jar=${cactus.home}/lib/derby-10.2.2.0.jar
71
72
72
# --------------------------------------------------
73
# --------------------------------------------------
73
#   RUN-TIME COMPONENTS FOR UNIT TESTS
74
#   RUN-TIME COMPONENTS FOR UNIT TESTS
(-)build-tests.xml (+1 lines)
Lines 246-251 Link Here
246
    <copy file="${cactus.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
246
    <copy file="${cactus.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
247
    <copy file="${httpclient.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
247
    <copy file="${httpclient.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
248
    <copy file="${aspectjrt.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
248
    <copy file="${aspectjrt.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
249
    <copy file="${derby.jar}" todir="${out.test.dir}/WEB-INF/lib"/>
249
250
250
    <!-- copy the all important web.xml -->
251
    <!-- copy the all important web.xml -->
251
    <echo message="out.test.dir ${out.test.dir}" />
252
    <echo message="out.test.dir ${out.test.dir}" />

Return to bug 33054