public void TestPurgeInterval() { var scheduler = new SchedulingServiceImpl(new TimeSourceServiceImpl()); _cache = new DataCacheExpiringImpl(10, 20, ConfigurationCacheReferenceType.HARD, scheduler, new ScheduleSlot(1, 2), null); // age 10 sec, purge 1000 seconds // test single entry in cache scheduler.Time = 5000; _cache.PutCached(Make("a"), new EventTable[] { _lists[0] }); // a at 5 sec Assert.AreSame(_lists[0], _cache.GetCached(Make("a"))[0]); scheduler.Time = 26000; SupportSchedulingServiceImpl.EvaluateSchedule(scheduler); Assert.AreEqual(0, _cache.Count); // test 4 entries in cache scheduler.Time = 30000; _cache.PutCached(Make("b"), new EventTable[] { _lists[1] }); // b at 30 sec scheduler.Time = 35000; _cache.PutCached(Make("c"), new EventTable[] { _lists[2] }); // c at 35 sec scheduler.Time = 40000; _cache.PutCached(Make("d"), new EventTable[] { _lists[3] }); // d at 40 sec scheduler.Time = 45000; _cache.PutCached(Make("e"), new EventTable[] { _lists[4] }); // d at 40 sec scheduler.Time = 50000; SupportSchedulingServiceImpl.EvaluateSchedule(scheduler); Assert.AreEqual(2, _cache.Count); // only d and e Assert.AreSame(_lists[3], _cache.GetCached(Make("d"))[0]); Assert.AreSame(_lists[4], _cache.GetCached(Make("e"))[0]); }
public void SetUp() { _container = SupportContainer.Reset(); var configs = new Dictionary <String, ConfigurationDBRef>(); var config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative); configs["name1"] = config; config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative, new Properties()); //config.SetDataSourceConnection("context", new Properties()); config.LRUCache = 10000; configs["name2"] = config; config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative, new Properties()); config.SetExpiryTimeCache(1, 3); configs["name3"] = config; SchedulingService schedulingService = new SchedulingServiceImpl( new TimeSourceServiceImpl(), _container.Resolve <ILockManager>()); _databaseServiceImpl = new DatabaseConfigServiceImpl( configs, schedulingService, new ScheduleBucket(1), SupportEngineImportServiceFactory.Make(_container)); }
public EPServiceProviderIsolated GetIsolationUnit(string name, int?optionalUnitId) { var serviceProviderIsolated = _isolatedProviders.Get(name); if (serviceProviderIsolated != null) { return(serviceProviderIsolated); } FilterServiceSPI filterService = FilterServiceProvider.NewService( _epServicesContext.LockManager, _epServicesContext.RWLockManager, _epServicesContext.ConfigSnapshot.EngineDefaults.Execution.FilterServiceProfile, true); var scheduleService = new SchedulingServiceImpl( _epServicesContext.TimeSource, _epServicesContext.LockManager); var services = new EPIsolationUnitServices(name, currentUnitId, filterService, scheduleService); serviceProviderIsolated = new EPServiceProviderIsolatedImpl( name, services, _epServicesContext, _isolatedProviders); _isolatedProviders.Put(name, serviceProviderIsolated); return(serviceProviderIsolated); }
public void SetUp() { _beginState = new MatchedEventMapImpl(new MatchedEventMapMeta(new String[0], false)); _scheduleService = new SchedulingServiceImpl(new TimeSourceServiceImpl()); StatementContext stmtContext = SupportStatementContextFactory.MakeContext(_scheduleService); _context = new PatternContext(stmtContext, 1, new MatchedEventMapMeta(new String[0], false), false); _agentContext = SupportPatternContextFactory.MakePatternAgentInstanceContext(_scheduleService); _evaluator = new SupportObserverEvaluator(_agentContext); _observer = new TimerIntervalObserver(1000, _beginState, _evaluator); }
public void SetUp() { _beginState = new MatchedEventMapImpl(new MatchedEventMapMeta(new String[0], false)); _scheduleService = new SchedulingServiceImpl(new TimeSourceServiceImpl()); PatternAgentInstanceContext agentContext = SupportPatternContextFactory.MakePatternAgentInstanceContext(_scheduleService); ScheduleSpec scheduleSpec = new ScheduleSpec(); scheduleSpec.AddValue(ScheduleUnit.SECONDS, 1); _evaluator = new SupportObserverEvaluator(agentContext); _observer = new TimerAtObserver(scheduleSpec, _beginState, _evaluator); }
public void SetUp() { IDictionary <String, ConfigurationDBRef> configs = new Dictionary <String, ConfigurationDBRef>(); ConfigurationDBRef config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative); configs["name1"] = config; config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative, new Properties()); //config.SetDataSourceConnection("context", new Properties()); config.LRUCache = 10000; configs["name2"] = config; config = new ConfigurationDBRef(); config.SetDatabaseDriver(SupportDatabaseService.DbDriverFactoryNative, new Properties()); config.SetExpiryTimeCache(1, 3); configs["name3"] = config; SchedulingService schedulingService = new SchedulingServiceImpl(new TimeSourceServiceImpl()); _databaseServiceImpl = new DatabaseConfigServiceImpl(configs, schedulingService, new ScheduleBucket(1)); }