Java Code Examples for org.dbunit.database.IDatabaseConnection#createQueryTable()

The following examples show how to use org.dbunit.database.IDatabaseConnection#createQueryTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ITKylinQueryTest.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testInvalidQuery() throws Exception {

    logger.info("-------------------- Test Invalid Query --------------------");
    String queryFolder = getQueryFolderPrefix() + "src/test/resources/query/sql_invalid";
    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        logger.info("Testing Query " + queryName);
        String sql = getTextFromFile(sqlFile);
        IDatabaseConnection cubeConn = new DatabaseConnection(cubeConnection);
        try {
            cubeConn.createQueryTable(queryName, sql);
        } catch (Throwable t) {
            continue;
        } finally {
            cubeConn.close();
        }
        throw new IllegalStateException(queryName + " should be error!");
    }
}
 
Example 2
Source File: ITKylinQueryTest.java    From kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testInvalidQuery() throws Exception {

    logger.info("-------------------- Test Invalid Query --------------------");
    String queryFolder = getQueryFolderPrefix() + "src/test/resources/query/sql_invalid";
    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        logger.info("Testing Query " + queryName);
        String sql = getTextFromFile(sqlFile);
        IDatabaseConnection cubeConn = new DatabaseConnection(cubeConnection);
        try {
            cubeConn.createQueryTable(queryName, sql);
        } catch (Throwable t) {
            continue;
        } finally {
            cubeConn.close();
        }
        throw new IllegalStateException(queryName + " should be error!");
    }
}
 
Example 3
Source File: KylinQueryTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Test
public void testInvalidQuery() throws Exception {

    printInfo("-------------------- Test Invalid Query --------------------");
    String queryFolder = "src/test/resources/query/sql_invalid";
    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        printInfo("Testing Query " + queryName);
        String sql = getTextFromFile(sqlFile);
        IDatabaseConnection cubeConn = new DatabaseConnection(cubeConnection);
        try {
            cubeConn.createQueryTable(queryName, sql);
        } catch (Throwable t) {
            continue;
        } finally {
            cubeConn.close();
        }
        throw new IllegalStateException(queryName + " should be error!");
    }
}
 
Example 4
Source File: FosstrakDatabaseHelper.java    From fosstrak-epcis with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static ITable getObjectEventByEpc(IDatabaseConnection connection, String epc) throws Exception {
    String sql = "SELECT event.eventTime, epc.epc FROM `event_objectevent_epcs` epc, `event_objectevent` event WHERE epc.event_id=event.id AND epc.epc='" + epc +"'";
    ITable table = connection.createQueryTable("SingleObjectEvent", sql);
    return table;
}
 
Example 5
Source File: FosstrakDatabaseHelper.java    From fosstrak-epcis with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static ITable getTransactionEventByEpc(IDatabaseConnection connection, String epc) throws Exception {
    String sql = "SELECT event.eventTime, epc.epc FROM `event_transactionevent_epcs` epc, `event_transactionevent` event WHERE epc.event_id=event.id AND epc.epc='" + epc +"'";
    ITable table = connection.createQueryTable("SingleTransactionEvent", sql);
    return table;
}
 
Example 6
Source File: FosstrakDatabaseHelper.java    From fosstrak-epcis with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static ITable getQuantityEventByEpcClass(IDatabaseConnection connection, String epcClass) throws Exception {
    String sql = "SELECT event.eventTime, epc.uri FROM `voc_epcclass` epc, `event_quantityevent` event WHERE epc.id=event.epcClass AND epc.uri='" + epcClass +"'";
    ITable table = connection.createQueryTable("SingleQuantityEvent", sql);
    return table;
}
 
Example 7
Source File: FosstrakDatabaseHelper.java    From fosstrak-epcis with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static ITable getAggregationEventByChildEpc(IDatabaseConnection connection, String epc) throws Exception {
    String sql = "SELECT event.eventTime, epc.epc FROM `event_aggregationevent_epcs` epc, `event_aggregationevent` event WHERE epc.event_id=event.id AND epc.epc='" + epc +"'";
    ITable table = connection.createQueryTable("SingleAggregationEvent", sql);
    return table;
}