use of org.jumpmind.symmetric.model.TriggerRouter in project symmetric-ds by JumpMind.
the class AbstractTriggerRouterServiceTest method test09ExcludedColumnsFunctionality.
@Test
public void test09ExcludedColumnsFunctionality() throws Exception {
ITriggerRouterService service = getTriggerRouterService();
ISqlTemplate jdbcTemplate = getSqlTemplate();
assertEquals(1, jdbcTemplate.update("update sym_trigger set excluded_column_names='BOOLEAN_VALUE', last_update_time=? " + TEST_TRIGGER_WHERE_CLAUSE, new Object[] { new Date(System.currentTimeMillis() + 60000) }));
service.syncTriggers();
TriggerRouter triggerRouter = service.getTriggerRouterForTableForCurrentNode(null, null, TEST_TRIGGERS_TABLE, true).iterator().next();
assertEquals(jdbcTemplate.queryForInt("select count(*) from sym_trigger_hist where trigger_id='" + triggerRouter.getTrigger().getTriggerId() + "' and inactive_time is null"), 1, "We expected only one active record in the trigger_hist table for " + TEST_TRIGGERS_TABLE);
assertEquals(1, insert(INSERT2_VALUES, jdbcTemplate, getDbDialect()));
String csvString = getNextDataRow();
// DB2 captures decimal differently
csvString = csvString.replaceFirst("\"00001\\.\"", "\"1\"");
// Informix captures decimal differently
csvString = csvString.replaceFirst("\"1.0000000000000000\"", "\"1\"");
// ASA captures decimal differently
csvString = csvString.replaceFirst("\"1.000000\"", "\"1\"");
boolean match = csvString.endsWith(EXPECTED_INSERT2_CSV_ENDSWITH);
assertTrue(match, "Received " + csvString + ", Expected the string to end with " + EXPECTED_INSERT2_CSV_ENDSWITH);
}
use of org.jumpmind.symmetric.model.TriggerRouter in project symmetric-ds by JumpMind.
the class RouterServiceTest method testNotProducesCommonBatchesSameTablesTwoChannelsMultipleRoutersSameTableIncomingOnAnotherChannel.
@Test
public void testNotProducesCommonBatchesSameTablesTwoChannelsMultipleRoutersSameTableIncomingOnAnotherChannel() {
List<TriggerRouter> triggerRouters = new ArrayList<TriggerRouter>();
Trigger tableTrigger1 = new Trigger("a", CHANNEL_2_TEST.getChannelId(), true);
Trigger tableTrigger2 = new Trigger("a", "anotherchannel");
triggerRouters.add(new TriggerRouter(tableTrigger1, new Router("test", SOURCE_NODE_GROUP, TARGET_NODE_GROUP, "default")));
triggerRouters.add(new TriggerRouter(tableTrigger2, new Router("test", TARGET_NODE_GROUP, SOURCE_NODE_GROUP, "default")));
assertTrue(!routerService.producesCommonBatches(CHANNEL_2_TEST, SOURCE_NODE_GROUP, triggerRouters));
}
use of org.jumpmind.symmetric.model.TriggerRouter in project symmetric-ds by JumpMind.
the class RouterServiceTest method testNotProducesCommonBatchesMultipleTablesTwoChannelsMultipleRoutersSyncOnIncoming.
@Test
public void testNotProducesCommonBatchesMultipleTablesTwoChannelsMultipleRoutersSyncOnIncoming() {
List<TriggerRouter> triggerRouters = new ArrayList<TriggerRouter>();
Trigger tableTrigger = new Trigger("a", CHANNEL_2_TEST.getChannelId(), true);
triggerRouters.add(new TriggerRouter(tableTrigger, new Router("test", SOURCE_NODE_GROUP, TARGET_NODE_GROUP, "default")));
triggerRouters.add(new TriggerRouter(tableTrigger, new Router("test", TARGET_NODE_GROUP, SOURCE_NODE_GROUP, "default")));
assertTrue(!routerService.producesCommonBatches(CHANNEL_2_TEST, SOURCE_NODE_GROUP, triggerRouters));
}
use of org.jumpmind.symmetric.model.TriggerRouter in project symmetric-ds by JumpMind.
the class RouterServiceTest method testProducesCommonBatchesOneTableOneChannelDefaultRouter.
@Test
public void testProducesCommonBatchesOneTableOneChannelDefaultRouter() {
List<TriggerRouter> triggerRouters = new ArrayList<TriggerRouter>();
triggerRouters.add(new TriggerRouter(new Trigger("a", CHANNEL_2_TEST.getChannelId()), new Router("test", SOURCE_NODE_GROUP, TARGET_NODE_GROUP, "default")));
assertTrue(routerService.producesCommonBatches(CHANNEL_2_TEST, SOURCE_NODE_GROUP, triggerRouters));
}
Aggregations