Search in sources :

Example 11 with ISymmetricDialect

use of org.jumpmind.symmetric.db.ISymmetricDialect in project symmetric-ds by JumpMind.

the class AbstractTriggerRouterServiceTest method test13BinaryColumnTypesForDerby.

@Test
public void test13BinaryColumnTypesForDerby() {
    ISymmetricDialect dialect = getDbDialect();
    if (DatabaseNamesConstants.DERBY.equals(dialect.getName())) {
        try {
            getSqlTemplate().update("drop table test_derby_binary_types");
        } catch (Exception e) {
        }
        getSqlTemplate().update("create table test_derby_binary_types (id integer, data VARCHAR (100) FOR BIT DATA, data2 CHAR(12) FOR BIT DATA)");
        TriggerRouter trouter = new TriggerRouter();
        Trigger trigger = trouter.getTrigger();
        trigger.setSourceTableName("test_derby_binary_types");
        trigger.setChannelId(TestConstants.TEST_CHANNEL_ID);
        Router router = trouter.getRouter();
        router.getNodeGroupLink().setSourceNodeGroupId(TestConstants.TEST_ROOT_NODE_GROUP);
        router.getNodeGroupLink().setTargetNodeGroupId(TestConstants.TEST_ROOT_NODE_GROUP);
        getTriggerRouterService().saveTriggerRouter(trouter);
        ITriggerRouterService triggerService = getTriggerRouterService();
        triggerService.syncTriggers();
        Assert.assertEquals("Some triggers must have failed to build.", 0, triggerService.getFailedTriggers().size());
        getSqlTemplate().update("insert into test_derby_binary_types values (?, ?, ?)", new Object[] { 23, "test 1 2 3".getBytes(), "test 1 2 3".getBytes() });
        String csvString = getNextDataRow();
        Assert.assertEquals("\"23\",\"dGVzdCAxIDIgMw==\",\"dGVzdCAxIDIgMyAg\"", csvString);
    }
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect) Trigger(org.jumpmind.symmetric.model.Trigger) ITriggerRouterService(org.jumpmind.symmetric.service.ITriggerRouterService) TriggerRouter(org.jumpmind.symmetric.model.TriggerRouter) Router(org.jumpmind.symmetric.model.Router) TriggerRouter(org.jumpmind.symmetric.model.TriggerRouter) Test(org.junit.Test)

Example 12 with ISymmetricDialect

use of org.jumpmind.symmetric.db.ISymmetricDialect in project symmetric-ds by JumpMind.

the class JavaColumnTransformTest method setUp.

@Before
public void setUp() throws Exception {
    ISqlTransaction sqlTransaction = mock(ISqlTransaction.class);
    platform = mock(IDatabasePlatform.class);
    ISymmetricEngine engine = mock(ISymmetricEngine.class);
    IParameterService parameterService = mock(IParameterService.class);
    IDatabasePlatform platform = mock(IDatabasePlatform.class);
    ISymmetricDialect dialect = mock(ISymmetricDialect.class);
    when(dialect.getPlatform()).thenReturn(platform);
    when(platform.getDatabaseInfo()).thenReturn(new DatabaseInfo());
    when(engine.getParameterService()).thenReturn(parameterService);
    when(engine.getSymmetricDialect()).thenReturn(dialect);
    extensionService = new ExtensionService(engine);
    when(engine.getExtensionService()).thenReturn(extensionService);
    context = mock(DataContext.class);
    when(context.findTransaction()).thenReturn(sqlTransaction);
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect) IExtensionService(org.jumpmind.symmetric.service.IExtensionService) ExtensionService(org.jumpmind.symmetric.service.impl.ExtensionService) ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) IDatabasePlatform(org.jumpmind.db.platform.IDatabasePlatform) DataContext(org.jumpmind.symmetric.io.data.DataContext) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) IParameterService(org.jumpmind.symmetric.service.IParameterService) Before(org.junit.Before)

Example 13 with ISymmetricDialect

use of org.jumpmind.symmetric.db.ISymmetricDialect in project symmetric-ds by JumpMind.

the class SimpleIntegrationTest method testAutoConfigureTablesAfterAlreadyCreated.

protected void testAutoConfigureTablesAfterAlreadyCreated(ISymmetricEngine engine) {
    ISymmetricDialect dialect = engine.getSymmetricDialect();
    assertEquals("Tables were altered when they should not have been", false, dialect.createOrAlterTablesIfNecessary());
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect)

Aggregations

ISymmetricDialect (org.jumpmind.symmetric.db.ISymmetricDialect)13 ISqlTransaction (org.jumpmind.db.sql.ISqlTransaction)6 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)5 Test (org.junit.Test)4 DatabaseInfo (org.jumpmind.db.platform.DatabaseInfo)3 ISymmetricEngine (org.jumpmind.symmetric.ISymmetricEngine)3 Router (org.jumpmind.symmetric.model.Router)3 Trigger (org.jumpmind.symmetric.model.Trigger)3 TriggerRouter (org.jumpmind.symmetric.model.TriggerRouter)3 IExtensionService (org.jumpmind.symmetric.service.IExtensionService)3 IParameterService (org.jumpmind.symmetric.service.IParameterService)3 ITriggerRouterService (org.jumpmind.symmetric.service.ITriggerRouterService)3 Node (org.jumpmind.symmetric.model.Node)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 Database (org.jumpmind.db.model.Database)1 AbstractJdbcDatabasePlatform (org.jumpmind.db.platform.AbstractJdbcDatabasePlatform)1 IDdlBuilder (org.jumpmind.db.platform.IDdlBuilder)1 ISqlTemplate (org.jumpmind.db.sql.ISqlTemplate)1 SqlScript (org.jumpmind.db.sql.SqlScript)1