コード例 #1
0
  public void testAnalyze() throws Exception {
    List<OuterJoinDesc> descList = new LinkedList<OuterJoinDesc>();
    descList.add(
        SupportOuterJoinDescFactory.makeDesc(
            "intPrimitive", "s0", "intBoxed", "s1", OuterJoinType.LEFT));
    descList.add(
        SupportOuterJoinDescFactory.makeDesc(
            "simpleProperty", "s2", "theString", "s1", OuterJoinType.LEFT));
    // simpleProperty in s2

    QueryGraph graph = new QueryGraph(3);
    OuterJoinAnalyzer.analyze(descList, graph);
    assertEquals(3, graph.getNumStreams());

    assertTrue(graph.isNavigableAtAll(0, 1));
    assertEquals(1, QueryGraphTestUtil.getStrictKeyProperties(graph, 0, 1).length);
    assertEquals("intPrimitive", QueryGraphTestUtil.getStrictKeyProperties(graph, 0, 1)[0]);
    assertEquals(1, QueryGraphTestUtil.getStrictKeyProperties(graph, 1, 0).length);
    assertEquals("intBoxed", QueryGraphTestUtil.getStrictKeyProperties(graph, 1, 0)[0]);

    assertTrue(graph.isNavigableAtAll(1, 2));
    assertEquals("theString", QueryGraphTestUtil.getStrictKeyProperties(graph, 1, 2)[0]);
    assertEquals("simpleProperty", QueryGraphTestUtil.getStrictKeyProperties(graph, 2, 1)[0]);
  }