public void SetUp() { _indexedEventOne = SupportEventBeanFactory.MakeEvents(new String[] { "s1_1", "s1_2" }); _indexedEventTwo = SupportEventBeanFactory.MakeEvents(new String[] { "s2_1", "s2_2" }); _newEventOne = SupportEventBeanFactory.MakeEvents(new String[] { "s1_3" }); _newEventTwo = SupportEventBeanFactory.MakeEvents(new String[] { "s2_3" }); _indexLeft = new UnindexedEventTableImpl(1); _indexLeft.Add(_indexedEventOne); _indexRight = new UnindexedEventTableImpl(1); _indexRight.Add(_indexedEventTwo); var queryStrategies = new QueryStrategy[2]; var lookupLeft = new TableLookupExecNode(1, new FullTableScanLookupStrategy(_indexRight)); var lookupRight = new TableLookupExecNode(0, new FullTableScanLookupStrategy(_indexLeft)); queryStrategies[0] = new ExecNodeQueryStrategy(0, 2, lookupLeft); queryStrategies[1] = new ExecNodeQueryStrategy(1, 2, lookupRight); var indexes = new IDictionary <TableLookupIndexReqKey, EventTable> [2]; indexes[0] = new NullableDictionary <TableLookupIndexReqKey, EventTable>(); indexes[1] = new NullableDictionary <TableLookupIndexReqKey, EventTable>(); indexes[0].Put(new TableLookupIndexReqKey("idxLeft"), _indexLeft); indexes[1].Put(new TableLookupIndexReqKey("idxLeft"), _indexRight); _joinSetComposerImpl = new JoinSetComposerImpl(true, indexes, queryStrategies, false, null, true); }
public void TestFlow() { var lookupEvents = SupportEventBeanFactory.MakeMarketDataEvents(new String[] { "a2" }); var result = new List <EventBean[]>(); var prefill = new EventBean[] { lookupEvents[0], null }; // Test lookup on empty index, expect 1 row _exec.Process(lookupEvents[0], prefill, result, null); Assert.AreEqual(1, result.Count); var events = result.FirstOrDefault(); Assert.IsNull(events[1]); Assert.AreSame(lookupEvents[0], events[0]); result.Clear(); // Test lookup on filled index, expect row2 var indexEvents = SupportEventBeanFactory.MakeEvents(new String[] { "a1", "a2" }); _index.Add(indexEvents); _exec.Process(lookupEvents[0], prefill, result, null); Assert.AreEqual(2, result.Count); IEnumerator <EventBean[]> it = result.GetEnumerator(); events = it.Advance(); Assert.AreSame(lookupEvents[0], events[0]); Assert.IsTrue((indexEvents[0] == events[1]) || (indexEvents[1] == events[1])); events = it.Advance(); Assert.AreSame(lookupEvents[0], events[0]); Assert.IsTrue((indexEvents[0] == events[1]) || (indexEvents[1] == events[1])); }