1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.jdbc;
17
18 import java.util.Collections;
19 import java.util.List;
20
21 import org.junit.Test;
22 import org.kuali.common.jdbc.context.JdbcContext;
23 import org.kuali.common.jdbc.listener.LogSqlListener;
24 import org.kuali.common.jdbc.supplier.SimpleStringSupplier;
25 import org.kuali.common.jdbc.supplier.SqlSupplier;
26 import org.kuali.common.util.LocationUtils;
27 import org.springframework.jdbc.datasource.DriverManagerDataSource;
28
29 public class DefaultJdbcServiceTest {
30
31 @Test
32 public void test() {
33 try {
34
35 List<String> strings = LocationUtils.readLines("classpath:org/kuali/common/jdbc/oracle-clob.sql");
36 List<SqlSupplier> suppliers = Collections.singletonList((SqlSupplier) (new SimpleStringSupplier(strings)));
37 DriverManagerDataSource dmds = new DriverManagerDataSource("jdbc:oracle:thin:@oracle.ks.kuali.org:1521:ORACLE", "JDBCTEST", "JDBCTEST");
38 dmds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
39 JdbcContext context = new JdbcContext();
40 context.setDataSource(dmds);
41 context.setSuppliers(suppliers);
42 context.setListener(new LogSqlListener());
43 JdbcService service = new DefaultJdbcService();
44 JdbcExecutable executable = new JdbcExecutable(service, context);
45 executable.execute();
46 } catch (Exception e) {
47 e.printStackTrace();
48 }
49 }
50 }