use of org.jumpmind.symmetric.service.impl.NodeService in project symmetric-ds by JumpMind.
the class DataGapDetectorTest 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);
when(symmetricDialect.supportsTransactionViews()).thenReturn(false);
when(symmetricDialect.getDatabaseTime()).thenReturn(0L);
parameterService = mock(ParameterService.class);
when(parameterService.getEngineName()).thenReturn(ENGINE_NAME);
when(parameterService.getLong(ParameterConstants.ROUTING_STALE_DATA_ID_GAP_TIME)).thenReturn(60000000L);
when(parameterService.getInt(ParameterConstants.DATA_ID_INCREMENT_BY)).thenReturn(1);
when(parameterService.getLong(ParameterConstants.ROUTING_LARGEST_GAP_SIZE)).thenReturn(50000000L);
when(parameterService.getLong(ParameterConstants.DBDIALECT_ORACLE_TRANSACTION_VIEW_CLOCK_SYNC_THRESHOLD_MS)).thenReturn(60000L);
when(parameterService.getLong(ParameterConstants.ROUTING_STALE_GAP_BUSY_EXPIRE_TIME)).thenReturn(60000L);
when(parameterService.is(ParameterConstants.ROUTING_DETECT_INVALID_GAPS)).thenReturn(true);
when(parameterService.getInt(ParameterConstants.ROUTING_MAX_GAP_CHANGES)).thenReturn(1000);
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);
routerService = new RouterService(engine);
when(engine.getRouterService()).thenReturn(routerService);
contextService = mock(ContextService.class);
dataService = mock(DataService.class);
statisticManager = mock(StatisticManager.class);
when(statisticManager.newProcessInfo((ProcessInfoKey) any())).thenReturn(new ProcessInfo());
nodeService = mock(NodeService.class);
when(nodeService.findIdentity()).thenReturn(new Node(NODE_ID, NODE_GROUP_ID));
detector = newGapDetector();
detector.setFullGapAnalysis(false);
}
use of org.jumpmind.symmetric.service.impl.NodeService in project symmetric-ds by JumpMind.
the class AbstractSymmetricEngine method init.
protected void init() {
if (propertiesFactory == null) {
this.propertiesFactory = createTypedPropertiesFactory();
}
if (securityService == null) {
this.securityService = SecurityServiceFactory.create(getSecurityServiceType(), propertiesFactory.reload());
}
TypedProperties properties = this.propertiesFactory.reload();
MDC.put("engineName", properties.get(ParameterConstants.ENGINE_NAME));
this.platform = createDatabasePlatform(properties);
this.parameterService = new ParameterService(platform, propertiesFactory, properties.get(ParameterConstants.RUNTIME_CONFIG_TABLE_PREFIX, "sym"));
boolean parameterTableExists = this.platform.readTableFromDatabase(null, null, TableConstants.getTableName(properties.get(ParameterConstants.RUNTIME_CONFIG_TABLE_PREFIX), TableConstants.SYM_PARAMETER)) != null;
if (parameterTableExists) {
this.parameterService.setDatabaseHasBeenInitialized(true);
this.parameterService.rereadParameters();
}
this.platform.setMetadataIgnoreCase(this.parameterService.is(ParameterConstants.DB_METADATA_IGNORE_CASE));
this.platform.setClearCacheModelTimeoutInMs(parameterService.getLong(ParameterConstants.CACHE_TIMEOUT_TABLES_IN_MS));
this.symmetricDialect = createSymmetricDialect();
this.extensionService = createExtensionService();
this.extensionService.refresh();
this.symmetricDialect.setExtensionService(extensionService);
this.parameterService.setExtensionService(extensionService);
this.bandwidthService = new BandwidthService(parameterService);
this.sequenceService = new SequenceService(parameterService, symmetricDialect);
this.stagingManager = createStagingManager();
this.nodeService = new NodeService(parameterService, symmetricDialect, securityService, extensionService);
this.configurationService = new ConfigurationService(parameterService, symmetricDialect, nodeService);
this.clusterService = new ClusterService(parameterService, symmetricDialect);
this.statisticService = new StatisticService(parameterService, symmetricDialect);
this.statisticManager = new StatisticManager(parameterService, nodeService, configurationService, statisticService, clusterService);
this.concurrentConnectionManager = new ConcurrentConnectionManager(parameterService, statisticManager);
this.purgeService = new PurgeService(parameterService, symmetricDialect, clusterService, statisticManager);
this.transformService = new TransformService(parameterService, symmetricDialect, configurationService, extensionService);
this.loadFilterService = new LoadFilterService(parameterService, symmetricDialect, configurationService);
this.groupletService = new GroupletService(this);
this.triggerRouterService = new TriggerRouterService(this);
this.outgoingBatchService = new OutgoingBatchService(parameterService, symmetricDialect, nodeService, configurationService, sequenceService, clusterService, extensionService);
this.dataService = new DataService(this, extensionService);
this.routerService = buildRouterService();
this.nodeCommunicationService = buildNodeCommunicationService(clusterService, nodeService, parameterService, symmetricDialect);
this.incomingBatchService = new IncomingBatchService(parameterService, symmetricDialect, clusterService);
this.dataExtractorService = new DataExtractorService(this);
this.transportManager = new TransportManagerFactory(this).create();
this.dataLoaderService = buildDataLoaderService();
this.registrationService = new RegistrationService(this);
this.acknowledgeService = new AcknowledgeService(this);
this.pushService = buildPushService();
this.pullService = new PullService(parameterService, symmetricDialect, nodeService, dataLoaderService, registrationService, clusterService, nodeCommunicationService, configurationService, extensionService);
this.fileSyncService = new FileSyncService(this);
this.jobManager = createJobManager();
extensionService.addExtensionPoint(new DefaultOfflineServerListener(statisticManager, nodeService, outgoingBatchService));
IOfflineClientListener defaultlistener = new DefaultOfflineClientListener(parameterService, nodeService);
extensionService.addExtensionPoint(defaultlistener);
extensionService.addExtensionPoint(defaultlistener);
if (registerEngine) {
registerHandleToEngine();
}
}
Aggregations