Search in sources :

Example 16 with ISymmetricEngine

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

the class DataGapRouteReaderTest method buildReader.

protected DataGapRouteReader buildReader(int peekAheadMemoryThreshold, List<DataGap> dataGaps) throws Exception {
    when(parameterService.getEngineName()).thenReturn(ENGINE_NAME);
    when(parameterService.is(ParameterConstants.SYNCHRONIZE_ALL_JOBS)).thenReturn(true);
    when(parameterService.getInt(ParameterConstants.ROUTING_WAIT_FOR_DATA_TIMEOUT_SECONDS)).thenReturn(330);
    when(parameterService.getInt(ParameterConstants.ROUTING_PEEK_AHEAD_MEMORY_THRESHOLD)).thenReturn(peekAheadMemoryThreshold);
    when(parameterService.getInt(ParameterConstants.ROUTING_MAX_GAPS_TO_QUALIFY_IN_SQL)).thenReturn(100);
    when(parameterService.getInt(ParameterConstants.ROUTING_DATA_READER_THRESHOLD_GAPS_TO_USE_GREATER_QUERY)).thenReturn(100);
    when(parameterService.is(ParameterConstants.ROUTING_DATA_READER_ORDER_BY_DATA_ID_ENABLED)).thenReturn(true);
    IStatisticManager statisticManager = mock(StatisticManager.class);
    when(statisticManager.newProcessInfo((ProcessInfoKey) any())).thenReturn(new ProcessInfo());
    INodeService nodeService = mock(NodeService.class);
    when(nodeService.findIdentity()).thenReturn(new Node(NODE_ID, NODE_GROUP_ID));
    IDatabasePlatform platform = mock(IDatabasePlatform.class);
    when(platform.getSqlTemplate()).thenReturn(sqlTemplate);
    when(platform.getDatabaseInfo()).thenReturn(new DatabaseInfo());
    ISymmetricDialect symmetricDialect = mock(AbstractSymmetricDialect.class);
    when(symmetricDialect.supportsTransactionId()).thenReturn(true);
    when(symmetricDialect.getPlatform()).thenReturn(platform);
    IExtensionService extensionService = mock(ExtensionService.class);
    ISymmetricEngine engine = mock(AbstractSymmetricEngine.class);
    when(engine.getParameterService()).thenReturn(parameterService);
    when(engine.getStatisticManager()).thenReturn(statisticManager);
    when(engine.getNodeService()).thenReturn(nodeService);
    when(engine.getDataService()).thenReturn(dataService);
    when(engine.getSymmetricDialect()).thenReturn(symmetricDialect);
    when(engine.getExtensionService()).thenReturn(extensionService);
    IRouterService routerService = new RouterService(engine);
    when(engine.getRouterService()).thenReturn(routerService);
    ChannelRouterContext context = new ChannelRouterContext(NODE_ID, nodeChannel, mock(ISqlTransaction.class));
    context.setDataGaps(dataGaps);
    return new DataGapRouteReader(context, engine);
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect) RouterService(org.jumpmind.symmetric.service.impl.RouterService) IRouterService(org.jumpmind.symmetric.service.IRouterService) IDatabasePlatform(org.jumpmind.db.platform.IDatabasePlatform) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo) Node(org.jumpmind.symmetric.model.Node) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) ProcessInfo(org.jumpmind.symmetric.model.ProcessInfo) IRouterService(org.jumpmind.symmetric.service.IRouterService) IStatisticManager(org.jumpmind.symmetric.statistic.IStatisticManager) ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) INodeService(org.jumpmind.symmetric.service.INodeService) IExtensionService(org.jumpmind.symmetric.service.IExtensionService)

Example 17 with ISymmetricEngine

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

the class ConfigurationChangedDataRouterTest method buildTestableRouter.

protected IDataRouter buildTestableRouter(final Node nodeThatIsRouting, final List<NodeGroupLink> links, final NetworkedNode root) {
    IConfigurationService configService = mock(IConfigurationService.class);
    when(configService.isMasterToMaster()).thenReturn(false);
    ISymmetricEngine engine = mock(ISymmetricEngine.class);
    when(engine.getConfigurationService()).thenReturn(configService);
    when(engine.getTablePrefix()).thenReturn("sym");
    ConfigurationChangedDataRouter router = new ConfigurationChangedDataRouter(engine) {

        @Override
        protected Node findIdentity() {
            return nodeThatIsRouting;
        }

        @Override
        protected List<NodeGroupLink> getNodeGroupLinksFromContext(SimpleRouterContext routingContext) {
            return links;
        }

        @Override
        protected NetworkedNode getRootNetworkNodeFromContext(SimpleRouterContext routingContext) {
            return root;
        }
    };
    return router;
}
Also used : ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) IConfigurationService(org.jumpmind.symmetric.service.IConfigurationService) NodeGroupLink(org.jumpmind.symmetric.model.NodeGroupLink)

Example 18 with ISymmetricEngine

use of org.jumpmind.symmetric.ISymmetricEngine 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 19 with ISymmetricEngine

use of org.jumpmind.symmetric.ISymmetricEngine 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 20 with ISymmetricEngine

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

the class DataGapRouteReaderTest method buildReader.

protected DataGapRouteReader buildReader(int peekAheadMemoryThreshold) throws Exception {
    when(parameterService.getEngineName()).thenReturn(ENGINE_NAME);
    when(parameterService.is(ParameterConstants.SYNCHRONIZE_ALL_JOBS)).thenReturn(true);
    when(parameterService.getInt(ParameterConstants.ROUTING_WAIT_FOR_DATA_TIMEOUT_SECONDS)).thenReturn(330);
    when(parameterService.getInt(ParameterConstants.ROUTING_PEEK_AHEAD_MEMORY_THRESHOLD)).thenReturn(peekAheadMemoryThreshold);
    when(parameterService.getInt(ParameterConstants.ROUTING_MAX_GAPS_TO_QUALIFY_IN_SQL)).thenReturn(100);
    when(parameterService.getInt(ParameterConstants.ROUTING_DATA_READER_THRESHOLD_GAPS_TO_USE_GREATER_QUERY)).thenReturn(100);
    when(parameterService.is(ParameterConstants.ROUTING_DATA_READER_ORDER_BY_DATA_ID_ENABLED)).thenReturn(true);
    IStatisticManager statisticManager = mock(StatisticManager.class);
    when(statisticManager.newProcessInfo((ProcessInfoKey) any())).thenReturn(new ProcessInfo());
    INodeService nodeService = mock(NodeService.class);
    when(nodeService.findIdentity()).thenReturn(new Node(NODE_ID, NODE_GROUP_ID));
    IDatabasePlatform platform = mock(IDatabasePlatform.class);
    when(platform.getSqlTemplate()).thenReturn(sqlTemplate);
    when(platform.getDatabaseInfo()).thenReturn(new DatabaseInfo());
    ISymmetricDialect symmetricDialect = mock(AbstractSymmetricDialect.class);
    when(symmetricDialect.supportsTransactionId()).thenReturn(true);
    when(symmetricDialect.getPlatform()).thenReturn(platform);
    IExtensionService extensionService = mock(ExtensionService.class);
    ISymmetricEngine engine = mock(AbstractSymmetricEngine.class);
    when(engine.getParameterService()).thenReturn(parameterService);
    when(engine.getStatisticManager()).thenReturn(statisticManager);
    when(engine.getNodeService()).thenReturn(nodeService);
    when(engine.getDataService()).thenReturn(dataService);
    when(engine.getSymmetricDialect()).thenReturn(symmetricDialect);
    when(engine.getExtensionService()).thenReturn(extensionService);
    IRouterService routerService = new RouterService(engine);
    when(engine.getRouterService()).thenReturn(routerService);
    ChannelRouterContext context = new ChannelRouterContext(NODE_ID, nodeChannel, mock(ISqlTransaction.class));
    return new DataGapRouteReader(context, engine);
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect) RouterService(org.jumpmind.symmetric.service.impl.RouterService) IRouterService(org.jumpmind.symmetric.service.IRouterService) IDatabasePlatform(org.jumpmind.db.platform.IDatabasePlatform) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo) Node(org.jumpmind.symmetric.model.Node) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) ProcessInfo(org.jumpmind.symmetric.model.ProcessInfo) IRouterService(org.jumpmind.symmetric.service.IRouterService) IStatisticManager(org.jumpmind.symmetric.statistic.IStatisticManager) ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) INodeService(org.jumpmind.symmetric.service.INodeService) IExtensionService(org.jumpmind.symmetric.service.IExtensionService)

Aggregations

ISymmetricEngine (org.jumpmind.symmetric.ISymmetricEngine)35 IOException (java.io.IOException)12 INodeService (org.jumpmind.symmetric.service.INodeService)8 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)7 InputStream (java.io.InputStream)7 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)7 Node (org.jumpmind.symmetric.model.Node)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)7 OutputStream (java.io.OutputStream)6 PipedInputStream (java.io.PipedInputStream)6 PipedOutputStream (java.io.PipedOutputStream)6 NotImplementedException (org.apache.commons.lang.NotImplementedException)6 DatabaseInfo (org.jumpmind.db.platform.DatabaseInfo)6 IExtensionService (org.jumpmind.symmetric.service.IExtensionService)6 File (java.io.File)5 ISqlTransaction (org.jumpmind.db.sql.ISqlTransaction)5 ProcessInfo (org.jumpmind.symmetric.model.ProcessInfo)5 IParameterService (org.jumpmind.symmetric.service.IParameterService)5