Search in sources :

Example 1 with StatisticManager

use of org.jumpmind.symmetric.statistic.StatisticManager 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);
}
Also used : RouterService(org.jumpmind.symmetric.service.impl.RouterService) IRouterService(org.jumpmind.symmetric.service.IRouterService) IDatabasePlatform(org.jumpmind.db.platform.IDatabasePlatform) IContextService(org.jumpmind.symmetric.service.IContextService) ContextService(org.jumpmind.symmetric.service.impl.ContextService) DatabaseInfo(org.jumpmind.db.platform.DatabaseInfo) IParameterService(org.jumpmind.symmetric.service.IParameterService) ParameterService(org.jumpmind.symmetric.service.impl.ParameterService) INodeService(org.jumpmind.symmetric.service.INodeService) NodeService(org.jumpmind.symmetric.service.impl.NodeService) Node(org.jumpmind.symmetric.model.Node) ISymmetricEngine(org.jumpmind.symmetric.ISymmetricEngine) ProcessInfo(org.jumpmind.symmetric.model.ProcessInfo) DataService(org.jumpmind.symmetric.service.impl.DataService) IDataService(org.jumpmind.symmetric.service.IDataService) ISqlTemplate(org.jumpmind.db.sql.ISqlTemplate) ISqlTransaction(org.jumpmind.db.sql.ISqlTransaction) IExtensionService(org.jumpmind.symmetric.service.IExtensionService) IStatisticManager(org.jumpmind.symmetric.statistic.IStatisticManager) StatisticManager(org.jumpmind.symmetric.statistic.StatisticManager) AbstractSymmetricDialect(org.jumpmind.symmetric.db.AbstractSymmetricDialect) Before(org.junit.Before)

Example 2 with StatisticManager

use of org.jumpmind.symmetric.statistic.StatisticManager 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();
    String engineName = properties.get(ParameterConstants.ENGINE_NAME);
    if (!StringUtils.contains(engineName, '`') && !StringUtils.contains(engineName, '(')) {
        MDC.put("engineName", engineName);
    }
    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();
    }
    // So that the key properties are initialized in a predictable order
    parameterService.getNodeGroupId();
    parameterService.getExternalId();
    parameterService.getEngineName();
    parameterService.getSyncUrl();
    parameterService.getRegistrationUrl();
    MDC.put("engineName", parameterService.getEngineName());
    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, extensionService);
    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, configurationService, symmetricDialect);
    this.incomingBatchService = new IncomingBatchService(parameterService, symmetricDialect, clusterService);
    this.dataExtractorService = new DataExtractorService(this);
    this.transportManager = new TransportManagerFactory(this).create();
    this.offlineTransportManager = new TransportManagerFactory(this).create(Constants.PROTOCOL_FILE);
    this.dataLoaderService = new DataLoaderService(this);
    this.registrationService = new RegistrationService(this);
    this.acknowledgeService = new AcknowledgeService(this);
    this.pushService = new PushService(parameterService, symmetricDialect, dataExtractorService, acknowledgeService, transportManager, nodeService, clusterService, nodeCommunicationService, statisticManager, configurationService, extensionService);
    this.pullService = new PullService(parameterService, symmetricDialect, nodeService, dataLoaderService, registrationService, clusterService, nodeCommunicationService, configurationService, extensionService);
    this.offlinePushService = new OfflinePushService(parameterService, symmetricDialect, dataExtractorService, acknowledgeService, offlineTransportManager, nodeService, clusterService, nodeCommunicationService, statisticManager, configurationService, extensionService);
    this.offlinePullService = new OfflinePullService(parameterService, symmetricDialect, nodeService, dataLoaderService, clusterService, nodeCommunicationService, configurationService, extensionService, offlineTransportManager);
    this.fileSyncService = buildFileSyncService();
    this.fileSyncExtractorService = new FileSyncExtractorService(this);
    this.mailService = new MailService(parameterService, symmetricDialect);
    this.contextService = new ContextService(parameterService, symmetricDialect);
    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();
    }
}
Also used : OfflinePushService(org.jumpmind.symmetric.service.impl.OfflinePushService) IOfflinePushService(org.jumpmind.symmetric.service.IOfflinePushService) IContextService(org.jumpmind.symmetric.service.IContextService) ContextService(org.jumpmind.symmetric.service.impl.ContextService) TransportManagerFactory(org.jumpmind.symmetric.transport.TransportManagerFactory) IStatisticService(org.jumpmind.symmetric.service.IStatisticService) StatisticService(org.jumpmind.symmetric.service.impl.StatisticService) FileSyncExtractorService(org.jumpmind.symmetric.service.impl.FileSyncExtractorService) ITransformService(org.jumpmind.symmetric.service.ITransformService) TransformService(org.jumpmind.symmetric.service.impl.TransformService) TriggerRouterService(org.jumpmind.symmetric.service.impl.TriggerRouterService) ITriggerRouterService(org.jumpmind.symmetric.service.ITriggerRouterService) GroupletService(org.jumpmind.symmetric.service.impl.GroupletService) IGroupletService(org.jumpmind.symmetric.service.IGroupletService) DataLoaderService(org.jumpmind.symmetric.service.impl.DataLoaderService) IDataLoaderService(org.jumpmind.symmetric.service.IDataLoaderService) IConfigurationService(org.jumpmind.symmetric.service.IConfigurationService) ConfigurationService(org.jumpmind.symmetric.service.impl.ConfigurationService) AcknowledgeService(org.jumpmind.symmetric.service.impl.AcknowledgeService) IAcknowledgeService(org.jumpmind.symmetric.service.IAcknowledgeService) LoadFilterService(org.jumpmind.symmetric.service.impl.LoadFilterService) ILoadFilterService(org.jumpmind.symmetric.service.ILoadFilterService) IOfflineClientListener(org.jumpmind.symmetric.io.IOfflineClientListener) IParameterService(org.jumpmind.symmetric.service.IParameterService) ParameterService(org.jumpmind.symmetric.service.impl.ParameterService) OfflinePushService(org.jumpmind.symmetric.service.impl.OfflinePushService) PushService(org.jumpmind.symmetric.service.impl.PushService) IPushService(org.jumpmind.symmetric.service.IPushService) IOfflinePushService(org.jumpmind.symmetric.service.IOfflinePushService) IBandwidthService(org.jumpmind.symmetric.service.IBandwidthService) BandwidthService(org.jumpmind.symmetric.service.impl.BandwidthService) INodeService(org.jumpmind.symmetric.service.INodeService) NodeService(org.jumpmind.symmetric.service.impl.NodeService) IDataExtractorService(org.jumpmind.symmetric.service.IDataExtractorService) DataExtractorService(org.jumpmind.symmetric.service.impl.DataExtractorService) SequenceService(org.jumpmind.symmetric.service.impl.SequenceService) ISequenceService(org.jumpmind.symmetric.service.ISequenceService) OutgoingBatchService(org.jumpmind.symmetric.service.impl.OutgoingBatchService) IOutgoingBatchService(org.jumpmind.symmetric.service.IOutgoingBatchService) DefaultOfflineServerListener(org.jumpmind.symmetric.job.DefaultOfflineServerListener) TypedProperties(org.jumpmind.properties.TypedProperties) IRegistrationService(org.jumpmind.symmetric.service.IRegistrationService) RegistrationService(org.jumpmind.symmetric.service.impl.RegistrationService) DataService(org.jumpmind.symmetric.service.impl.DataService) IDataService(org.jumpmind.symmetric.service.IDataService) ConcurrentConnectionManager(org.jumpmind.symmetric.transport.ConcurrentConnectionManager) IConcurrentConnectionManager(org.jumpmind.symmetric.transport.IConcurrentConnectionManager) OfflinePullService(org.jumpmind.symmetric.service.impl.OfflinePullService) PullService(org.jumpmind.symmetric.service.impl.PullService) IPullService(org.jumpmind.symmetric.service.IPullService) IOfflinePullService(org.jumpmind.symmetric.service.IOfflinePullService) OfflinePullService(org.jumpmind.symmetric.service.impl.OfflinePullService) IOfflinePullService(org.jumpmind.symmetric.service.IOfflinePullService) IClusterService(org.jumpmind.symmetric.service.IClusterService) ClusterService(org.jumpmind.symmetric.service.impl.ClusterService) PurgeService(org.jumpmind.symmetric.service.impl.PurgeService) IPurgeService(org.jumpmind.symmetric.service.IPurgeService) IncomingBatchService(org.jumpmind.symmetric.service.impl.IncomingBatchService) IIncomingBatchService(org.jumpmind.symmetric.service.IIncomingBatchService) MailService(org.jumpmind.symmetric.service.impl.MailService) IMailService(org.jumpmind.symmetric.service.IMailService) IStatisticManager(org.jumpmind.symmetric.statistic.IStatisticManager) StatisticManager(org.jumpmind.symmetric.statistic.StatisticManager) DefaultOfflineClientListener(org.jumpmind.symmetric.io.DefaultOfflineClientListener)

Aggregations

IContextService (org.jumpmind.symmetric.service.IContextService)2 IDataService (org.jumpmind.symmetric.service.IDataService)2 INodeService (org.jumpmind.symmetric.service.INodeService)2 IParameterService (org.jumpmind.symmetric.service.IParameterService)2 ContextService (org.jumpmind.symmetric.service.impl.ContextService)2 DataService (org.jumpmind.symmetric.service.impl.DataService)2 NodeService (org.jumpmind.symmetric.service.impl.NodeService)2 ParameterService (org.jumpmind.symmetric.service.impl.ParameterService)2 IStatisticManager (org.jumpmind.symmetric.statistic.IStatisticManager)2 StatisticManager (org.jumpmind.symmetric.statistic.StatisticManager)2 DatabaseInfo (org.jumpmind.db.platform.DatabaseInfo)1 IDatabasePlatform (org.jumpmind.db.platform.IDatabasePlatform)1 ISqlTemplate (org.jumpmind.db.sql.ISqlTemplate)1 ISqlTransaction (org.jumpmind.db.sql.ISqlTransaction)1 TypedProperties (org.jumpmind.properties.TypedProperties)1 ISymmetricEngine (org.jumpmind.symmetric.ISymmetricEngine)1 AbstractSymmetricDialect (org.jumpmind.symmetric.db.AbstractSymmetricDialect)1 DefaultOfflineClientListener (org.jumpmind.symmetric.io.DefaultOfflineClientListener)1 IOfflineClientListener (org.jumpmind.symmetric.io.IOfflineClientListener)1 DefaultOfflineServerListener (org.jumpmind.symmetric.job.DefaultOfflineServerListener)1