You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by bc...@apache.org on 2017/02/02 21:00:12 UTC

[2/2] beam git commit: Restores visibility of MetricMatchers.metricUpdate

Restores visibility of MetricMatchers.metricUpdate

Documents that these functions can be used by runner tests,
and documents the couple of other matchers too.


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/33052e8a
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/33052e8a
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/33052e8a

Branch: refs/heads/master
Commit: 33052e8a108fee4885332331e830e6179b3f067f
Parents: fed80ce
Author: Eugene Kirpichov <ki...@google.com>
Authored: Wed Feb 1 22:37:55 2017 -0800
Committer: bchambers <bc...@google.com>
Committed: Thu Feb 2 12:38:55 2017 -0800

----------------------------------------------------------------------
 .../apache/beam/sdk/metrics/MetricMatchers.java | 22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/33052e8a/sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricMatchers.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricMatchers.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricMatchers.java
index b8109b3..3648c05 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricMatchers.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/metrics/MetricMatchers.java
@@ -29,7 +29,12 @@ import org.hamcrest.TypeSafeMatcher;
  */
 public class MetricMatchers {
 
-  static <T> Matcher<MetricUpdate<T>> metricUpdate(final String name, final T update) {
+  /**
+   * Matches a {@link MetricUpdate} with the given name and contents.
+   *
+   * <p>Visible since it may be used in runner-specific tests.
+   */
+  public static <T> Matcher<MetricUpdate<T>> metricUpdate(final String name, final T update) {
     return new TypeSafeMatcher<MetricUpdate<T>>() {
       @Override
       protected boolean matchesSafely(MetricUpdate<T> item) {
@@ -47,7 +52,12 @@ public class MetricMatchers {
     };
   }
 
-  static <T> Matcher<MetricUpdate<T>> metricUpdate(
+  /**
+   * Matches a {@link MetricUpdate} with the given namespace, name, step and contents.
+   *
+   * <p>Visible since it may be used in runner-specific tests.
+   */
+  public static <T> Matcher<MetricUpdate<T>> metricUpdate(
       final String namespace, final String name, final String step, final T update) {
     return new TypeSafeMatcher<MetricUpdate<T>>() {
       @Override
@@ -70,6 +80,10 @@ public class MetricMatchers {
     };
   }
 
+  /**
+   * Matches a {@link MetricResult} with the given namespace, name and step, and whose attempted
+   * value equals the given value.
+   */
   public static <T> Matcher<MetricResult<T>> attemptedMetricsResult(
       final String namespace, final String name, final String step, final T attempted) {
     return new TypeSafeMatcher<MetricResult<T>>() {
@@ -108,6 +122,10 @@ public class MetricMatchers {
     };
   }
 
+  /**
+   * Matches a {@link MetricResult} with the given namespace, name and step, and whose committed
+   * value equals the given value.
+   */
   public static <T> Matcher<MetricResult<T>> committedMetricsResult(
       final String namespace, final String name, final String step,
       final T committed) {