Search in sources :

Example 21 with TestQueryResult

use of io.shardingjdbc.core.merger.fixture.TestQueryResult in project sharding-jdbc by shardingjdbc.

the class RowNumberDecoratorMergedResultTest method setUp.

@Before
public void setUp() throws SQLException {
    ResultSet resultSet = mock(ResultSet.class);
    ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
    when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
    List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
    for (ResultSet each : resultSets) {
        when(each.next()).thenReturn(true, true, false);
    }
    queryResults = new ArrayList<>(resultSets.size());
    for (ResultSet each : resultSets) {
        queryResults.add(new TestQueryResult(each));
    }
    selectStatement = new SelectStatement();
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) TestQueryResult(io.shardingjdbc.core.merger.fixture.TestQueryResult) SelectStatement(io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement) ResultSet(java.sql.ResultSet) Before(org.junit.Before)

Example 22 with TestQueryResult

use of io.shardingjdbc.core.merger.fixture.TestQueryResult in project sharding-jdbc by shardingjdbc.

the class TopAndRowNumberDecoratorMergedResultTest method setUp.

@Before
public void setUp() throws SQLException {
    ResultSet resultSet = mock(ResultSet.class);
    ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class);
    when(resultSet.getMetaData()).thenReturn(resultSetMetaData);
    List<ResultSet> resultSets = Lists.newArrayList(resultSet, mock(ResultSet.class), mock(ResultSet.class), mock(ResultSet.class));
    for (ResultSet each : resultSets) {
        when(each.next()).thenReturn(true, true, false);
    }
    queryResults = new ArrayList<>(resultSets.size());
    for (ResultSet each : resultSets) {
        queryResults.add(new TestQueryResult(each));
    }
    selectStatement = new SelectStatement();
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) TestQueryResult(io.shardingjdbc.core.merger.fixture.TestQueryResult) SelectStatement(io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement) ResultSet(java.sql.ResultSet) Before(org.junit.Before)

Aggregations

TestQueryResult (io.shardingjdbc.core.merger.fixture.TestQueryResult)22 Before (org.junit.Before)14 ResultSet (java.sql.ResultSet)13 ResultSetMetaData (java.sql.ResultSetMetaData)11 OrderItem (io.shardingjdbc.core.parsing.parser.context.OrderItem)9 SelectStatement (io.shardingjdbc.core.parsing.parser.sql.dql.select.SelectStatement)8 Test (org.junit.Test)7 TestComplexKeysShardingAlgorithm (io.shardingjdbc.core.api.algorithm.fixture.TestComplexKeysShardingAlgorithm)2 ShardingRuleConfiguration (io.shardingjdbc.core.api.config.ShardingRuleConfiguration)2 TableRuleConfiguration (io.shardingjdbc.core.api.config.TableRuleConfiguration)2 ComplexShardingStrategyConfiguration (io.shardingjdbc.core.api.config.strategy.ComplexShardingStrategyConfiguration)2 AggregationSelectItem (io.shardingjdbc.core.parsing.parser.context.selectitem.AggregationSelectItem)2 ShardingRule (io.shardingjdbc.core.rule.ShardingRule)2 MergedResult (io.shardingjdbc.core.merger.MergedResult)1 DQLMergeEngine (io.shardingjdbc.core.merger.dql.DQLMergeEngine)1 TestStreamMergedResult (io.shardingjdbc.core.merger.dql.common.fixture.TestStreamMergedResult)1