public void TestRecursiveBuild() { var streamNum = 2; var queryGraph = new QueryGraph(6, null, false); var outerInnerGraph = new OuterInnerDirectionalGraph(6); var completedStreams = new HashSet <int>(); var substreamsPerStream = new LinkedHashMap <int, int[]>(); var requiredPerStream = new bool[6]; outerInnerGraph.Add(3, 2).Add(2, 1).Add(4, 3).Add(1, 0).Add(3, 5); queryGraph.AddStrictEquals(2, "", null, 3, "", null); queryGraph.AddStrictEquals(3, "", null, 4, "", null); queryGraph.AddStrictEquals(3, "", null, 5, "", null); queryGraph.AddStrictEquals(2, "", null, 1, "", null); queryGraph.AddStrictEquals(1, "", null, 0, "", null); ICollection <InterchangeablePair <int, int> > innerJoins = new HashSet <InterchangeablePair <int, int> >(); var innerJoinGraph = new InnerJoinGraph(6, innerJoins); var streamStack = new Stack <int>(); NStreamOuterQueryPlanBuilder.RecursiveBuild(streamNum, streamStack, queryGraph, outerInnerGraph, innerJoinGraph, completedStreams, substreamsPerStream, requiredPerStream, new DependencyGraph(6, false)); Assert.AreEqual(6, substreamsPerStream.Count); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream[2], new int[] { 3, 1 }); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream.Get(3), new int[] { 4, 5 }); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream[1], new int[] { 0 }); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream.Get(4), new int[] {}); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream.Get(5), new int[] {}); EPAssertionUtil.AssertEqualsExactOrder(substreamsPerStream[0], new int[] {}); NStreamOuterQueryPlanBuilder.VerifyJoinedPerStream(2, substreamsPerStream); EPAssertionUtil.AssertEqualsExactOrder(requiredPerStream, new bool[] { false, false, false, true, true, false } ); }
private void TryVerifyJoinedPerStream(IDictionary <int, int[]> map) { try { NStreamOuterQueryPlanBuilder.VerifyJoinedPerStream(0, map); Assert.Fail(); } catch (ArgumentException) { // expected } }