1 20 package org.apache.derbyTesting.functionTests.tests.lang; 21 22 23 import java.sql.SQLException ; 24 import java.sql.Statement ; 25 import java.sql.ResultSet ; 26 27 import junit.framework.Test; 28 import junit.framework.TestSuite; 29 import org.apache.derbyTesting.junit.BaseJDBCTestCase; 30 import org.apache.derbyTesting.junit.JDBC; 31 32 35 public class VTITest extends BaseJDBCTestCase { 36 37 38 public static Test suite() 39 { 40 TestSuite suite = new TestSuite(); 41 if (JDBC.vmSupportsJDBC2()) 43 suite.addTest(new VTITest("bulkInsertVtiTest")); 44 45 return suite; 46 } 47 48 49 public VTITest(String name) { 50 super(name); 51 } 52 53 54 57 protected void setUp() throws SQLException { 58 Statement stmt = createStatement(); 59 stmt.execute("CREATE TABLE warehouse (id int)"); 60 stmt.close(); 61 } 62 63 67 protected void tearDown() 68 throws Exception { 69 Statement stmt = createStatement(); 70 stmt.execute("DROP TABLE warehouse"); 71 stmt.close(); 72 super.tearDown(); 73 } 74 75 76 80 public void bulkInsertVtiTest() 81 throws SQLException 82 { 83 int expectedRows = 10; 84 Statement stmt = createStatement(); 85 stmt.execute("call SYSCS_UTIL.SYSCS_BULK_INSERT('APP','WAREHOUSE'," + 86 "'org.apache.derbyTesting.functionTests.tests.lang.WarehouseVTI'," 87 +"\'"+expectedRows+"')"); 88 stmt.close(); 89 stmt = createStatement(); 90 ResultSet rs = stmt.executeQuery("SELECT COUNT(*) from warehouse"); 91 rs.next(); 92 assertEquals(expectedRows,rs.getInt(1)); 93 rs.close(); 94 stmt.close(); 95 } 96 } | Popular Tags |