Commit 2878b982 authored by hewei's avatar hewei

TableConfigurationPlugin 测试用例

parent 2b326a2f
...@@ -53,7 +53,9 @@ public class TableConfigurationPluginTest { ...@@ -53,7 +53,9 @@ public class TableConfigurationPluginTest {
MyBatisGenerator myBatisGenerator = tool.generate(); MyBatisGenerator myBatisGenerator = tool.generate();
for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){ for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){
String name = file.getCompilationUnit().getType().getShortName(); 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() { tool.generate(() -> DBHelper.resetDB("scripts/TableConfigurationPlugin/init.sql"), new AbstractShellCallback() {
...@@ -93,6 +95,15 @@ public class TableConfigurationPluginTest { ...@@ -93,6 +95,15 @@ public class TableConfigurationPluginTest {
} }
Assert.assertEquals(count, 3); 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);
}
} }
// 执行一条语句确认其可用 // 执行一条语句确认其可用
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
<table tableName="tb"> <table tableName="tb">
<generatedKey column="id" sqlStatement="MySql" identity="true"/> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
<table tableName="tb_keys"/> <table tableName="tb_blobs">
<property name="columnRenamingRule.disable" value="true"/>
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
...@@ -52,5 +52,9 @@ ...@@ -52,5 +52,9 @@
<table tableName="tb"> <table tableName="tb">
<generatedKey column="id" sqlStatement="MySql" identity="true"/> <generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table> </table>
<table tableName="tb_blobs">
<property name="domainObjectRenamingRule.disable" value="true"/>
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment