You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2014/10/28 18:50:54 UTC

[6/9] git commit: Update DiffRepository documentation.

Update DiffRepository documentation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/be79857d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/be79857d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/be79857d

Branch: refs/heads/master
Commit: be79857df651036d6fd04ac3defe3202e6ec2ea8
Parents: 17f3e29
Author: Julian Hyde <jh...@apache.org>
Authored: Tue Oct 7 18:02:33 2014 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Oct 24 09:44:30 2014 -0700

----------------------------------------------------------------------
 .../java/org/eigenbase/test/DiffRepository.java | 27 ++++++++++++++------
 .../org/eigenbase/test/RelOptRulesTest.java     | 17 +++++++++---
 2 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/be79857d/core/src/test/java/org/eigenbase/test/DiffRepository.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/eigenbase/test/DiffRepository.java b/core/src/test/java/org/eigenbase/test/DiffRepository.java
index a80b436..f131833 100644
--- a/core/src/test/java/org/eigenbase/test/DiffRepository.java
+++ b/core/src/test/java/org/eigenbase/test/DiffRepository.java
@@ -57,7 +57,7 @@ import org.xml.sax.*;
  * </code></pre></blockquote>
  *
  * <p>There is an accompanying reference file named after the class,
- * <code>com/acme/test/MyTest.ref.xml</code>:</p>
+ * <code>src/test/resources/com/acme/test/MyTest.xml</code>:</p>
  *
  * <blockquote><pre><code>
  *
@@ -80,11 +80,22 @@ import org.xml.sax.*;
  *
  * </code></pre></blockquote>
  *
- * <p>If any of the testcases fails, a log file is generated, called <code>
- * com/acme/test/MyTest.log.xml</code> containing the actual output. The log
+ * <p>If any of the testcases fails, a log file is generated, called
+ * <code>target/surefire/com/acme/test/MyTest.xml</code>, containing the actual
+ * output.</p>
+ *
+ * <p>(Maven sometimes removes this file; if it is not present, run maven with
+ * an extra {@code -X} flag.
+ * See <a href="http://jira.codehaus.org/browse/SUREFIRE-846">SUREFIRE-846</a>
+ * for details.)</p>
+ *
+ * <p>The log
  * file is otherwise identical to the reference log, so once the log file has
  * been verified, it can simply be copied over to become the new reference
- * log.</p>
+ * log:</p>
+ *
+ * <blockquote><code>cp target/surefire/com/acme/test/MyTest.xml
+ * src/test/resources/com/acme/test/MyTest.xml</code></blockquote>
  *
  * <p>If a resource or testcase does not exist, <code>DiffRepository</code>
  * creates them in the log file. Because DiffRepository is so forgiving, it is
@@ -92,7 +103,8 @@ import org.xml.sax.*;
  *
  * <p>The {@link #lookup} method ensures that all test cases share the same
  * instance of the repository. This is important more than one one test case
- * fails. The shared instance ensures that the generated <code>.log.xml</code>
+ * fails. The shared instance ensures that the generated
+ * <code>target/surefire/com/acme/test/MyTest.xml</code>
  * file contains the actual for <em>both</em> test cases.
  */
 public class DiffRepository {
@@ -453,7 +465,7 @@ public class DiffRepository {
   }
 
   /**
-   * Flush the reference document to the file system.
+   * Flushes the reference document to the file system.
    */
   private void flushDoc() {
     FileWriter w = null;
@@ -463,8 +475,7 @@ public class DiffRepository {
       w = new FileWriter(logFile);
       write(doc, w);
     } catch (IOException e) {
-      throw Util.newInternal(
-          e,
+      throw Util.newInternal(e,
           "error while writing test reference log '" + logFile + "'");
     } finally {
       if (w != null) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/be79857d/core/src/test/java/org/eigenbase/test/RelOptRulesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/eigenbase/test/RelOptRulesTest.java b/core/src/test/java/org/eigenbase/test/RelOptRulesTest.java
index 1d35d91..7c7472d 100644
--- a/core/src/test/java/org/eigenbase/test/RelOptRulesTest.java
+++ b/core/src/test/java/org/eigenbase/test/RelOptRulesTest.java
@@ -100,14 +100,23 @@ import static org.junit.Assert.assertTrue;
  * examples. You'll have to come up with an SQL statement to which your rule
  * will apply in a meaningful way. See {@link SqlToRelTestBase} class comments
  * for details on the schema.
+ *
  * <li>Run the test. It should fail. Inspect the output in
- * RelOptRulesTest.log.xml; verify that the "planBefore" is the correct
+ * {@code target/surefire/.../RelOptRulesTest.xml}.
+ * (If you are running using maven and this file does not exist, add a
+ * {@code -X} flag to the maven command line.)
+ *
+ * <li>Verify that the "planBefore" is the correct
  * translation of your SQL, and that it contains the pattern on which your rule
- * is supposed to fire. If all is well, check out RelOptRulesTest.ref.xml and
- * replace it with the new .log.xml.
+ * is supposed to fire. If all is well, replace
+ * {@code src/test/resources/.../RelOptRulesTest.xml} and
+ * with the new {@code target/surefire/.../RelOptRulesTest.xml}.
+ *
  * <li>Run the test again. It should fail again, but this time it should contain
  * a "planAfter" entry for your rule. Verify that your rule applied its
- * transformation correctly, and then update the .ref.xml file again.
+ * transformation correctly, and then update the
+ * {@code src/test/resources/.../RelOptRulesTest.xml} file again.
+ *
  * <li>Run the test one last time; this time it should pass.
  * </ol>
  */