package test; import junit.framework.TestCase; import java.sql.*; /** * Created by IntelliJ IDEA. * User: tahir akhtar * Date: Apr 10, 2007 * Time: 12:53:32 PM */ public class TestBatchInsertAutoGeneratedKeys extends TestCase { private String drop= "drop table if exists id_name;"; private String create =" CREATE TABLE `id_name` ( \n" + " `id` int(11) NOT NULL auto_increment, \n" + " `name` varchar(50) default NULL, \n" + " PRIMARY KEY (`id`) \n" + " ) TYPE=MyISAM "; private Connection conn; private int numTestInserts=5; public TestBatchInsertAutoGeneratedKeys() throws Exception{ Class.forName ("com.mysql.jdbc.Driver").newInstance () ; conn = DriverManager.getConnection ("jdbc:mysql://localhost/fountain?test=root&password=") ; } protected void setUp() throws Exception { super.setUp(); Statement stmt = conn.createStatement () ; stmt.executeUpdate(drop); stmt.executeUpdate(create); stmt.close(); } protected void tearDown() throws Exception { super.tearDown(); } public void testAutoGeneratedKeyCountEqualsInsertCountUsingStatements() throws Exception{ Statement stmt=conn.createStatement(); for(int i=0;i