Пример #1
0
        public void SetUp()
        {
            _eventType = SupportEventTypeFactory.CreateBeanType(typeof(SupportBean));

            PropertyIndexedEventTableFactory factory = new PropertyIndexedEventTableFactory(0, _eventType, new String[] { "TheString", "IntPrimitive" }, false, null);

            _propertyMapEventIndex = (PropertyIndexedEventTable)factory.MakeEventTables(null)[0];
            _lookupStrategy        = new IndexedTableLookupStrategy(_eventType, new String[] { "TheString", "IntPrimitive" }, _propertyMapEventIndex);

            _propertyMapEventIndex.Add(new EventBean[] { SupportEventBeanFactory.CreateObject(new SupportBean("a", 1)) });
        }
        public void TestLookup()
        {
            List <QueryGraphValueEntryHashKeyed> keys = new List <QueryGraphValueEntryHashKeyed>();

            keys.Add(new QueryGraphValueEntryHashKeyedProp(new ExprIdentNodeImpl(_types[0], "IntBoxed", 0), "IntBoxed"));
            IndexedTableLookupPlanMulti spec = new IndexedTableLookupPlanMulti(0, 1, new TableLookupIndexReqKey("idx1"), keys);

            IDictionary <TableLookupIndexReqKey, EventTable>[] indexes = new IDictionary <TableLookupIndexReqKey, EventTable> [2];
            indexes[0] = new Dictionary <TableLookupIndexReqKey, EventTable>();
            indexes[1] = new Dictionary <TableLookupIndexReqKey, EventTable>();
            indexes[1][new TableLookupIndexReqKey("idx1")] = _propertyMapEventIndex;

            JoinExecTableLookupStrategy lookupStrategy = spec.MakeStrategy("ABC", "001", null, indexes, _types, new VirtualDWView[2]);

            IndexedTableLookupStrategy strategy = (IndexedTableLookupStrategy)lookupStrategy;

            Assert.AreEqual(_types[0], strategy.EventType);
            Assert.AreEqual(_propertyMapEventIndex, strategy.Index);
            Assert.IsTrue(Collections.AreEqual(new String[] { "IntBoxed" }, strategy.Properties));
        }