shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/env/dataset/DataSetEnvironmentManager.java
/**
     * Fill data.
     *
     * @throws SQLException SQL exception
     * @throws ParseException parse exception
     */
Fill data.
@throws SQLException SQL exception
@throws ParseException parse exception
Fill data . @throws SQLException SQL exception @throws ParseException parse exception
public void fillData() throws SQLException, ParseException {
        Map<DataNode, List<DataSetRow>> dataNodeListMap = getDataSetRowMap();
        List<Callable<Void>> fillDataTasks = new LinkedList<>();
        for (Entry<DataNode, List<DataSetRow>> entry : dataNodeListMap.entrySet()) {
            DataNode dataNode = entry.getKey();
            List<DataSetRow> dataSetRows = entry.getValue();
            DataSetMetaData dataSetMetaData = dataSet.findMetaData(dataNode);
            List<SQLValueGroup> sqlValueGroups = new LinkedList<>();
            for (DataSetRow row : dataSetRows) {
                sqlValueGroups.add(new SQLValueGroup(dataSetMetaData, row.splitValues(",")));
            }
            String insertSQL;
            try (Connection connection = actualDataSources.get(dataNode.getDataSourceName()).getConnection()) {
                DatabaseType databaseType = DatabaseTypeRegistry.getDatabaseTypeByURL(connection.getMetaData().getURL());
                insertSQL = generateInsertSQL(databaseType.getQuoteCharacter().wrap(dataNode.getTableName()), dataSetMetaData.getColumns());
            }
            fillDataTasks.add(new InsertTask(actualDataSources.get(dataNode.getDataSourceName()), insertSQL, sqlValueGroups));
        }
        try {
            EXECUTOR_SERVICE_MANAGER.getExecutorService().invokeAll(fillDataTasks);
        } catch (final Exception ex) {
        }
    }
public void fillData ( ) throws SQLException , ParseException { Map < DataNode , List < DataSetRow > > dataNodeListMap = getDataSetRowMap ( ) ; List < Callable < Void > > fillDataTasks = new LinkedList < > ( ) ; for ( Entry < DataNode , List < DataSetRow > > entry : dataNodeListMap . entrySet ( ) ) { DataNode dataNode = entry . getKey ( ) ; List < DataSetRow > dataSetRows = entry . getValue ( ) ; DataSetMetaData dataSetMetaData = dataSet . findMetaData ( dataNode ) ; List < SQLValueGroup > sqlValueGroups = new LinkedList < > ( ) ; for ( DataSetRow row : dataSetRows ) { sqlValueGroups . add ( new SQLValueGroup ( dataSetMetaData , row . splitValues ( "," ) ) ) ; } String insertSQL ; try ( Connection connection = actualDataSources . get ( dataNode . getDataSourceName ( ) ) . getConnection ( ) ) { DatabaseType databaseType = DatabaseTypeRegistry . getDatabaseTypeByURL ( connection . getMetaData ( ) . getURL ( ) ) ; insertSQL = generateInsertSQL ( databaseType . getQuoteCharacter ( ) . wrap ( dataNode . getTableName ( ) ) , dataSetMetaData . getColumns ( ) ) ; } fillDataTasks . add ( new InsertTask ( actualDataSources . get ( dataNode . getDataSourceName ( ) ) , insertSQL , sqlValueGroups ) ) ; } try { EXECUTOR_SERVICE_MANAGER . getExecutorService ( ) . invokeAll ( fillDataTasks ) ; } catch ( final Exception ex ) { } }
Fill data.
Fill data .
// CHECKSTYLE:OFF // CHECKSTYLE:ON