Commit 63aec77f authored by 李振振's avatar 李振振

polardbx的curd测试

parent fa0863e7
...@@ -17,6 +17,13 @@ ...@@ -17,6 +17,13 @@
<java.version>11</java.version> <java.version>11</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.kingbase8</groupId>
<artifactId>kingbase8</artifactId>
<version>V008R006C007B0021</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/kingbase8-8.6.0-c7.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/com.ibm.informix/jdbc --> <!-- https://mvnrepository.com/artifact/com.ibm.informix/jdbc -->
<dependency> <dependency>
<groupId>com.ibm.informix</groupId> <groupId>com.ibm.informix</groupId>
...@@ -28,6 +35,7 @@ ...@@ -28,6 +35,7 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version> <version>8.0.28</version>
<!-- <version>5.1.49</version>-->
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql --> <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency> <dependency>
...@@ -114,6 +122,17 @@ ...@@ -114,6 +122,17 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
...@@ -122,7 +141,7 @@ ...@@ -122,7 +141,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<includeSystemScope>true</includeSystemScope>
<excludes> <excludes>
<exclude> <exclude>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
......
...@@ -11,7 +11,7 @@ public interface VccinfoMapper extends BaseMapper<Vccinfo> { ...@@ -11,7 +11,7 @@ public interface VccinfoMapper extends BaseMapper<Vccinfo> {
@Results( @Results(
@Result(column = "tblob",property = "tBlobStr") @Result(column = "tblob",property = "tBlobStr")
) )
@Select("SELECT * FROM cti_vccinfo_new where vccid = #{vId}") @Select("SELECT vccid FROM cti_vccinfo_new where vccid = #{vId}")
List<Vccinfo> queryList(@Param("vId") Integer vId); List<Vccinfo> queryList(@Param("vId") Integer vId);
/** /**
......
package com.beagle.informix.service.impl; package com.beagle.informix.service.impl;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.beagle.informix.service.InformixService; import com.beagle.informix.service.InformixService;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.sql.*; import java.sql.*;
import java.util.Properties; import java.util.Properties;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** /**
* @author lzz * @author lzz
* date 2023/5/29 * date 2023/5/29
...@@ -22,12 +43,15 @@ import java.util.Properties; ...@@ -22,12 +43,15 @@ import java.util.Properties;
@Service("informixJdbcProxyService") @Service("informixJdbcProxyService")
public class InformixJdbcProxyServiceImpl implements InformixService { public class InformixJdbcProxyServiceImpl implements InformixService {
private ResourceLoader resourceLoader;
public InformixJdbcProxyServiceImpl(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
public static void main(String[] args) {
try {
new InformixJdbcProxyServiceImpl().doConnectJob();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/** /**
* informix.url=jdbc:informix-sqli://localhost:9088/sysadmin:INFORMIXSERVER=informix * informix.url=jdbc:informix-sqli://localhost:9088/sysadmin:INFORMIXSERVER=informix
* informix.driverClassName=com.informix.jdbc.IfxDriver * informix.driverClassName=com.informix.jdbc.IfxDriver
...@@ -44,16 +68,45 @@ public class InformixJdbcProxyServiceImpl implements InformixService { ...@@ -44,16 +68,45 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// Unknown exception: Can not find JDBC type `2005` in column type // Unknown exception: Can not find JDBC type `2005` in column type
Driver driver = getDriver(); Driver driver = getDriver();
Connection conn = getConnection(driver); Connection conn = getConnection(driver);
// insert(conn); conn.prepareStatement("SET character_set_results = NULL ").execute();
// update(conn);
query(conn);
// delete(conn);
closeConnection(conn); closeConnection(conn);
deregisterDriver(driver); deregisterDriver(driver);
} }
private ResultSet getImportedKeys(Connection connection, DatabaseMetaData metaData, String tableName) throws SQLException {
ResultSet schemas = connection.getMetaData().getSchemas();
List<String> schemasList = new ArrayList<>();
while (schemas.next()){
schemasList.add(schemas.getString("TABLE_SCHEM"));
}
return connection.getMetaData().getImportedKeys((String)null, "BIT7", tableName);
}
private Object newForeignKey(ResultSet rs, String localTableName) throws SQLException {
String localFieldName = this.parseStringValue(rs, "FKCOLUMN_NAME");
String foreignFieldName = this.parseStringValue(rs, "PKCOLUMN_NAME");
String foreignTableName = this.parseStringValue(rs, "PKTABLE_NAME");
return null;
// return new DatabaseMetaDataReaderImpl.ForeignKeyImpl(localTableName, localFieldName, foreignTableName, foreignFieldName);
}
private String parseStringValue(ResultSet rs, String columnName) throws SQLException {
String value = rs.getString(columnName);
if (StringUtils.isBlank(value)) {
return value;
} else {
Matcher m = STRING_VALUE.matcher(value);
return m.find() ? m.group(1) : value;
}
}
private static final Pattern STRING_VALUE = Pattern.compile("\"(.*)\"");
private Driver getDriver() throws Exception{ private Driver getDriver() throws Exception{
// 定义informix的驱动信息 // 定义informix的驱动信息
String driverUrl = "org.postgresql.Driver"; String driverUrl = "com.mysql.jdbc.Driver";
// 还需要加入informix的jdbc驱动jar包 // 还需要加入informix的jdbc驱动jar包
Class<?> driverClass = Class.forName(driverUrl); Class<?> driverClass = Class.forName(driverUrl);
return (Driver) driverClass.getConstructor().newInstance(); return (Driver) driverClass.getConstructor().newInstance();
...@@ -62,48 +115,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService { ...@@ -62,48 +115,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// 卸载驱动 // 卸载驱动
DriverManager.deregisterDriver(driver); DriverManager.deregisterDriver(driver);
} }
private void insert(Connection conn) throws Exception{
// 创建testdb数据库、my_test_create_table表
// 现在模拟插入、更新、删除、查询等sql
// 插入
String insertSql = "insert into cti_vccinfo_new (vccid ,vccname, effective, agentmax,ivrmax,updatekey) values (?, ? , ?, ?, ? , ?)";
PreparedStatement stat = conn.prepareStatement(insertSql);
stat.setObject(1, "123456");
stat.setObject(2, "vname");
stat.setObject(3, 1);
stat.setObject(4, 2);
stat.setObject(5, 3);
stat.setObject(6, "updatekey");
String clobContent = "This is a very very long string";
// // 处理clob字段
// StringReader reader = new StringReader(clobContent);
// stat.setClob(7, reader, clobContent.length());
// 处理blob字段
// Resource resource = resourceLoader.getResource("classpath:EnableLoopback.exe");
// File inputStream = resource.getFile();
// FileInputStream fis = new FileInputStream(inputStream);
// stat.setBlob(8, fis);
stat.executeUpdate();
}
private void update(Connection conn) throws Exception{
// 创建testdb数据库、my_test_create_table表
// 现在模拟插入、更新、删除、查询等sql
// 插入
String updateSql = "update cti_vccinfo_new set vccname = 'informix_name' where vccid = '123456'";
PreparedStatement stat = conn.prepareStatement(updateSql);
stat.executeUpdate();
}
private void query(Connection conn) throws Exception {
String querySQL = "select vccid,vccname from cti_vccinfo_new where vccid = ? ";
PreparedStatement stat = conn.prepareStatement(querySQL);
// 设置查询参数,不拓展查询
stat.setObject(1, "1", Types.OTHER);
ResultSet resultSet = stat.executeQuery();
}
private void delete(Connection conn) throws Exception{
String deleteSql = "delete from cti_vccinfo_new where vccid = '123456' ";
conn.createStatement().executeUpdate(deleteSql);
}
/** /**
* 指定不用预编译语句 prepareThreshold=0 * 指定不用预编译语句 prepareThreshold=0
...@@ -114,11 +126,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService { ...@@ -114,11 +126,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
private Connection getConnection(Driver driver) throws Exception{ private Connection getConnection(Driver driver) throws Exception{
DriverManager.registerDriver(driver); DriverManager.registerDriver(driver);
Properties properties = new Properties(); Properties properties = new Properties();
// 组装连接数据库信息 // 组装连接数据库信息 BITBUCKET_NEW
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername> // jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder jdbcBuilder = new StringBuilder("jdbc:postgresql://localhost:3307") StringBuilder jdbcBuilder = new StringBuilder("jdbc:mysql://localhost:3307/SYSDBA?character_set_results=utf8");// # ?useServerPrepStmts=true
.append("/")
.append("SYSDBA").append("?prepareThreshold=0");
DriverManager.setLoginTimeout(10); DriverManager.setLoginTimeout(10);
properties.put("user", "root"); properties.put("user", "root");
properties.put("password", "Apurelove9014"); properties.put("password", "Apurelove9014");
......
...@@ -4,9 +4,12 @@ package com.beagle.informix.service.impl; ...@@ -4,9 +4,12 @@ package com.beagle.informix.service.impl;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.beagle.informix.service.InformixService; import com.beagle.informix.service.InformixService;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,7 +17,14 @@ import org.springframework.stereotype.Service; ...@@ -14,7 +17,14 @@ import org.springframework.stereotype.Service;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.sql.*; import java.sql.*;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author lzz * @author lzz
...@@ -46,13 +56,54 @@ public class InformixJdbcServiceImpl implements InformixService { ...@@ -46,13 +56,54 @@ public class InformixJdbcServiceImpl implements InformixService {
public void doConnectJob() throws Exception{ public void doConnectJob() throws Exception{
Driver driver = getDriver(); Driver driver = getDriver();
Connection conn = getConnection(driver); Connection conn = getConnection(driver);
insert(conn); // insert(conn);
update(conn); // update(conn);
query(conn); // todo 使用jdbc连接proxy,对应的query(clob、blob字段)存在jdbc 类型转换mysql异常的问题
delete(conn); // Unknown exception: Can not find JDBC type `2005` in column type
deregisterDriver(driver); // insert(conn);
// update(conn);
ResultSet rs = this.getImportedKeys(conn, conn.getMetaData(), "AO_2AD648_INSIGHT_ANNOTATION");
this.newForeignKey(rs, "AO_2AD648_INSIGHT_ANNOTATION");
// query(conn);
// delete(conn);
// deregisterDriver(driver);
closeConnection(conn); closeConnection(conn);
} }
private ResultSet getImportedKeys(Connection connection, DatabaseMetaData metaData, String tableName) throws SQLException {
return connection.getMetaData().getImportedKeys((String)null, connection.getSchema(), tableName);
}
private Object newForeignKey(ResultSet rs, String localTableName) throws SQLException {
String localFieldName = this.parseStringValue(rs, "FKCOLUMN_NAME");
String foreignFieldName = this.parseStringValue(rs, "PKCOLUMN_NAME");
String foreignTableName = this.parseStringValue(rs, "PKTABLE_NAME");
return null;
// return new DatabaseMetaDataReaderImpl.ForeignKeyImpl(localTableName, localFieldName, foreignTableName, foreignFieldName);
}
private String parseStringValue(ResultSet rs, String columnName) throws SQLException {
String value = rs.getString(columnName);
if (StringUtils.isBlank(value)) {
return value;
} else {
Matcher m = STRING_VALUE.matcher(value);
return m.find() ? m.group(1) : value;
}
}
private static final Pattern STRING_VALUE = Pattern.compile("\"(.*)\"");
public static void main(String[] args) {
try {
new InformixJdbcServiceImpl(null).doConnectJob();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private void insert(Connection conn) throws Exception{ private void insert(Connection conn) throws Exception{
// 创建testdb数据库、my_test_create_table表 // 创建testdb数据库、my_test_create_table表
// 现在模拟插入、更新、删除、查询等sql // 现在模拟插入、更新、删除、查询等sql
...@@ -85,25 +136,21 @@ public class InformixJdbcServiceImpl implements InformixService { ...@@ -85,25 +136,21 @@ public class InformixJdbcServiceImpl implements InformixService {
stat.executeUpdate(); stat.executeUpdate();
} }
private void query(Connection conn) throws Exception { private void query(Connection conn) throws Exception {
String querySQL = "select * from cti_vccinfo_new where vccid = '123456' "; String querySQL = "select * from tabs ";
PreparedStatement stat = conn.prepareStatement(querySQL); PreparedStatement stat = conn.prepareStatement(querySQL);
ResultSet resultSet = stat.executeQuery(); ResultSet resultSet = stat.executeQuery();
if (resultSet != null) { if (resultSet != null) {
while (resultSet.next()) { while (resultSet.next()) {
log.info("vccid =>" + resultSet.getString("vccid")); java.util.Date dateExecuted = null;
Clob clob = resultSet.getClob("tclob"); Object tmpDateExecuted = resultSet.getObject("cols");
BufferedReader reader = new BufferedReader(clob.getCharacterStream()); if (tmpDateExecuted instanceof Date) {
String clobStr = ""; dateExecuted = (Date)tmpDateExecuted;
String finalClobStr = ""; } else {
while ((clobStr = reader.readLine())!= null) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
finalClobStr += clobStr; try {
dateExecuted = df.parse((String)tmpDateExecuted);
} catch (ParseException e) {}
} }
log.info("tclob =>" + finalClobStr);
Blob blob = resultSet.getBlob("tblob");
BufferedInputStream bins= new BufferedInputStream(blob.getBinaryStream());
byte [] bytes = bins.readAllBytes();
String blobStr= new String(bytes, StandardCharsets.UTF_8);
log.info("tblob =>" + blobStr);
} }
} }
} }
...@@ -116,19 +163,20 @@ public class InformixJdbcServiceImpl implements InformixService { ...@@ -116,19 +163,20 @@ public class InformixJdbcServiceImpl implements InformixService {
Properties properties = new Properties(); Properties properties = new Properties();
// 组装连接数据库信息 // 组装连接数据库信息
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername> // jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder jdbcBuilder = new StringBuilder("jdbc:informix-sqli://") // StringBuilder jdbcBuilder = new StringBuilder("jdbc:mysql://")
.append("localhost:9088") StringBuilder jdbcBuilder = new StringBuilder("jdbc:kingbase8://")
.append("localhost:54321")
.append("/") .append("/")
.append("testdb") .append("test");
.append(":INFORMIXSERVER=informix");
DriverManager.setLoginTimeout(10); DriverManager.setLoginTimeout(10);
properties.put("user", "informix"); properties.put("user", "root");
properties.put("password", "in4mix"); properties.put("password", "123456");
return DriverManager.getConnection(jdbcBuilder.toString(), properties); return DriverManager.getConnection(jdbcBuilder.toString(), properties);
} }
private Driver getDriver() throws Exception{ private Driver getDriver() throws Exception{
// 定义informix的驱动信息 // 定义informix的驱动信息
String driverUrl = "com.informix.jdbc.IfxDriver"; // String driverUrl = "com.mysql.jdbc.Driver";
String driverUrl = "com.kingbase8.Driver";
// 还需要加入informix的jdbc驱动jar包 // 还需要加入informix的jdbc驱动jar包
Class<?> driverClass = Class.forName(driverUrl); Class<?> driverClass = Class.forName(driverUrl);
return (Driver) driverClass.getConstructor().newInstance(); return (Driver) driverClass.getConstructor().newInstance();
......
...@@ -2,14 +2,11 @@ package com.beagle.informix.service.impl; ...@@ -2,14 +2,11 @@ package com.beagle.informix.service.impl;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beagle.informix.entity.mybatis.Vccinfo; import com.beagle.informix.entity.mybatis.Vccinfo;
import com.beagle.informix.mapper.VccinfoMapper; import com.beagle.informix.mapper.VccinfoMapper;
import com.beagle.informix.service.InformixService; import com.beagle.informix.service.InformixService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -35,9 +32,9 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin ...@@ -35,9 +32,9 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
@Override @Override
@Transactional @Transactional
public void doConnectJob() throws Exception{ public void doConnectJob() throws Exception{
insertMethod(); // insertMethod();
// updateMethod(); // updateMethod();
// queryMethod(); queryMethod();
// delete(); // delete();
} }
private void insertMethod() throws Exception{ private void insertMethod() throws Exception{
...@@ -73,7 +70,6 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin ...@@ -73,7 +70,6 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
private void queryMethod() { private void queryMethod() {
List<Vccinfo> vccinfoList = vccinfoMapper.queryList(1); List<Vccinfo> vccinfoList = vccinfoMapper.queryList(1);
log.info("queryAll:{}", JSONUtil.toJsonStr(vccinfoList));
} }
private void delete() { private void delete() {
LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Vccinfo> queryWrapper = new LambdaQueryWrapper<>();
......
...@@ -3,12 +3,13 @@ spring: ...@@ -3,12 +3,13 @@ spring:
druid: druid:
# url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix # url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix
#&useServerPrepStmts=true #&useServerPrepStmts=true
# url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://localhost:3307/SYSDBA?character_set_results=utf8
url: jdbc:postgresql://localhost:3307/SYSDBA?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai # url: jdbc:mysql://192.168.1.55:3306/bit7
# url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&useServerPrepStmts=true # url: jdbc:mysql://localhost:3307/BITBUCKET7?useServerPrepStmts=true
username: root username: root
# username: informix # username: informix
# password: in4mix # password: in4mix
# password: 123456
password: Apurelove9014 password: Apurelove9014
# max-active: 20 # max-active: 20
# max-wait: 60000 # max-wait: 60000
...@@ -22,7 +23,7 @@ spring: ...@@ -22,7 +23,7 @@ spring:
# test-while-idle: false # test-while-idle: false
# time-between-eviction-runs-millis: 60000 # time-between-eviction-runs-millis: 60000
# driver-class-name: com.informix.jdbc.IfxDriver # driver-class-name: com.informix.jdbc.IfxDriver
driver-class-name: org.postgresql.Driver # com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver # com.mysql.cj.jdbc.Driver org.postgresql.Driver
jpa: jpa:
properties: properties:
hibernate: hibernate:
......
...@@ -2,19 +2,24 @@ package com.beagle.informix.service.impl; ...@@ -2,19 +2,24 @@ package com.beagle.informix.service.impl;
import com.beagle.informix.BaseApplication; import com.beagle.informix.BaseApplication;
import com.beagle.informix.service.InformixService; import com.beagle.informix.service.InformixService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Service;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.sql.*;
import java.util.Properties;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = BaseApplication.class) @SpringBootTest(classes = BaseApplication.class)
class InformixServiceTest { class InformixServiceTest {
// @Resource(name = "informixJdbcService") @Resource(name = "informixJdbcService")
// private InformixService informixJdbcService; private InformixService informixJdbcService;
@Resource(name = "informixJdbcProxyService") @Resource(name = "informixJdbcProxyService")
private InformixService informixJdbcProxyService; private InformixService informixJdbcProxyService;
...@@ -24,14 +29,14 @@ class InformixServiceTest { ...@@ -24,14 +29,14 @@ class InformixServiceTest {
// private InformixService informixIbatisService; // private InformixService informixIbatisService;
@Resource(name = "informixMybatisService") @Resource(name = "informixMybatisService")
private InformixService informixMybatisService; private InformixService informixMybatisService;
// @Test @Test
// void testJdbcInfo() { void testJdbcInfo() {
// try { try {
// informixJdbcService.doConnectJob(); informixJdbcService.doConnectJob();
// } catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
@Test @Test
void testJdbcProxyInfo() { void testJdbcProxyInfo() {
try { try {
......
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