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" });
        }
Beispiel #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)));
        }
        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));
        }
Beispiel #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);
                }
            }
        }