示例#1
0
        public void SetUp()
        {
            var inputProperties = new[] { "s0.IntPrimitive" };

            var dataCache = new DataCacheLRUImpl(100);

            var resultProperties = new Dictionary <String, Object>();

            resultProperties["myvarchar"] = typeof(string);
            var resultEventType = SupportEventAdapterService.Service.CreateAnonymousMapType("test", resultProperties, true);

            var pollResults = new Dictionary <MultiKey <Object>, IList <EventBean> >();

            pollResults.Put(new MultiKey <Object>(new Object[] { -1 }), new List <EventBean>());
            pollResults.Put(new MultiKey <Object>(new Object[] { 500 }), new List <EventBean>());
            var supportPollingStrategy = new SupportPollingStrategy(pollResults);

            _pollingViewable = new DatabasePollingViewable(1, inputProperties, supportPollingStrategy, dataCache, resultEventType);

            var sqlParameters = new Dictionary <int, IList <ExprNode> >();

            sqlParameters.Put(1, ((ExprNode) new ExprIdentNodeImpl("IntPrimitive", "s0")).AsSingleton());
            _pollingViewable.Validate(null, new SupportStreamTypeSvc3Stream(), null, null, null, null, null, null, null, null, sqlParameters, null, SupportStatementContextFactory.MakeContext());

            _indexingStrategy = new ProxyPollResultIndexingStrategy
            {
                ProcIndex       = (pollResult, isActiveCache, statementContext) => new EventTable[] { new UnindexedEventTableList(pollResult, -1) },
                ProcToQueryPlan = () => GetType().Name + " unindexed"
            };
        }
 public void SetUp()
 {
     _cache = new DataCacheLRUImpl(3);
     for (int i = 0; i < _lists.Length; i++)
     {
         _lists[i] = new UnindexedEventTableImpl(0);
     }
 }
示例#3
0
        public void TestGetCache()
        {
            Assert.IsTrue(_databaseServiceImpl.GetDataCache("name1", null) is DataCacheNullImpl);

            DataCacheLRUImpl lru = (DataCacheLRUImpl)_databaseServiceImpl.GetDataCache("name2", null);

            Assert.AreEqual(10000, lru.CacheSize);

            DataCacheExpiringImpl exp = (DataCacheExpiringImpl)_databaseServiceImpl.GetDataCache("name3", null);

            Assert.AreEqual(1000, exp.MaxAgeMSec);
            Assert.AreEqual(3000, exp.PurgeIntervalMSec);
        }