Search in sources :

Example 1 with ExpectedAggregationSelectItem

use of io.shardingjdbc.core.parsing.integrate.jaxb.item.ExpectedAggregationSelectItem in project sharding-jdbc by shardingjdbc.

the class AggregationSelectItemAssert method assertAggregationSelectItem.

private void assertAggregationSelectItem(final AggregationSelectItem actual, final ExpectedAggregationSelectItem expected) {
    assertThat(assertMessage.getFullAssertMessage("Aggregation select item aggregation type assertion error: "), actual.getType().name(), is(expected.getType()));
    assertThat(assertMessage.getFullAssertMessage("Aggregation select item inner expression assertion error: "), actual.getInnerExpression(), is(expected.getInnerExpression()));
    assertThat(assertMessage.getFullAssertMessage("Aggregation select item alias assertion error: "), actual.getAlias().orNull(), is(expected.getAlias()));
    assertThat(assertMessage.getFullAssertMessage("Aggregation select item index assertion error: "), actual.getIndex(), is(expected.getIndex()));
    assertThat(assertMessage.getFullAssertMessage("Aggregation select item derived aggregation select items assertion error: "), actual.getDerivedAggregationSelectItems().size(), is(expected.getDerivedColumns().size()));
    int count = 0;
    for (AggregationSelectItem each : actual.getDerivedAggregationSelectItems()) {
        assertAggregationSelectItem(each, expected.getDerivedColumns().get(count));
        count++;
    }
}
Also used : AggregationSelectItem(io.shardingjdbc.core.parsing.parser.context.selectitem.AggregationSelectItem) ExpectedAggregationSelectItem(io.shardingjdbc.core.parsing.integrate.jaxb.item.ExpectedAggregationSelectItem)

Example 2 with ExpectedAggregationSelectItem

use of io.shardingjdbc.core.parsing.integrate.jaxb.item.ExpectedAggregationSelectItem in project sharding-jdbc by shardingjdbc.

the class AggregationSelectItemAssert method assertAggregationSelectItems.

void assertAggregationSelectItems(final Set<SelectItem> actual, final List<ExpectedAggregationSelectItem> expected) {
    List<AggregationSelectItem> aggregationSelectItems = getAggregationSelectItems(actual);
    assertThat(assertMessage.getFullAssertMessage("Table tokens size error: "), aggregationSelectItems.size(), is(expected.size()));
    int count = 0;
    for (AggregationSelectItem each : aggregationSelectItems) {
        assertAggregationSelectItem(each, expected.get(count));
        count++;
    }
}
Also used : AggregationSelectItem(io.shardingjdbc.core.parsing.parser.context.selectitem.AggregationSelectItem) ExpectedAggregationSelectItem(io.shardingjdbc.core.parsing.integrate.jaxb.item.ExpectedAggregationSelectItem)

Aggregations

ExpectedAggregationSelectItem (io.shardingjdbc.core.parsing.integrate.jaxb.item.ExpectedAggregationSelectItem)2 AggregationSelectItem (io.shardingjdbc.core.parsing.parser.context.selectitem.AggregationSelectItem)2