mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed h2 support
This commit is contained in:
@@ -36,7 +36,7 @@ public class MysqlDumpTest {
|
||||
controller.setMasterPosition(startPosition);
|
||||
controller.setEnableTsdb(true);
|
||||
controller.setDestination("example");
|
||||
controller.setTsdbSpringXml("classpath:tsdb/mysql-tsdb.xml");
|
||||
controller.setTsdbSpringXml("classpath:tsdb/h2-tsdb.xml");
|
||||
controller.setEventFilter(new AviaterRegexFilter("test\\..*"));
|
||||
controller.setEventBlackFilter(new AviaterRegexFilter("canal_tsdb\\..*"));
|
||||
controller.setEventSink(new AbstractCanalEventSinkTest<List<Entry>>() {
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.alibaba.otter.canal.protocol.position.EntryPosition;
|
||||
* @since 3.2.5
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = { "/tsdb/mysql-tsdb.xml" })
|
||||
@ContextConfiguration(locations = { "/tsdb/h2-tsdb.xml" })
|
||||
public class TableMetaManagerTest {
|
||||
|
||||
@Resource
|
||||
@@ -40,8 +40,7 @@ public class TableMetaManagerTest {
|
||||
tableMetaManager.apply(position, "tddl5_00", createSql, null);
|
||||
|
||||
String alterSql = "alter table `test` add column name varchar(32) after c_varchar";
|
||||
position = new EntryPosition("mysql-bin.001115", 139177334L, 3065927853L, 1501660815000L);
|
||||
position = new EntryPosition("mysql-bin.001115", 139177334L, 3065927854L, 1501660815000L);
|
||||
tableMetaManager.apply(position, "tddl5_00", alterSql, null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
44
parse/src/test/resources/tsdb/h2-tsdb.xml
Normal file
44
parse/src/test/resources/tsdb/h2-tsdb.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
|
||||
default-autowire="byName">
|
||||
|
||||
<!-- 基于db的实现 -->
|
||||
<bean id="tableMetaTSDB" class="com.alibaba.otter.canal.parse.inbound.mysql.tsdb.TableMetaManager">
|
||||
<property name="metaHistoryDAO" ref="metaHistoryDAO"/>
|
||||
<property name="metaSnapshotDAO" ref="metaSnapshotDAO"/>
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="org.h2.Driver" />
|
||||
<property name="url" value="jdbc:h2:/tmp/example;CACHE_SIZE=1000;MODE=MYSQL;" />
|
||||
<property name="username" value="canal" />
|
||||
<property name="password" value="canal" />
|
||||
<property name="maxActive" value="30" />
|
||||
<property name="initialSize" value="0" />
|
||||
<property name="minIdle" value="1" />
|
||||
<property name="maxWait" value="10000" />
|
||||
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
||||
<property name="minEvictableIdleTimeMillis" value="300000" />
|
||||
<property name="testWhileIdle" value="true" />
|
||||
<property name="testOnBorrow" value="false" />
|
||||
<property name="testOnReturn" value="false" />
|
||||
<property name="useUnfairLock" value="true" />
|
||||
</bean>
|
||||
|
||||
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
<property name="configLocation" value="classpath:tsdb/sql-map/sqlmap-config.xml"/>
|
||||
</bean>
|
||||
|
||||
<bean id="metaHistoryDAO" class="com.alibaba.otter.canal.parse.inbound.mysql.tsdb.dao.MetaHistoryDAO">
|
||||
<property name="sqlMapClient" ref="sqlMapClient"/>
|
||||
</bean>
|
||||
|
||||
<bean id="metaSnapshotDAO" class="com.alibaba.otter.canal.parse.inbound.mysql.tsdb.dao.MetaSnapshotDAO">
|
||||
<property name="sqlMapClient" ref="sqlMapClient"/>
|
||||
</bean>
|
||||
</beans>
|
||||
Reference in New Issue
Block a user