Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
c6b2fd99
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c6b2fd99
编写于
9月 04, 2019
作者:
L
Liang Zhang
提交者:
GitHub
9月 04, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2968 from nancyzrh/dev
for where predicate assertion
上级
d524bdb8
937652d9
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
861 addition
and
1 deletion
+861
-1
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/asserts/ShardingSQLStatementAssert.java
...e/parse/integrate/asserts/ShardingSQLStatementAssert.java
+9
-1
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/asserts/predicate/PredicateAssert.java
...re/parse/integrate/asserts/predicate/PredicateAssert.java
+138
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/ExpectedExpressionSegment.java
.../parse/integrate/jaxb/expr/ExpectedExpressionSegment.java
+21
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedBaseComplexExpression.java
...rate/jaxb/expr/complex/ExpectedBaseComplexExpression.java
+40
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedCommonExpressionSegment.java
...te/jaxb/expr/complex/ExpectedCommonExpressionSegment.java
+30
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedComplexExpressionSegment.java
...e/jaxb/expr/complex/ExpectedComplexExpressionSegment.java
+30
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedSubquerySegment.java
.../integrate/jaxb/expr/complex/ExpectedSubquerySegment.java
+30
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedBaseSimpleExpression.java
...egrate/jaxb/expr/simple/ExpectedBaseSimpleExpression.java
+37
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedLiteralExpressionSegment.java
...te/jaxb/expr/simple/ExpectedLiteralExpressionSegment.java
+34
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedParamMarkerExpressionSegment.java
...axb/expr/simple/ExpectedParamMarkerExpressionSegment.java
+34
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedSimpleExpressionSegment.java
...ate/jaxb/expr/simple/ExpectedSimpleExpressionSegment.java
+23
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedAndPredicate.java
.../parse/integrate/jaxb/predicate/ExpectedAndPredicate.java
+38
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedBaseSegment.java
...e/parse/integrate/jaxb/predicate/ExpectedBaseSegment.java
+37
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedColumnSegment.java
...parse/integrate/jaxb/predicate/ExpectedColumnSegment.java
+43
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedPredicateSegment.java
...se/integrate/jaxb/predicate/ExpectedPredicateSegment.java
+65
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedWhereSegment.java
.../parse/integrate/jaxb/predicate/ExpectedWhereSegment.java
+41
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateBetweenRightValue.java
...b/predicate/value/ExpectedPredicateBetweenRightValue.java
+59
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateCompareRightValue.java
...b/predicate/value/ExpectedPredicateCompareRightValue.java
+74
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateInRightValue.java
...e/jaxb/predicate/value/ExpectedPredicateInRightValue.java
+53
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateRightValue.java
...ate/jaxb/predicate/value/ExpectedPredicateRightValue.java
+21
-0
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/root/ParserResult.java
...ngsphere/core/parse/integrate/jaxb/root/ParserResult.java
+4
-0
未找到文件。
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/asserts/ShardingSQLStatementAssert.java
浏览文件 @
c6b2fd99
...
@@ -22,6 +22,7 @@ import org.apache.shardingsphere.core.parse.integrate.asserts.groupby.GroupByAss
...
@@ -22,6 +22,7 @@ import org.apache.shardingsphere.core.parse.integrate.asserts.groupby.GroupByAss
import
org.apache.shardingsphere.core.parse.integrate.asserts.index.IndexAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.index.IndexAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.orderby.OrderByAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.orderby.OrderByAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.pagination.PaginationAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.pagination.PaginationAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.predicate.PredicateAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.selectitem.SelectItemAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.selectitem.SelectItemAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.table.AlterTableAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.table.AlterTableAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.table.TableAssert
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.table.TableAssert
;
...
@@ -31,6 +32,7 @@ import org.apache.shardingsphere.core.parse.sql.segment.dml.item.SelectItemsSegm
...
@@ -31,6 +32,7 @@ import org.apache.shardingsphere.core.parse.sql.segment.dml.item.SelectItemsSegm
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.GroupBySegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.GroupBySegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.OrderBySegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.order.OrderBySegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.pagination.limit.LimitSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.pagination.limit.LimitSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.WhereSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.generic.TableSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.generic.TableSegment
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.SQLStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.ddl.AlterTableStatement
;
import
org.apache.shardingsphere.core.parse.sql.statement.ddl.AlterTableStatement
;
...
@@ -67,6 +69,8 @@ public final class ShardingSQLStatementAssert {
...
@@ -67,6 +69,8 @@ public final class ShardingSQLStatementAssert {
private
final
AlterTableAssert
alterTableAssert
;
private
final
AlterTableAssert
alterTableAssert
;
private
final
SelectItemAssert
selectItemAssert
;
private
final
SelectItemAssert
selectItemAssert
;
private
final
PredicateAssert
predicateAssert
;
public
ShardingSQLStatementAssert
(
final
SQLStatement
actual
,
final
String
sqlCaseId
,
final
SQLCaseType
sqlCaseType
)
{
public
ShardingSQLStatementAssert
(
final
SQLStatement
actual
,
final
String
sqlCaseId
,
final
SQLCaseType
sqlCaseType
)
{
SQLStatementAssertMessage
assertMessage
=
new
SQLStatementAssertMessage
(
SQLStatementAssertMessage
assertMessage
=
new
SQLStatementAssertMessage
(
...
@@ -80,6 +84,7 @@ public final class ShardingSQLStatementAssert {
...
@@ -80,6 +84,7 @@ public final class ShardingSQLStatementAssert {
paginationAssert
=
new
PaginationAssert
(
sqlCaseType
,
assertMessage
);
paginationAssert
=
new
PaginationAssert
(
sqlCaseType
,
assertMessage
);
alterTableAssert
=
new
AlterTableAssert
(
assertMessage
);
alterTableAssert
=
new
AlterTableAssert
(
assertMessage
);
selectItemAssert
=
new
SelectItemAssert
(
sqlCaseType
,
assertMessage
);
selectItemAssert
=
new
SelectItemAssert
(
sqlCaseType
,
assertMessage
);
predicateAssert
=
new
PredicateAssert
(
sqlCaseType
,
assertMessage
);
}
}
/**
/**
...
@@ -100,7 +105,6 @@ public final class ShardingSQLStatementAssert {
...
@@ -100,7 +105,6 @@ public final class ShardingSQLStatementAssert {
}
}
private
void
assertSelectStatement
(
final
SelectStatement
actual
)
{
private
void
assertSelectStatement
(
final
SelectStatement
actual
)
{
// TODO do select items assert
Optional
<
SelectItemsSegment
>
selectItemsSegment
=
actual
.
findSQLSegment
(
SelectItemsSegment
.
class
);
Optional
<
SelectItemsSegment
>
selectItemsSegment
=
actual
.
findSQLSegment
(
SelectItemsSegment
.
class
);
if
(
selectItemsSegment
.
isPresent
())
{
if
(
selectItemsSegment
.
isPresent
())
{
selectItemAssert
.
assertSelectItems
(
selectItemsSegment
.
get
(),
expected
.
getSelectItems
());
selectItemAssert
.
assertSelectItems
(
selectItemsSegment
.
get
(),
expected
.
getSelectItems
());
...
@@ -118,6 +122,10 @@ public final class ShardingSQLStatementAssert {
...
@@ -118,6 +122,10 @@ public final class ShardingSQLStatementAssert {
paginationAssert
.
assertOffset
(
limitSegment
.
get
().
getOffset
().
orNull
(),
expected
.
getOffset
());
paginationAssert
.
assertOffset
(
limitSegment
.
get
().
getOffset
().
orNull
(),
expected
.
getOffset
());
paginationAssert
.
assertRowCount
(
limitSegment
.
get
().
getRowCount
().
orNull
(),
expected
.
getRowCount
());
paginationAssert
.
assertRowCount
(
limitSegment
.
get
().
getRowCount
().
orNull
(),
expected
.
getRowCount
());
}
}
Optional
<
WhereSegment
>
whereSegment
=
actual
.
findSQLSegment
(
WhereSegment
.
class
);
if
(
whereSegment
.
isPresent
()
&&
null
!=
expected
.
getWhereSegment
())
{
predicateAssert
.
assertPredicate
(
whereSegment
.
get
(),
expected
.
getWhereSegment
());
}
}
}
private
void
assertAlterTableStatement
(
final
AlterTableStatement
actual
)
{
private
void
assertAlterTableStatement
(
final
AlterTableStatement
actual
)
{
...
...
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/asserts/predicate/PredicateAssert.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.asserts.predicate
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.shardingsphere.core.parse.integrate.asserts.SQLStatementAssertMessage
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.ExpectedExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedCommonExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedSubquerySegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedLiteralExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedParamMarkerExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.ExpectedAndPredicate
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.ExpectedColumnSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.ExpectedPredicateSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.ExpectedWhereSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value.ExpectedPredicateCompareRightValue
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.column.ColumnSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.ExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.complex.CommonExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.complex.ComplexExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.complex.SubquerySegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.LiteralExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.AndPredicate
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.PredicateSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.WhereSegment
;
import
org.apache.shardingsphere.core.parse.sql.segment.dml.predicate.value.PredicateCompareRightValue
;
import
org.apache.shardingsphere.test.sql.SQLCaseType
;
import
java.util.Collection
;
import
java.util.List
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* where predicate assert.
*
* @author zhaoyanan
*/
@RequiredArgsConstructor
public
final
class
PredicateAssert
{
private
final
SQLCaseType
sqlCaseType
;
private
final
SQLStatementAssertMessage
assertMessage
;
/**
* assert predicate
* @param actual actual where segment
* @param expected expected where segment
*/
public
void
assertPredicate
(
final
WhereSegment
actual
,
final
ExpectedWhereSegment
expected
)
{
if
(
SQLCaseType
.
Placeholder
==
sqlCaseType
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"parameters count assertion error:"
),
actual
.
getParametersCount
(),
is
(
expected
.
getParametersCount
()));
}
assertAndPredicate
(
actual
.
getAndPredicates
(),
expected
.
getAndPredicates
());
}
/**
* assert and predicate
* @param actual actual and predicate
* @param expected expected and predicate
*/
private
void
assertAndPredicate
(
final
Collection
<
AndPredicate
>
actual
,
final
List
<
ExpectedAndPredicate
>
expected
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"and predicate size error: "
),
actual
.
size
(),
is
(
expected
.
size
()));
int
count
=
0
;
for
(
AndPredicate
each:
actual
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"predicate segment size error: "
),
each
.
getPredicates
().
size
(),
is
(
expected
.
get
(
count
).
getPredicates
().
size
()));
assertPredicateSegment
(
each
.
getPredicates
(),
expected
.
get
(
count
).
getPredicates
());
count
++;
}
}
/**
* assert predicate segment
* @param actual actual predicate segment
* @param expected expected predicate segment
*/
private
void
assertPredicateSegment
(
final
Collection
<
PredicateSegment
>
actual
,
final
List
<
ExpectedPredicateSegment
>
expected
)
{
int
count
=
0
;
for
(
PredicateSegment
each:
actual
)
{
assertColumnSegment
(
each
.
getColumn
(),
expected
.
get
(
count
).
getColumn
());
if
(
each
.
getRightValue
()
instanceof
PredicateCompareRightValue
)
{
assertCompareRightValue
((
PredicateCompareRightValue
)
each
.
getRightValue
(),
expected
.
get
(
count
).
findExpectedRightValue
(
ExpectedPredicateCompareRightValue
.
class
));
}
//TODO add expr assertion
count
++;
}
}
/**
* assert column segment
* @param actual actual column segment
* @param expected expected column segment
*/
private
void
assertColumnSegment
(
final
ColumnSegment
actual
,
final
ExpectedColumnSegment
expected
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"column segment name assertion error: "
),
actual
.
getName
(),
is
(
expected
.
getName
()));
assertThat
(
assertMessage
.
getFullAssertMessage
(
"column segment table name assertion error: "
),
actual
.
getOwner
().
isPresent
()
?
actual
.
getOwner
().
get
().
getTableName
()
:
null
,
is
(
expected
.
getOwner
().
getName
()));
}
/**
* assert expr and operation
* @param actual
* @param expected
*/
private
void
assertCompareRightValue
(
final
PredicateCompareRightValue
actual
,
final
ExpectedPredicateCompareRightValue
expected
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"right value operator assertion error: "
),
actual
.
getOperator
(),
is
(
expected
.
getOperator
()));
if
(
actual
.
getExpression
()
instanceof
ParameterMarkerExpressionSegment
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"parameter marker expression parameterMarkerindex assertion error"
),((
ParameterMarkerExpressionSegment
)
actual
.
getExpression
()).
getParameterMarkerIndex
(),
is
(
expected
.
findExpectedExpression
(
ExpectedParamMarkerExpressionSegment
.
class
).
getParameterMarkerIndex
()));
}
if
(
actual
.
getExpression
()
instanceof
CommonExpressionSegment
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"common expression text assertion error: "
),((
ComplexExpressionSegment
)
actual
.
getExpression
()).
getText
(),
is
(
expected
.
findExpectedExpression
(
ExpectedCommonExpressionSegment
.
class
).
getText
()));
}
if
(
actual
.
getExpression
()
instanceof
SubquerySegment
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"subquery segment text assertion error: "
),((
ComplexExpressionSegment
)
actual
.
getExpression
()).
getText
(),
is
(
expected
.
findExpectedExpression
(
ExpectedSubquerySegment
.
class
).
getText
()));
}
if
(
actual
.
getExpression
()
instanceof
LiteralExpressionSegment
)
{
assertThat
(
assertMessage
.
getFullAssertMessage
(
"literal assertion error:"
),((
LiteralExpressionSegment
)
actual
.
getExpression
()).
getLiterals
().
toString
(),
is
(
expected
.
findExpectedExpression
(
ExpectedLiteralExpressionSegment
.
class
).
getLiterals
().
toString
()));
}
}
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/ExpectedExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr
;
public
interface
ExpectedExpressionSegment
{
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedBaseComplexExpression.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
ExpectedBaseComplexExpression
implements
ExpectedComplexExpressionSegment
{
@XmlAttribute
(
name
=
"start-index"
)
private
Integer
startIndex
;
@XmlAttribute
(
name
=
"stop-index"
)
private
Integer
stopIndex
;
@XmlAttribute
private
String
text
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedCommonExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedCommonExpressionSegment
extends
ExpectedBaseComplexExpression
{
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedComplexExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.ExpectedExpressionSegment
;
public
interface
ExpectedComplexExpressionSegment
extends
ExpectedExpressionSegment
{
/**
* Get text.
*
* @return text
*/
String
getText
();
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/complex/ExpectedSubquerySegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedSubquerySegment
extends
ExpectedBaseComplexExpression
{
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedBaseSimpleExpression.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
ExpectedBaseSimpleExpression
implements
ExpectedSimpleExpressionSegment
{
@XmlAttribute
(
name
=
"start-index"
)
private
int
startIndex
;
@XmlAttribute
(
name
=
"stop-index"
)
private
int
stopIndex
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedLiteralExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedLiteralExpressionSegment
extends
ExpectedBaseSimpleExpression
{
@XmlAttribute
private
Integer
literals
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedParamMarkerExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedParamMarkerExpressionSegment
extends
ExpectedBaseSimpleExpression
{
@XmlAttribute
private
Integer
parameterMarkerIndex
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/expr/simple/ExpectedSimpleExpressionSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.ExpectedExpressionSegment
;
public
interface
ExpectedSimpleExpressionSegment
extends
ExpectedExpressionSegment
{
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedAndPredicate.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
import
java.util.LinkedList
;
import
java.util.List
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedAndPredicate
{
@XmlElementWrapper
(
name
=
"predicate-segments"
)
@XmlElement
(
name
=
"predicate-segment"
)
private
List
<
ExpectedPredicateSegment
>
predicates
=
new
LinkedList
<>();
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedBaseSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
ExpectedBaseSegment
{
@XmlAttribute
(
name
=
"start-index"
)
private
Integer
startIndex
;
@XmlAttribute
(
name
=
"stop-index"
)
private
Integer
stopIndex
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedColumnSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.core.constant.QuoteCharacter
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.selectitem.ExpectedTableSegment
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlElement
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedColumnSegment
extends
ExpectedBaseSegment
{
@XmlAttribute
private
String
name
;
@XmlAttribute
private
QuoteCharacter
quoteCharacter
=
QuoteCharacter
.
NONE
;
@XmlElement
(
name
=
"table-segment"
)
private
ExpectedTableSegment
owner
=
new
ExpectedTableSegment
();
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedPredicateSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value.ExpectedPredicateBetweenRightValue
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value.ExpectedPredicateCompareRightValue
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value.ExpectedPredicateInRightValue
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value.ExpectedPredicateRightValue
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedPredicateSegment
extends
ExpectedBaseSegment
{
@XmlElement
(
name
=
"column-segment"
)
private
ExpectedColumnSegment
column
=
new
ExpectedColumnSegment
();
@XmlElement
(
name
=
"predicate-between-right-value"
)
private
ExpectedPredicateBetweenRightValue
betweenRightValue
=
new
ExpectedPredicateBetweenRightValue
();
@XmlElement
(
name
=
"predicate-in-right-value"
)
private
ExpectedPredicateInRightValue
inRightValue
=
new
ExpectedPredicateInRightValue
();
@XmlElement
(
name
=
"predicate-compare-right-value"
)
private
ExpectedPredicateCompareRightValue
compareRightValue
=
new
ExpectedPredicateCompareRightValue
();
/**
* find expected right value type
* @param expectedPredicateRightValue
* @return right value
*/
public
<
T
extends
ExpectedPredicateRightValue
>
T
findExpectedRightValue
(
final
Class
<
T
>
expectedPredicateRightValue
)
{
if
(
expectedPredicateRightValue
.
isAssignableFrom
(
ExpectedPredicateCompareRightValue
.
class
))
{
return
(
T
)
compareRightValue
;
}
if
(
expectedPredicateRightValue
.
isAssignableFrom
(
ExpectedPredicateInRightValue
.
class
))
{
return
(
T
)
inRightValue
;
}
if
(
expectedPredicateRightValue
.
isAssignableFrom
(
ExpectedPredicateBetweenRightValue
.
class
))
{
return
(
T
)
betweenRightValue
;
}
return
null
;
}
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/ExpectedWhereSegment.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.xml.bind.annotation.*
;
import
java.util.LinkedList
;
import
java.util.List
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedWhereSegment
extends
ExpectedBaseSegment
{
@XmlAttribute
private
Integer
parametersCount
;
@XmlElementWrapper
(
name
=
"and-predicates"
)
@XmlElement
(
name
=
"and-predicate"
)
private
List
<
ExpectedAndPredicate
>
andPredicates
=
new
LinkedList
<>();
@XmlAttribute
private
Integer
parameterStartIndex
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateBetweenRightValue.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedCommonExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedSubquerySegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedLiteralExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedParamMarkerExpressionSegment
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedPredicateBetweenRightValue
implements
ExpectedPredicateRightValue
{
@XmlElement
(
name
=
"between-common-expression"
)
private
ExpectedCommonExpressionSegment
betweenCommonExpressionSegment
;
@XmlElement
(
name
=
"between-subquery-segment"
)
private
ExpectedSubquerySegment
betweenSubquerySegment
;
@XmlElement
(
name
=
"between-literal-expression"
)
private
ExpectedLiteralExpressionSegment
betweenLiteralExpression
;
@XmlElement
(
name
=
"between-param-marker-expression"
)
private
ExpectedParamMarkerExpressionSegment
betweenParamMarkerExpression
;
@XmlElement
(
name
=
"and-subquery-segment"
)
private
ExpectedSubquerySegment
andSubquerySegment
;
@XmlElement
(
name
=
"and-common-expression"
)
private
ExpectedCommonExpressionSegment
andCommonExpressionSegment
;
@XmlElement
(
name
=
"and-literal-expression"
)
private
ExpectedLiteralExpressionSegment
andLiteralExpression
;
@XmlElement
(
name
=
"and-param-marker-expression"
)
private
ExpectedParamMarkerExpressionSegment
andParamMarkerExpression
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateCompareRightValue.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.ExpectedExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedCommonExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedComplexExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedSubquerySegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedLiteralExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedParamMarkerExpressionSegment
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlElement
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedPredicateCompareRightValue
implements
ExpectedPredicateRightValue
{
@XmlAttribute
private
String
operator
;
@XmlElement
(
name
=
"common-expression"
)
private
ExpectedCommonExpressionSegment
commonExpressionSegment
;
@XmlElement
(
name
=
"subquery-segment"
)
private
ExpectedSubquerySegment
subquerySegment
;
@XmlElement
(
name
=
"literal-expression"
)
private
ExpectedLiteralExpressionSegment
literalExpression
;
@XmlElement
(
name
=
"param-marker-expression"
)
private
ExpectedParamMarkerExpressionSegment
paramMarkerExpression
;
/**
* find expected expression
* @param expectedExpressionSegment
* @return expression segment
*/
public
<
T
extends
ExpectedExpressionSegment
>
T
findExpectedExpression
(
final
Class
<
T
>
expectedExpressionSegment
)
{
if
(
expectedExpressionSegment
.
isAssignableFrom
(
ExpectedParamMarkerExpressionSegment
.
class
))
{
return
(
T
)
paramMarkerExpression
;
}
if
(
expectedExpressionSegment
.
isAssignableFrom
(
ExpectedLiteralExpressionSegment
.
class
))
{
return
(
T
)
literalExpression
;
}
if
(
expectedExpressionSegment
.
isAssignableFrom
(
ExpectedCommonExpressionSegment
.
class
))
{
return
(
T
)
commonExpressionSegment
;
}
if
(
expectedExpressionSegment
.
isAssignableFrom
(
ExpectedComplexExpressionSegment
.
class
))
{
return
(
T
)
subquerySegment
;
}
return
null
;
}
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateInRightValue.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedCommonExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.complex.ExpectedSubquerySegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedLiteralExpressionSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.expr.simple.ExpectedParamMarkerExpressionSegment
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
import
java.util.Collection
;
@Getter
@Setter
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
final
class
ExpectedPredicateInRightValue
implements
ExpectedPredicateRightValue
{
@XmlElementWrapper
(
name
=
"common-expressions"
)
@XmlElement
(
name
=
"common-expression"
)
private
Collection
<
ExpectedCommonExpressionSegment
>
commonExpressionSegments
;
@XmlElementWrapper
(
name
=
"subquery-segments"
)
@XmlElement
(
name
=
"subquery-segment"
)
private
Collection
<
ExpectedSubquerySegment
>
subquerySegments
;
@XmlElementWrapper
(
name
=
"literal-expressions"
)
@XmlElement
(
name
=
"literal-expression"
)
private
Collection
<
ExpectedLiteralExpressionSegment
>
literalExpressionSegments
;
@XmlElementWrapper
(
name
=
"param-marker-expressions"
)
@XmlElement
(
name
=
"param-marker-expression"
)
private
Collection
<
ExpectedParamMarkerExpressionSegment
>
paramMarkerExpressionSegments
;
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/predicate/value/ExpectedPredicateRightValue.java
0 → 100644
浏览文件 @
c6b2fd99
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.value
;
public
interface
ExpectedPredicateRightValue
{
}
sharding-core/sharding-core-parse/sharding-core-parse-test/src/test/java/org/apache/shardingsphere/core/parse/integrate/jaxb/root/ParserResult.java
浏览文件 @
c6b2fd99
...
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.core.parse.integrate.jaxb.groupby.ExpectedGroup
...
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.core.parse.integrate.jaxb.groupby.ExpectedGroup
import
org.apache.shardingsphere.core.parse.integrate.jaxb.insert.ExpectedInsertColumnsAndValues
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.insert.ExpectedInsertColumnsAndValues
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.orderby.ExpectedOrderByColumn
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.orderby.ExpectedOrderByColumn
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.pagination.ExpectedPaginationValue
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.pagination.ExpectedPaginationValue
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.predicate.ExpectedWhereSegment
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.selectitem.ExpectedSelectItems
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.selectitem.ExpectedSelectItems
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.table.ExpectedAlterTable
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.table.ExpectedAlterTable
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.table.ExpectedTable
;
import
org.apache.shardingsphere.core.parse.integrate.jaxb.table.ExpectedTable
;
...
@@ -88,6 +89,9 @@ public final class ParserResult {
...
@@ -88,6 +89,9 @@ public final class ParserResult {
@XmlElement
(
name
=
"select-items"
)
@XmlElement
(
name
=
"select-items"
)
private
ExpectedSelectItems
selectItems
=
new
ExpectedSelectItems
();
private
ExpectedSelectItems
selectItems
=
new
ExpectedSelectItems
();
@XmlElement
(
name
=
"where-segment"
)
private
ExpectedWhereSegment
whereSegment
;
/**
/**
* Get parameters.
* Get parameters.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录