You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lc...@apache.org on 2016/07/27 18:38:54 UTC

[1/2] incubator-beam git commit: Remove DataflowJUnitTestRunner as integration tests execute using surefire/failsafe.

Repository: incubator-beam
Updated Branches:
  refs/heads/master ddd57d8b9 -> b6c29e6b3


Remove DataflowJUnitTestRunner as integration tests execute using surefire/failsafe.


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

Branch: refs/heads/master
Commit: 07ee019e5f37915c56c3d91707883f57afe90bef
Parents: ddd57d8
Author: Luke Cwik <lc...@visitor-lcwik.wat.corp.google.com>
Authored: Wed Jul 27 13:14:41 2016 -0400
Committer: Luke Cwik <lc...@visitor-lcwik.wat.corp.google.com>
Committed: Wed Jul 27 14:38:17 2016 -0400

----------------------------------------------------------------------
 .../sdk/testing/DataflowJUnitTestRunner.java    | 130 -------------------
 1 file changed, 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/07ee019e/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/DataflowJUnitTestRunner.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/DataflowJUnitTestRunner.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/DataflowJUnitTestRunner.java
deleted file mode 100644
index 457712f..0000000
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/testing/DataflowJUnitTestRunner.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.beam.sdk.testing;
-
-import org.apache.beam.sdk.options.Description;
-import org.apache.beam.sdk.options.PipelineOptions;
-import org.apache.beam.sdk.options.PipelineOptionsFactory;
-import org.apache.beam.sdk.options.Validation;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.reflect.ClassPath;
-import com.google.common.reflect.ClassPath.ClassInfo;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Request;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.annotation.Nullable;
-
-/**
- * A test runner which can invoke a series of method or class test targets configuring
- * the {@link TestPipeline} to run against the Dataflow service based upon command-line
- * parameters specified.
- *
- * <p>Supported target definitions as command line parameters are:
- * <ul>
- *   <li>Class: "ClassName"
- *   <li>Method: "ClassName#methodName"
- * </ul>
- * Multiple parameters can be specified in sequence, which will cause the test
- * runner to invoke the tests in the specified order.
- *
- * <p>All tests will be executed after which, if any test had failed, the runner
- * will exit with a non-zero status code.
- */
-public class DataflowJUnitTestRunner {
-  private static final Logger LOG = LoggerFactory.getLogger(DataflowJUnitTestRunner.class);
-
-  /**
-   * Options which control a Dataflow JUnit test runner to invoke
-   * a series of method and/or class targets.
-   */
-  @Description("Options which control a Dataflow JUnit test runner to invoke "
-      + "a series of method and/or class targets.")
-  public interface Options extends PipelineOptions {
-    @Description("A list of supported test targets. Supported targets are 'ClassName' "
-        + "or 'ClassName#MethodName'")
-    @Validation.Required
-    String[] getTest();
-    void setTest(String[] values);
-  }
-
-  public static void main(String ... args) throws Exception {
-    PipelineOptionsFactory.register(Options.class);
-    Options options = PipelineOptionsFactory.fromArgs(args).withValidation().as(Options.class);
-    Set<ClassPath.ClassInfo> classes =
-        ClassPath.from(ClassLoader.getSystemClassLoader()).getAllClasses();
-
-    // Build a list of requested test targets
-    List<Request> requests = new ArrayList<>();
-    for (String testTarget : options.getTest()) {
-      if (testTarget.contains("#")) {
-        String[] parts = testTarget.split("#", 2);
-        Class<?> klass = findClass(parts[0], classes);
-        requests.add(Request.method(klass, parts[1]));
-      } else {
-        requests.add(Request.aClass(findClass(testTarget, classes)));
-      }
-    }
-
-    // Set system properties required by TestPipeline so that it is able to execute tests
-    // on the service.
-    String beamTestPipelineOptions = new ObjectMapper().writeValueAsString(args);
-    System.setProperty("beamTestPipelineOptions", beamTestPipelineOptions);
-
-    // Run the set of tests
-    boolean success = true;
-    JUnitCore core = new JUnitCore();
-    for (Request request : requests) {
-      Result result = core.run(request);
-      if (!result.wasSuccessful()) {
-        for (Failure failure : result.getFailures()) {
-          LOG.error(failure.getTestHeader(), failure.getException());
-        }
-        success = false;
-      }
-    }
-    if (!success) {
-      throw new IllegalStateException("Tests failed, check output logs for details.");
-    }
-  }
-
-  private static final Class<?> findClass(
-      final String simpleName, Set<ClassPath.ClassInfo> classes)
-      throws ClassNotFoundException {
-    Iterable<ClassPath.ClassInfo> matches =
-        Iterables.filter(classes, new Predicate<ClassPath.ClassInfo>() {
-      @Override
-      public boolean apply(@Nullable ClassInfo input) {
-        return input != null && simpleName.equals(input.getSimpleName());
-      }
-    });
-    return Class.forName(Iterables.getOnlyElement(matches).getName());
-  }
-}


[2/2] incubator-beam git commit: Remove DataflowJUnitTestRunner as integration tests execute using surefire/failsafe

Posted by lc...@apache.org.
Remove DataflowJUnitTestRunner as integration tests execute using surefire/failsafe

This closes #740


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

Branch: refs/heads/master
Commit: b6c29e6b3047e3ec7698185c69993144a0fc8c88
Parents: ddd57d8 07ee019
Author: Luke Cwik <lc...@visitor-lcwik.wat.corp.google.com>
Authored: Wed Jul 27 14:38:44 2016 -0400
Committer: Luke Cwik <lc...@visitor-lcwik.wat.corp.google.com>
Committed: Wed Jul 27 14:38:44 2016 -0400

----------------------------------------------------------------------
 .../sdk/testing/DataflowJUnitTestRunner.java    | 130 -------------------
 1 file changed, 130 deletions(-)
----------------------------------------------------------------------