@@ -0,0 +1,2644 @@
+package org.voltdb.utils;%0A%0Aimport org.voltdb.ServerThread;%0Aimport org.voltdb.VoltDB;%0Aimport org.voltdb.VoltTable;%0Aimport org.voltdb.VoltDB.Configuration;%0Aimport org.voltdb.client.Client;%0Aimport org.voltdb.client.ClientFactory;%0Aimport org.voltdb.compiler.VoltProjectBuilder;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class TestCSVLoader extends TestCase %7B%0A%09public void testSimple() throws Exception %7B%0A        String simpleSchema =%0A            %22create table BLAH (%22 +%0A            %22IVAL bigint default 0 not null, %22 +%0A            //%22TVAL timestamp default null,%22 +%0A            %22DVAL decimal default null,%22 +%0A            %22VVAL varchar(10) default null, %22 +%0A            %22PRIMARY KEY(IVAL));%22;%0A%0A        String pathToCatalog = Configuration.getPathToCatalogForTest(%22csv.jar%22);%0A        String pathToDeployment = Configuration.getPathToCatalogForTest(%22csv.xml%22);%0A%0A        VoltProjectBuilder builder = new VoltProjectBuilder();%0A        builder.addLiteralSchema(simpleSchema);%0A        builder.addPartitionInfo(%22BLAH%22, %22IVAL%22);%0A        builder.addStmtProcedure(%22Insert%22, %22insert into blah values (?, ?, ?);%22, null);%0A        builder.addStmtProcedure(%22InsertWithDate%22, %22INSERT INTO BLAH VALUES (974599638818488300, 5, 'nullchar');%22);%0A        boolean success = builder.compile(pathToCatalog, 2, 1, 0);%0A        assertTrue(success);%0A        MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);%0A%0A        VoltDB.Configuration config = new VoltDB.Configuration();%0A        config.m_pathToCatalog = pathToCatalog;%0A        config.m_pathToDeployment = pathToDeployment;%0A        ServerThread localServer = new ServerThread(config);%0A%0A        Client client = null;%0A        try %7B%0A            localServer.start();%0A            localServer.waitForInitialization();%0A%0A            String %5B%5Dparas = %7B%22/Users/xinjia/testdb.csv%22,%22Insert%22%7D;%0A            CSVLoader.main(paras);%0A            %0A            %0A            // do the test%0A            client = ClientFactory.createClient();%0A            client.createConnection(%22localhost%22);%0A            %0A          //VoltTable modCount = client.callProcedure(%22@AdHoc%22, %22INSERT INTO BLAH VALUES (1, 1, 1, 1);%22).getResults()%5B0%5D;%0A            //assertTrue(modCount.getRowCount() == 1);%0A            //assertTrue(modCount.asScalarLong() == 1);%0A            %0A        %7D%0A        finally %7B%0A            if (client != null) client.close();%0A            client = null;%0A%0A            if (localServer != null) %7B%0A                localServer.shutdown();%0A                localServer.join();%0A            %7D%0A            localServer = null;%0A%0A            // no clue how helpful this is%0A            System.gc();%0A        %7D%0A        %0A        %0A%09%7D%0A%09%0A%09%0A%09%0A%09%0A%09%0A%7D%0A

Add a test file to test the CSVLoder class