Search in sources :

Example 16 with DatabaseInfo

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

the class TestTablesService method insertIntoTestTriggerTable.

public void insertIntoTestTriggerTable(Object[] values) {
    Table testTriggerTable = platform.getTableFromCache(null, null, "test_triggers_table", true);
    DatabaseInfo dbInfo = getSymmetricDialect().getPlatform().getDatabaseInfo();
    String quote = dbInfo.getDelimiterToken();
    String catalogSeparator = dbInfo.getCatalogSeparator();
    String schemaSeparator = dbInfo.getSchemaSeparator();
    ISqlTransaction transaction = sqlTemplate.startSqlTransaction();
    try {
        transaction.allowInsertIntoAutoIncrementColumns(true, testTriggerTable, quote, catalogSeparator, schemaSeparator);
        transaction.prepareAndExecute(getSql("insertIntoTestTriggersTableSql"), values);
        transaction.commit();
    } finally {
        transaction.allowInsertIntoAutoIncrementColumns(false, testTriggerTable, quote, catalogSeparator, schemaSeparator);
        transaction.close();
    }
}
Also used : ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) Table(org.jumpmind.db.model.Table) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo)

Example 17 with DatabaseInfo

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

the class DataServiceTest method setUp.

@Before
public void setUp() throws Exception {
    sqlTemplate = mock(ISqlTemplate.class);
    sqlTransaction = mock(ISqlTransaction.class);
    when(sqlTemplate.startSqlTransaction()).thenReturn(sqlTransaction);
    IDatabasePlatform platform = mock(IDatabasePlatform.class);
    when(platform.getDatabaseInfo()).thenReturn(new DatabaseInfo());
    when(platform.getSqlTemplate()).thenReturn(sqlTemplate);
    symmetricDialect = mock(AbstractSymmetricDialect.class);
    when(symmetricDialect.getPlatform()).thenReturn(platform);
    parameterService = mock(ParameterService.class);
    when(parameterService.getLong(ParameterConstants.ROUTING_LARGEST_GAP_SIZE)).thenReturn(50000000L);
    IExtensionService extensionService = mock(ExtensionService.class);
    ISymmetricEngine engine = mock(AbstractSymmetricEngine.class);
    when(engine.getParameterService()).thenReturn(parameterService);
    when(engine.getSymmetricDialect()).thenReturn(symmetricDialect);
    dataService = new DataService(engine, extensionService);
}
Also used : ISqlTemplate(org.jumpmind.db.sql.ISqlTemplate) ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) IDatabasePlatform(org.jumpmind.db.platform.IDatabasePlatform) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo) IParameterService(org.jumpmind.symmetric.service.IParameterService) IExtensionService(org.jumpmind.symmetric.service.IExtensionService) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) AbstractSymmetricDialect(org.jumpmind.symmetric.db.AbstractSymmetricDialect) IDataService(org.jumpmind.symmetric.service.IDataService) Before(org.junit.Before)

Example 18 with DatabaseInfo

use of org.jumpmind.db.platform.DatabaseInfo 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)

Aggregations

DatabaseInfo (org.jumpmind.db.platform.DatabaseInfo)18 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)6 ISqlTransaction (org.jumpmind.db.sql.ISqlTransaction)5 ISymmetricEngine (org.jumpmind.symmetric.ISymmetricEngine)5 IExtensionService (org.jumpmind.symmetric.service.IExtensionService)5 IParameterService (org.jumpmind.symmetric.service.IParameterService)5 Column (org.jumpmind.db.model.Column)4 Before (org.junit.Before)4 ISqlTemplate (org.jumpmind.db.sql.ISqlTemplate)3 ISymmetricDialect (org.jumpmind.symmetric.db.ISymmetricDialect)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 Table (org.jumpmind.db.model.Table)2 JdbcSqlTransaction (org.jumpmind.db.sql.JdbcSqlTransaction)2 Row (org.jumpmind.db.sql.Row)2 AbstractSymmetricDialect (org.jumpmind.symmetric.db.AbstractSymmetricDialect)2 Node (org.jumpmind.symmetric.model.Node)2 ProcessInfo (org.jumpmind.symmetric.model.ProcessInfo)2 IDataService (org.jumpmind.symmetric.service.IDataService)2