コード例 #1
0
  protected void helpTest(String ddl, String expected, String... pathsToBeSequenced)
      throws Exception {
    Node ddlNode = prepareSequence(ddl, SequencerType.DDL);
    assertNotNull(ddlNode);

    traverse(ddlNode);

    DdlNodeVisitor visitor = new DdlNodeVisitor(getTeiidVersion(), false);
    visitor.visit(ddlNode);

    compare(expected, visitor);
  }
コード例 #2
0
  protected void compare(String ddl, DdlNodeVisitor visitor) {
    assertNotNull(visitor);

    String visitorDDL = visitor.getDdl();
    assertNotNull(visitorDDL);

    String[] visLines = visitorDDL.split(NEW_LINE);
    String[] ddlLines = ddl.split(NEW_LINE);

    for (int i = 0; i < visLines.length; ++i) {
      String visLine = visLines[i];
      String ddlLine = ddlLines[i];

      if (visLine.equals(ddlLine)) continue;

      if (!visLine.contains(TeiidSqlConstants.Reserved.OPTIONS))
        fail(
            "Visitor output did not match ddl at line "
                + (i + 1)
                + ": DDL -->"
                + NEW_LINE
                + ddl
                + NEW_LINE
                + "VISITOR --> "
                + NEW_LINE
                + visitorDDL);

      //
      // Options are the wrong way around
      //
      compareOptions(visLine, ddlLine);
    }
  }