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.LinkedHashMap ; 26 import java.util.Map ; 27 28 34 public class OnErrorTest extends DBTestCase { 35 public void test() throws EtlExecutorException { 36 final Connection con = getConnection("onerrortest"); 37 EtlExecutor se = newEtlExecutor(); 38 se.execute(); 39 QueryHelper q = new QueryHelper("select * from test"); 40 final Map <Integer , String > expected = new LinkedHashMap <Integer , String >(); 41 expected.put(1, "Updated1"); 42 expected.put(2, "Updated2"); 43 expected.put(3, "Updated3"); 44 expected.put(4, "444"); 45 expected.put(5, "555"); 46 q.execute(con, new QueryCallback() { 47 public void processRow(final ParametersCallback parameters) { 48 Integer id = (Integer ) parameters.getParameter("id"); 49 assertEquals(expected.get(id), parameters.getParameter("value")); 50 expected.remove(id); 51 } 52 }); 53 assertTrue(expected.isEmpty()); 54 55 } 56 } 57 | Popular Tags |