Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
data-computing-proxy-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李振振
data-computing-proxy-test
Commits
63aec77f
Commit
63aec77f
authored
Nov 13, 2023
by
李振振
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polardbx的curd测试
parent
fa0863e7
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
185 additions
and
106 deletions
+185
-106
lib/activeobjects-plugin-3.2.7.jar
lib/activeobjects-plugin-3.2.7.jar
+0
-0
lib/kingbase8-8.6.0-c7.jar
lib/kingbase8-8.6.0-c7.jar
+0
-0
pom.xml
pom.xml
+20
-1
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
+1
-1
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
...e/informix/service/impl/InformixJdbcProxyServiceImpl.java
+67
-57
src/main/java/com/beagle/informix/service/impl/InformixJdbcServiceImpl.java
...beagle/informix/service/impl/InformixJdbcServiceImpl.java
+75
-27
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
...gle/informix/service/impl/InformixMybatisServiceImpl.java
+2
-6
src/main/resources/application.yaml
src/main/resources/application.yaml
+5
-4
src/test/java/com/beagle/informix/service/impl/InformixServiceTest.java
...com/beagle/informix/service/impl/InformixServiceTest.java
+15
-10
No files found.
lib/activeobjects-plugin-3.2.7.jar
0 → 100644
View file @
63aec77f
File added
lib/kingbase8-8.6.0-c7.jar
0 → 100644
View file @
63aec77f
File added
pom.xml
View file @
63aec77f
...
...
@@ -17,6 +17,13 @@
<java.version>
11
</java.version>
</properties>
<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 -->
<dependency>
<groupId>
com.ibm.informix
</groupId>
...
...
@@ -28,6 +35,7 @@
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.28
</version>
<!-- <version>5.1.49</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
...
...
@@ -114,6 +122,17 @@
</exclusion>
</exclusions>
</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>
<build>
...
...
@@ -122,7 +141,7 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<includeSystemScope>
true
</includeSystemScope>
<excludes>
<exclude>
<groupId>
org.projectlombok
</groupId>
...
...
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
View file @
63aec77f
...
...
@@ -11,7 +11,7 @@ public interface VccinfoMapper extends BaseMapper<Vccinfo> {
@Results
(
@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
);
/**
...
...
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
View file @
63aec77f
package
com.beagle.informix.service.impl
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.beagle.informix.service.InformixService
;
import
com.google.common.collect.Iterables
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.stereotype.Service
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.sql.*
;
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
* date 2023/5/29
...
...
@@ -22,12 +43,15 @@ import java.util.Properties;
@Service
(
"informixJdbcProxyService"
)
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.driverClassName=com.informix.jdbc.IfxDriver
...
...
@@ -44,16 +68,45 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// Unknown exception: Can not find JDBC type `2005` in column type
Driver
driver
=
getDriver
();
Connection
conn
=
getConnection
(
driver
);
// insert(conn);
// update(conn);
query
(
conn
);
// delete(conn);
conn
.
prepareStatement
(
"SET character_set_results = NULL "
).
execute
();
closeConnection
(
conn
);
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
{
// 定义informix的驱动信息
String
driverUrl
=
"
org.postgresql
.Driver"
;
String
driverUrl
=
"
com.mysql.jdbc
.Driver"
;
// 还需要加入informix的jdbc驱动jar包
Class
<?>
driverClass
=
Class
.
forName
(
driverUrl
);
return
(
Driver
)
driverClass
.
getConstructor
().
newInstance
();
...
...
@@ -62,48 +115,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// 卸载驱动
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
...
...
@@ -114,11 +126,9 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
private
Connection
getConnection
(
Driver
driver
)
throws
Exception
{
DriverManager
.
registerDriver
(
driver
);
Properties
properties
=
new
Properties
();
// 组装连接数据库信息
// 组装连接数据库信息
BITBUCKET_NEW
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:postgresql://localhost:3307"
)
.
append
(
"/"
)
.
append
(
"SYSDBA"
).
append
(
"?prepareThreshold=0"
);
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:mysql://localhost:3307/SYSDBA?character_set_results=utf8"
);
// # ?useServerPrepStmts=true
DriverManager
.
setLoginTimeout
(
10
);
properties
.
put
(
"user"
,
"root"
);
properties
.
put
(
"password"
,
"Apurelove9014"
);
...
...
src/main/java/com/beagle/informix/service/impl/InformixJdbcServiceImpl.java
View file @
63aec77f
...
...
@@ -4,9 +4,12 @@ package com.beagle.informix.service.impl;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
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
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,7 +17,14 @@ import org.springframework.stereotype.Service;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
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.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* @author lzz
...
...
@@ -46,13 +56,54 @@ public class InformixJdbcServiceImpl implements InformixService {
public
void
doConnectJob
()
throws
Exception
{
Driver
driver
=
getDriver
();
Connection
conn
=
getConnection
(
driver
);
insert
(
conn
);
update
(
conn
);
query
(
conn
);
delete
(
conn
);
deregisterDriver
(
driver
);
// insert(conn);
// update(conn);
// todo 使用jdbc连接proxy,对应的query(clob、blob字段)存在jdbc 类型转换mysql异常的问题
// Unknown exception: Can not find JDBC type `2005` in column type
// 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
);
}
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
{
// 创建testdb数据库、my_test_create_table表
// 现在模拟插入、更新、删除、查询等sql
...
...
@@ -85,25 +136,21 @@ public class InformixJdbcServiceImpl implements InformixService {
stat
.
executeUpdate
();
}
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
);
ResultSet
resultSet
=
stat
.
executeQuery
();
if
(
resultSet
!=
null
)
{
while
(
resultSet
.
next
())
{
log
.
info
(
"vccid =>"
+
resultSet
.
getString
(
"vccid"
));
Clob
clob
=
resultSet
.
getClob
(
"tclob"
);
BufferedReader
reader
=
new
BufferedReader
(
clob
.
getCharacterStream
());
String
clobStr
=
""
;
String
finalClobStr
=
""
;
while
((
clobStr
=
reader
.
readLine
())!=
null
)
{
finalClobStr
+=
clobStr
;
java
.
util
.
Date
dateExecuted
=
null
;
Object
tmpDateExecuted
=
resultSet
.
getObject
(
"cols"
);
if
(
tmpDateExecuted
instanceof
Date
)
{
dateExecuted
=
(
Date
)
tmpDateExecuted
;
}
else
{
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
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 {
Properties
properties
=
new
Properties
();
// 组装连接数据库信息
// jdbc:informix-sqli://<server>:<port1526>/<database>:informixserver=<dbservername>
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:informix-sqli://"
)
.
append
(
"localhost:9088"
)
// StringBuilder jdbcBuilder = new StringBuilder("jdbc:mysql://")
StringBuilder
jdbcBuilder
=
new
StringBuilder
(
"jdbc:kingbase8://"
)
.
append
(
"localhost:54321"
)
.
append
(
"/"
)
.
append
(
"testdb"
)
.
append
(
":INFORMIXSERVER=informix"
);
.
append
(
"test"
);
DriverManager
.
setLoginTimeout
(
10
);
properties
.
put
(
"user"
,
"
informix
"
);
properties
.
put
(
"password"
,
"
in4mix
"
);
properties
.
put
(
"user"
,
"
root
"
);
properties
.
put
(
"password"
,
"
123456
"
);
return
DriverManager
.
getConnection
(
jdbcBuilder
.
toString
(),
properties
);
}
private
Driver
getDriver
()
throws
Exception
{
// 定义informix的驱动信息
String
driverUrl
=
"com.informix.jdbc.IfxDriver"
;
// String driverUrl = "com.mysql.jdbc.Driver";
String
driverUrl
=
"com.kingbase8.Driver"
;
// 还需要加入informix的jdbc驱动jar包
Class
<?>
driverClass
=
Class
.
forName
(
driverUrl
);
return
(
Driver
)
driverClass
.
getConstructor
().
newInstance
();
...
...
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
View file @
63aec77f
...
...
@@ -2,14 +2,11 @@ package com.beagle.informix.service.impl;
import
cn.hutool.json.JSONUtil
;
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.beagle.informix.entity.mybatis.Vccinfo
;
import
com.beagle.informix.mapper.VccinfoMapper
;
import
com.beagle.informix.service.InformixService
;
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.stereotype.Service
;
...
...
@@ -35,9 +32,9 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
@Override
@Transactional
public
void
doConnectJob
()
throws
Exception
{
insertMethod
();
//
insertMethod();
// updateMethod();
//
queryMethod();
queryMethod
();
// delete();
}
private
void
insertMethod
()
throws
Exception
{
...
...
@@ -73,7 +70,6 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
private
void
queryMethod
()
{
List
<
Vccinfo
>
vccinfoList
=
vccinfoMapper
.
queryList
(
1
);
log
.
info
(
"queryAll:{}"
,
JSONUtil
.
toJsonStr
(
vccinfoList
));
}
private
void
delete
()
{
LambdaQueryWrapper
<
Vccinfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
...
...
src/main/resources/application.yaml
View file @
63aec77f
...
...
@@ -3,12 +3,13 @@ spring:
druid
:
# url: jdbc:informix-sqli://localhost:9088/testdb:INFORMIXSERVER=informix
#&useServerPrepStmts=true
# url: jdbc:mysql://localhost:3307/testdb?useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
url
:
jdbc:postgresql://localhost:3307/SYSDBA?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai
# 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/SYSDBA?character_set_results=utf8
# url: jdbc:mysql://192.168.1.55:3306/bit7
# url: jdbc:mysql://localhost:3307/
BITBUCKET7?
useServerPrepStmts=true
username
:
root
# username: informix
# password: in4mix
# password: 123456
password
:
Apurelove9014
# max-active: 20
# max-wait: 60000
...
...
@@ -22,7 +23,7 @@ spring:
# test-while-idle: false
# time-between-eviction-runs-millis: 60000
# 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
:
properties
:
hibernate
:
...
...
src/test/java/com/beagle/informix/service/impl/InformixServiceTest.java
View file @
63aec77f
...
...
@@ -2,19 +2,24 @@ package com.beagle.informix.service.impl;
import
com.beagle.informix.BaseApplication
;
import
com.beagle.informix.service.InformixService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.jupiter.api.Test
;
import
org.junit.runner.RunWith
;
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
javax.annotation.Resource
;
import
java.sql.*
;
import
java.util.Properties
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
BaseApplication
.
class
)
class
InformixServiceTest
{
//
@Resource(name = "informixJdbcService")
//
private InformixService informixJdbcService;
@Resource
(
name
=
"informixJdbcService"
)
private
InformixService
informixJdbcService
;
@Resource
(
name
=
"informixJdbcProxyService"
)
private
InformixService
informixJdbcProxyService
;
...
...
@@ -24,14 +29,14 @@ class InformixServiceTest {
// private InformixService informixIbatisService;
@Resource
(
name
=
"informixMybatisService"
)
private
InformixService
informixMybatisService
;
//
@Test
//
void testJdbcInfo() {
//
try {
//
informixJdbcService.doConnectJob();
//
} catch (Exception e) {
//
e.printStackTrace();
//
}
//
}
@Test
void
testJdbcInfo
()
{
try
{
informixJdbcService
.
doConnectJob
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Test
void
testJdbcProxyInfo
()
{
try
{
...
...
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