1 16 package scriptella; 17 18 import scriptella.execution.EtlExecutor; 19 import scriptella.execution.EtlExecutorException; 20 import scriptella.jdbc.JdbcUtils; 21 22 import java.sql.Connection ; 23 import java.sql.PreparedStatement ; 24 import java.sql.ResultSet ; 25 import java.sql.SQLException ; 26 import java.util.ArrayList ; 27 import java.util.HashSet ; 28 import java.util.List ; 29 import java.util.Set ; 30 31 32 38 public class ConditionsTest extends DBTestCase { 39 public void test() throws EtlExecutorException, SQLException { 40 final Connection con = getConnection("conditionstest"); 41 final EtlExecutor se = newEtlExecutor(); 42 se.execute(); 43 44 PreparedStatement ps = null; 45 ResultSet rs = null; 46 47 try { 48 ps = con.prepareStatement("select * from Test"); 49 rs = ps.executeQuery(); 50 51 Set <Integer > expected = new HashSet <Integer >(); 52 expected.add(1); 53 expected.add(3); 54 expected.add(4); 55 56 List <Integer > actual = new ArrayList <Integer >(); 57 58 while (rs.next()) { 60 actual.add(rs.getInt(1)); 61 } 62 63 assertEquals("Set must be " + expected, 3, actual.size()); 64 assertTrue("Set must be " + expected, expected.containsAll(actual)); 65 } finally { 66 JdbcUtils.closeSilent(rs); 67 JdbcUtils.closeSilent(ps); 68 } 69 } 70 } 71 | Popular Tags |