use of net.sf.jsqlparser.expression.AnalyticExpression in project JSqlParser by JSQLParser.
the class ExpressionDeParserTest method shouldDeParseAnalyticExpressionWithAllColumns.
@Test
public void shouldDeParseAnalyticExpressionWithAllColumns() {
AnalyticExpression analyticExpression = new AnalyticExpression();
analyticExpression.setName("name");
analyticExpression.setAllColumns(true);
expressionDeParser.visit(analyticExpression);
assertEquals("name(*) OVER ()", buffer.toString());
}
use of net.sf.jsqlparser.expression.AnalyticExpression in project JSqlParser by JSQLParser.
the class ExpressionDeParserTest method shouldDeParseAnalyticExpressionWithExpression.
@Test
public void shouldDeParseAnalyticExpressionWithExpression() {
AnalyticExpression analyticExpression = new AnalyticExpression();
Expression expression = mock(Expression.class);
analyticExpression.setName("name");
analyticExpression.setExpression(expression);
will(appendToBuffer("expression")).given(expression).accept(expressionDeParser);
expressionDeParser.visit(analyticExpression);
assertEquals("name(expression) OVER ()", buffer.toString());
}
use of net.sf.jsqlparser.expression.AnalyticExpression in project JSqlParser by JSQLParser.
the class ExpressionDeParserTest method shouldDeParseComplexAnalyticExpressionWithKeep.
@Test
public void shouldDeParseComplexAnalyticExpressionWithKeep() {
AnalyticExpression analyticExpression = new AnalyticExpression();
KeepExpression keep = mock(KeepExpression.class);
analyticExpression.setName("name");
analyticExpression.setKeep(keep);
will(appendToBuffer("keep")).given(keep).accept(expressionDeParser);
expressionDeParser.visit(analyticExpression);
assertEquals("name() keep OVER ()", buffer.toString());
}
use of net.sf.jsqlparser.expression.AnalyticExpression in project JSqlParser by JSQLParser.
the class ExpressionDeParserTest method shouldDeParseAnalyticExpressionWithOffset.
@Test
public void shouldDeParseAnalyticExpressionWithOffset() {
AnalyticExpression analyticExpression = new AnalyticExpression();
Expression expression = mock(Expression.class);
Expression offset = mock(Expression.class);
analyticExpression.setName("name");
analyticExpression.setExpression(expression);
analyticExpression.setOffset(offset);
will(appendToBuffer("expression")).given(expression).accept(expressionDeParser);
will(appendToBuffer("offset")).given(offset).accept(expressionDeParser);
expressionDeParser.visit(analyticExpression);
assertEquals("name(expression, offset) OVER ()", buffer.toString());
}
use of net.sf.jsqlparser.expression.AnalyticExpression in project JSqlParser by JSQLParser.
the class ExpressionDeParserTest method shouldDeParseComplexAnalyticExpressionWithPartitionExpressionList.
@Test
public void shouldDeParseComplexAnalyticExpressionWithPartitionExpressionList() {
AnalyticExpression analyticExpression = new AnalyticExpression();
ExpressionList partitionExpressionList = new ExpressionList();
List<Expression> partitionExpressions = new ArrayList<Expression>();
Expression partitionExpression1 = mock(Expression.class);
Expression partitionExpression2 = mock(Expression.class);
analyticExpression.setName("name");
analyticExpression.setPartitionExpressionList(partitionExpressionList);
partitionExpressionList.setExpressions(partitionExpressions);
partitionExpressions.add(partitionExpression1);
partitionExpressions.add(partitionExpression2);
will(appendToBuffer("partition expression 1")).given(partitionExpression1).accept(expressionDeParser);
will(appendToBuffer("partition expression 2")).given(partitionExpression2).accept(expressionDeParser);
expressionDeParser.visit(analyticExpression);
assertEquals("name() OVER (PARTITION BY partition expression 1, partition expression 2 )", buffer.toString());
}
Aggregations