1 16 package scriptella.driver.spring; 17 18 import org.springframework.beans.factory.BeanFactory; 19 import org.springframework.context.support.ClassPathXmlApplicationContext; 20 import scriptella.AbstractTestCase; 21 import scriptella.execution.EtlExecutor; 22 import scriptella.execution.EtlExecutorException; 23 24 import javax.sql.DataSource ; 25 import java.sql.Connection ; 26 import java.sql.SQLException ; 27 28 34 public class SpringDriverTest extends AbstractTestCase { 35 public void test() throws SQLException , ClassNotFoundException , EtlExecutorException { 36 BeanFactory bf = new ClassPathXmlApplicationContext("scriptella/driver/spring/springbeans.xml"); 37 DataSource ds = (DataSource ) bf.getBean("datasource"); Connection con = ds.getConnection(); 39 con.createStatement().executeQuery("select * from AutoStart"); EtlExecutor exec = (EtlExecutor) bf.getBean("executor"); 41 exec.execute(); 42 con.createStatement().executeQuery("select * from SpringTable"); con.createStatement().execute("SHUTDOWN"); 44 45 } 46 } 47 | Popular Tags |