Skip to content

Commit

Permalink
调整测试用例(目前H2Query不适用2.x版本).
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjerry committed Jul 14, 2023
1 parent ea2340c commit 0504b24
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.sql.SQLException;

/**
* H2Database 表数据查询
* H2Database 表数据查询 (只适用H2 1.X版本)
*
* @author yuxiaobin
* @since 2019-01-8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ void test() throws SQLException {
DatabaseMetaDataWrapper databaseMetaDataWrapper = new DatabaseMetaDataWrapper(dataSourceConfig.getConn(), dataSourceConfig.getSchemaName());
Map<String, DatabaseMetaDataWrapper.Column> columnsInfo = databaseMetaDataWrapper.getColumnsInfo(null, null, "USERS",true);
Assertions.assertNotNull(columnsInfo);
DatabaseMetaDataWrapper.Column name = columnsInfo.get("name");
DatabaseMetaDataWrapper.Column name = columnsInfo.get("user_name");
Assertions.assertTrue(name.isNullable());
Assertions.assertEquals(JdbcType.VARCHAR, name.getJdbcType());
Assertions.assertEquals(Integer.MAX_VALUE, name.getLength());
// Assertions.assertEquals(Integer.MAX_VALUE, name.getLength());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
import com.baomidou.mybatisplus.generator.fill.Column;
import com.baomidou.mybatisplus.generator.fill.Property;
import com.baomidou.mybatisplus.generator.query.DefaultQuery;
import com.baomidou.mybatisplus.generator.query.SQLQuery;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -45,8 +46,8 @@ public static StrategyConfig.Builder strategyConfig() {
* 数据源配置
*/
private static final DataSourceConfig DATA_SOURCE_CONFIG = new DataSourceConfig
.Builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;MODE=MYSQL", "sa", "")
.databaseQueryClass(SQLQuery.class) // 设置SQL查询方式,默认的是元数据查询方式
.Builder("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;MODE=MYSQL;DATABASE_TO_LOWER=TRUE", "sa", "")
.databaseQueryClass(DefaultQuery.class) // 设置SQL查询方式,默认的是元数据查询方式
.build();

/**
Expand Down Expand Up @@ -210,7 +211,7 @@ public void testCustomFileByMap() {
@Test
public void testCustomFileBySingle() {
// 设置自定义输出文件
CustomFile customFile = new CustomFile.Builder().fileName("DTO.java").templatePath("/templates/dto.java.vm").packageName("dto").build();
CustomFile customFile = new CustomFile.Builder().fileName("DTO.java").templatePath("templates/dto.java.vm").packageName("dto").build();
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().build());
generator.injection(injectionConfig().customFile(customFile).build());
Expand Down
2 changes: 1 addition & 1 deletion mybatis-plus-generator/src/test/resources/sql/init.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
drop table if exists `t_simple`;
create table `t_simple`
(
id int IDENTITY primary key comment 'id',
id int auto_increment comment 'id',
name varchar(50) comment '姓名',
age int comment '年龄',
delete_flag tinyint(1) comment '删除标识1',
Expand Down

0 comments on commit 0504b24

Please sign in to comment.