KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > JDBCEscapingTest


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
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 package scriptella;
17
18 import scriptella.execution.EtlExecutor;
19 import scriptella.execution.EtlExecutorException;
20 import scriptella.jdbc.QueryHelper;
21 import scriptella.spi.ParametersCallback;
22 import scriptella.spi.QueryCallback;
23
24 import java.sql.Connection JavaDoc;
25 import java.sql.Timestamp JavaDoc;
26
27
28 /**
29  * TODO: Add documentation
30  *
31  * @author Fyodor Kupolov
32  * @version 1.0
33  */

34 public class JDBCEscapingTest extends DBTestCase {
35     /**
36      * Tests correct execution of scripts with jdbc escaped timestamp data.
37      *
38      * @throws EtlExecutorException
39      */

40     public void testTimestamps() throws EtlExecutorException {
41         final Connection JavaDoc c = getConnection("jdbcet");
42         final EtlExecutor se = newEtlExecutor();
43         se.execute();
44
45         QueryHelper q = new QueryHelper("select * from test");
46         final Timestamp JavaDoc expectedTs = Timestamp.valueOf("2005-10-10 22:33:44.1");
47         q.execute(c,
48                 new QueryCallback() {
49                     public void processRow(final ParametersCallback rowEvaluator) {
50                         final Timestamp JavaDoc ts = (Timestamp JavaDoc) rowEvaluator.getParameter(
51                                 "d");
52                         assertEquals(expectedTs, ts);
53                     }
54                 });
55     }
56 }
57
Popular Tags