1 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 ; 25 import java.util.Arrays ; 26 import java.util.HashSet ; 27 import java.util.Set ; 28 29 30 36 public class DialectsTest extends DBTestCase { 37 public void test() throws EtlExecutorException { 38 final Connection con = getConnection("dialectstest"); 39 final EtlExecutor se = newEtlExecutor("DialectsTest.xml"); 40 se.execute(); 41 42 QueryHelper s = new QueryHelper("select * from test"); 43 final Set expected = new HashSet (Arrays.asList( 44 new Integer []{1, 3, 4, 5, 6, 7, 9})); 45 final Set actual = new HashSet <Integer >(); 46 47 s.execute(con, 48 new QueryCallback() { 49 public void processRow(final ParametersCallback row) { 50 actual.add(row.getParameter("ID")); 51 } 52 }); 53 assertEquals(expected, actual); 54 } 55 56 public void test2() throws EtlExecutorException { 57 final Connection con = getConnection("dialectstest2"); 58 final EtlExecutor se = newEtlExecutor("DialectsTest2.xml"); 59 se.execute(); 60 61 QueryHelper s = new QueryHelper("select * from test2"); 62 final Set expected = new HashSet (Arrays.asList(new Integer []{1, 2})); 63 final Set actual = new HashSet <Integer >(); 64 65 s.execute(con, 66 new QueryCallback() { 67 public void processRow(final ParametersCallback row) { 68 actual.add(row.getParameter("ID")); 69 } 70 }); 71 assertEquals(expected, actual); 72 } 73 } 74 | Popular Tags |