Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mybatis-generator-plugin
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mybatis-generator-plugin
Commits
2878b982
Commit
2878b982
authored
May 28, 2018
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TableConfigurationPlugin 测试用例
parent
2b326a2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
src/test/java/com/itfsw/mybatis/generator/plugins/TableConfigurationPluginTest.java
...batis/generator/plugins/TableConfigurationPluginTest.java
+12
-1
src/test/resources/scripts/TableConfigurationPlugin/mybatis-generator-with-columnRenamingRule.xml
...ationPlugin/mybatis-generator-with-columnRenamingRule.xml
+4
-1
src/test/resources/scripts/TableConfigurationPlugin/mybatis-generator-with-domainObjectRenamingRule.xml
...lugin/mybatis-generator-with-domainObjectRenamingRule.xml
+4
-0
No files found.
src/test/java/com/itfsw/mybatis/generator/plugins/TableConfigurationPluginTest.java
View file @
2878b982
...
...
@@ -53,7 +53,9 @@ public class TableConfigurationPluginTest {
MyBatisGenerator
myBatisGenerator
=
tool
.
generate
();
for
(
GeneratedJavaFile
file
:
myBatisGenerator
.
getGeneratedJavaFiles
()){
String
name
=
file
.
getCompilationUnit
().
getType
().
getShortName
();
Assert
.
assertTrue
(
name
.
matches
(
"Testb.*"
));
if
(!(
name
.
matches
(
"Testb.*"
)
||
name
.
matches
(
"TbBlobs.*"
))){
Assert
.
assertTrue
(
false
);
}
}
// 执行一条语句确认其可用
tool
.
generate
(()
->
DBHelper
.
resetDB
(
"scripts/TableConfigurationPlugin/init.sql"
),
new
AbstractShellCallback
()
{
...
...
@@ -93,6 +95,15 @@ public class TableConfigurationPluginTest {
}
Assert
.
assertEquals
(
count
,
3
);
}
if
(
file
.
getFileName
().
equals
(
"TbBlobs.java"
)){
int
count
=
0
;
for
(
Field
field
:
((
TopLevelClass
)(
file
.
getCompilationUnit
())).
getFields
()){
if
(
field
.
getName
().
startsWith
(
"increment"
)){
count
++;
}
}
Assert
.
assertEquals
(
count
,
0
);
}
}
// 执行一条语句确认其可用
...
...
src/test/resources/scripts/TableConfigurationPlugin/mybatis-generator-with-columnRenamingRule.xml
View file @
2878b982
...
...
@@ -52,6 +52,9 @@
<table
tableName=
"tb"
>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
<table
tableName=
"tb_keys"
/>
<table
tableName=
"tb_blobs"
>
<property
name=
"columnRenamingRule.disable"
value=
"true"
/>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
src/test/resources/scripts/TableConfigurationPlugin/mybatis-generator-with-domainObjectRenamingRule.xml
View file @
2878b982
...
...
@@ -52,5 +52,9 @@
<table
tableName=
"tb"
>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
<table
tableName=
"tb_blobs"
>
<property
name=
"domainObjectRenamingRule.disable"
value=
"true"
/>
<generatedKey
column=
"id"
sqlStatement=
"MySql"
identity=
"true"
/>
</table>
</context>
</generatorConfiguration>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment