Exemplo n.º 1
0
        public void TestAnalyzeAnd()
        {
            ExprAndNode andNode = SupportExprNodeFactory.Make2SubNodeAnd();

            QueryGraph graph = new QueryGraph(2, null, false);

            FilterExprAnalyzer.AnalyzeAndNode(andNode, graph, false);

            Assert.IsTrue(graph.IsNavigableAtAll(0, 1));
            EPAssertionUtil.AssertEqualsExactOrder(QueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1), new String[] { "IntPrimitive", "TheString" });
            EPAssertionUtil.AssertEqualsExactOrder(QueryGraphTestUtil.GetIndexProperties(graph, 1, 0), new String[] { "IntPrimitive", "TheString" });
            EPAssertionUtil.AssertEqualsExactOrder(QueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0), new String[] { "IntBoxed", "TheString" });
            EPAssertionUtil.AssertEqualsExactOrder(QueryGraphTestUtil.GetIndexProperties(graph, 0, 1), new String[] { "IntBoxed", "TheString" });
        }
Exemplo n.º 2
0
        public void TestGetProperties()
        {
            // s1.p11 = s0.p01 and s0.p02 = s1.p12
            _queryGraph.AddStrictEquals(1, "p11", Make(1, "p11"), 0, "p01", Make(0, "p01"));
            _queryGraph.AddStrictEquals(0, "p02", Make(0, "p02"), 1, "p12", Make(1, "p12"));
            Log.Debug(_queryGraph.ToString());

            String[] expectedOne = new String[] { "p11", "p12" };
            String[] expectedTwo = new String[] { "p01", "p02" };
            Assert.IsTrue(Collections.AreEqual(expectedTwo, QueryGraphTestUtil.GetIndexProperties(_queryGraph, 1, 0)));
            Assert.IsTrue(Collections.AreEqual(expectedOne, QueryGraphTestUtil.GetIndexProperties(_queryGraph, 0, 1)));
            Assert.IsTrue(Collections.AreEqual(expectedOne, QueryGraphTestUtil.GetStrictKeyProperties(_queryGraph, 1, 0)));
            Assert.IsTrue(Collections.AreEqual(expectedTwo, QueryGraphTestUtil.GetStrictKeyProperties(_queryGraph, 0, 1)));
        }
Exemplo n.º 3
0
        public void TestAnalyzeEquals()
        {
            // s0.IntPrimitive = s1.IntBoxed
            ExprEqualsNode equalsNode = SupportExprNodeFactory.MakeEqualsNode();

            QueryGraph graph = new QueryGraph(2, null, false);

            FilterExprAnalyzer.AnalyzeEqualsNode(equalsNode, graph, false);

            Assert.IsTrue(graph.IsNavigableAtAll(0, 1));
            EPAssertionUtil.AssertEqualsExactOrder(new String[] { "IntPrimitive" }, QueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1));
            EPAssertionUtil.AssertEqualsExactOrder(new String[] { "IntPrimitive" }, QueryGraphTestUtil.GetIndexProperties(graph, 1, 0));
            EPAssertionUtil.AssertEqualsExactOrder(new String[] { "IntBoxed" }, QueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0));
            EPAssertionUtil.AssertEqualsExactOrder(new String[] { "IntBoxed" }, QueryGraphTestUtil.GetIndexProperties(graph, 0, 1));
        }
Exemplo n.º 4
0
        public void TestFillEquivalency()
        {
            // test with just 3 streams
            _queryGraph.AddStrictEquals(0, "p00", Make(0, "p00"), 1, "p10", Make(1, "p10"));
            _queryGraph.AddStrictEquals(1, "p10", Make(1, "p10"), 2, "p20", Make(2, "p20"));

            Assert.IsFalse(_queryGraph.IsNavigableAtAll(0, 2));
            Assert.AreEqual(0, QueryGraphTestUtil.GetStrictKeyProperties(_queryGraph, 0, 2).Count);
            Assert.AreEqual(0, QueryGraphTestUtil.GetIndexProperties(_queryGraph, 0, 2).Count);

            QueryGraph.FillEquivalentNav(_types, _queryGraph);

            Assert.IsTrue(_queryGraph.IsNavigableAtAll(0, 2));
            String[] expectedOne = new String[] { "p00" };
            String[] expectedTwo = new String[] { "p20" };
            Assert.IsTrue(Collections.AreEqual(expectedOne, QueryGraphTestUtil.GetStrictKeyProperties(_queryGraph, 0, 2)));
            Assert.IsTrue(Collections.AreEqual(expectedTwo, QueryGraphTestUtil.GetIndexProperties(_queryGraph, 0, 2)));

            // test with 5 streams, connect all streams to all streams
            _queryGraph = new QueryGraph(5, null, false);
            _queryGraph.AddStrictEquals(0, "p0", Make(0, "p0"), 1, "p1", Make(1, "p1"));
            _queryGraph.AddStrictEquals(3, "p3", Make(3, "p3"), 4, "p4", Make(4, "p4"));
            _queryGraph.AddStrictEquals(2, "p2", Make(2, "p2"), 3, "p3", Make(3, "p3"));
            _queryGraph.AddStrictEquals(1, "p1", Make(1, "p1"), 2, "p2", Make(2, "p2"));

            QueryGraph.FillEquivalentNav(_types, _queryGraph);

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    Assert.IsTrue(_queryGraph.IsNavigableAtAll(i, j), "Not navigable: i=" + i + " j=" + j);
                }
            }
        }
Exemplo n.º 5
0
        public void TestAnalyze()
        {
            var descList = new OuterJoinDesc[2];

            descList[0] = SupportOuterJoinDescFactory.MakeDesc("IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.LEFT);
            descList[1] = SupportOuterJoinDescFactory.MakeDesc("SimpleProperty", "s2", "TheString", "s1", OuterJoinType.LEFT);
            // simpleProperty in s2

            var graph = new QueryGraph(3, null, false);

            OuterJoinAnalyzer.Analyze(descList, graph);
            Assert.AreEqual(3, graph.NumStreams);

            Assert.IsTrue(graph.IsNavigableAtAll(0, 1));
            Assert.AreEqual(1, QueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1).Count);
            Assert.AreEqual("IntPrimitive", QueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1)[0]);
            Assert.AreEqual(1, QueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0).Count);
            Assert.AreEqual("IntBoxed", QueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0)[0]);

            Assert.IsTrue(graph.IsNavigableAtAll(1, 2));
            Assert.AreEqual("TheString", QueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 2)[0]);
            Assert.AreEqual("SimpleProperty", QueryGraphTestUtil.GetStrictKeyProperties(graph, 2, 1)[0]);
        }