1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.jumpmind.symmetric.test;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.jumpmind.symmetric.common.Constants;
25 import org.jumpmind.symmetric.model.Trigger;
26 import org.jumpmind.symmetric.service.IConfigurationService;
27 import org.jumpmind.symmetric.test.ParameterizedSuite.ParameterMatcher;
28 import org.junit.Assert;
29 import org.junit.Test;
30 import org.springframework.jdbc.core.JdbcTemplate;
31
32 public class FunkyDataTypesTest extends AbstractDatabaseTest {
33
34 static final Log logger = LogFactory.getLog(FunkyDataTypesTest.class);
35 static final String TABLE_NAME = "test_oracle_dates";
36
37 public FunkyDataTypesTest(String dbName) {
38 super(dbName);
39 }
40
41 public FunkyDataTypesTest() throws Exception {
42 super();
43 }
44
45 @Test
46 @ParameterMatcher("oracle")
47 public void testOraclePrecisionTimestamp() {
48 JdbcTemplate jdbcTemplate = getJdbcTemplate();
49 try {
50 jdbcTemplate.update("drop table " + TABLE_NAME + "");
51 } catch (Exception ex) {
52 logger.info("The table did not exist.");
53 }
54 jdbcTemplate.update("create table " + TABLE_NAME + " (id char(5) not null, ts timestamp(6), ts2 timestamp(9))");
55 IConfigurationService configService = find(Constants.CONFIG_SERVICE);
56 Trigger trigger = new Trigger();
57 trigger.setChannelId("other");
58 trigger.setSourceGroupId(TestConstants.TEST_CONTINUOUS_NODE_GROUP);
59 trigger.setTargetGroupId(TestConstants.TEST_CONTINUOUS_NODE_GROUP);
60 trigger.setSourceTableName(TABLE_NAME);
61 trigger.setSyncOnInsert(true);
62 trigger.setSyncOnUpdate(true);
63 trigger.setSyncOnDelete(true);
64 configService.insert(trigger);
65 getSymmetricEngine().syncTriggers();
66 jdbcTemplate.update("insert into " + TABLE_NAME
67 + " values('00000',timestamp'2008-01-01 00:00:00.000',timestamp'2008-01-01 00:00:00.000')");
68 Assert.assertEquals("The data event from the other database's other_table was not captured.", jdbcTemplate.queryForInt("select count(*) from sym_data_event where channel_id='other'"),
69 1);
70 }
71 }