beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [19/50] beam git commit: [BEAM-2389] moved GcpCoreApiSurfaceTest to corresponding module, adapted exposed packagees
Date Fri, 30 Jun 2017 21:31:21 GMT
[BEAM-2389] moved GcpCoreApiSurfaceTest to corresponding module, adapted exposed packagees


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

Branch: refs/heads/gearpump-runner
Commit: fecd64f5ff73e590fcf19019534b9d0ed293ac60
Parents: 23a34f5
Author: Michael Luckey <michael.luckey@ext.gfk.com>
Authored: Sun Jun 25 15:01:08 2017 +0200
Committer: Luke Cwik <lcwik@google.com>
Committed: Wed Jun 28 09:56:13 2017 -0700

----------------------------------------------------------------------
 .../extensions/gcp/GcpCoreApiSurfaceTest.java   | 48 +++++++++++---------
 1 file changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/fecd64f5/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/GcpCoreApiSurfaceTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/GcpCoreApiSurfaceTest.java
b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/GcpCoreApiSurfaceTest.java
index 625c248..a0d9e4b 100644
--- a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/GcpCoreApiSurfaceTest.java
+++ b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/extensions/gcp/GcpCoreApiSurfaceTest.java
@@ -15,14 +15,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.beam;
+package org.apache.beam.sdk.extensions.gcp;
 
-import static org.apache.beam.sdk.util.ApiSurface.containsOnlyPackages;
+import static org.apache.beam.sdk.util.ApiSurface.classesInPackage;
+import static org.apache.beam.sdk.util.ApiSurface.containsOnlyClassesMatching;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 import com.google.common.collect.ImmutableSet;
 import java.util.Set;
 import org.apache.beam.sdk.util.ApiSurface;
+import org.hamcrest.Matcher;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -32,28 +34,32 @@ import org.junit.runners.JUnit4;
 public class GcpCoreApiSurfaceTest {
 
   @Test
-  public void testApiSurface() throws Exception {
+  public void testGcpCoreApiSurface() throws Exception {
+    final Package thisPackage = getClass().getPackage();
+    final ClassLoader thisClassLoader = getClass().getClassLoader();
+    final ApiSurface apiSurface =
+        ApiSurface.ofPackage(thisPackage, thisClassLoader)
+            .pruningPattern("org[.]apache[.]beam[.].*Test.*")
+            .pruningPattern("org[.]apache[.]beam[.].*IT")
+            .pruningPattern("java[.]lang.*")
+            .pruningPattern("java[.]util.*");
 
     @SuppressWarnings("unchecked")
-    final Set<String> allowed =
+    final Set<Matcher<Class<?>>> allowedClasses =
         ImmutableSet.of(
-            "org.apache.beam",
-            "com.google.api.client",
-            "com.google.api.services.storage",
-            "com.google.auth",
-            "com.fasterxml.jackson.annotation",
-            "com.fasterxml.jackson.core",
-            "com.fasterxml.jackson.databind",
-            "org.apache.avro",
-            "org.hamcrest",
-            // via DataflowMatchers
-            "org.codehaus.jackson",
-            // via Avro
-            "org.joda.time",
-            "org.junit",
-            "sun.reflect");
+            classesInPackage("com.google.api.client.googleapis"),
+            classesInPackage("com.google.api.client.http"),
+            classesInPackage("com.google.api.client.json"),
+            classesInPackage("com.google.api.client.util"),
+            classesInPackage("com.google.api.services.storage"),
+            classesInPackage("com.google.auth"),
+            classesInPackage("com.fasterxml.jackson.annotation"),
+            classesInPackage("java"),
+            classesInPackage("javax"),
+            classesInPackage("org.apache.beam.sdk"),
+            classesInPackage("org.joda.time")
+        );
 
-    assertThat(
-        ApiSurface.getSdkApiSurface(getClass().getClassLoader()), containsOnlyPackages(allowed));
+    assertThat(apiSurface, containsOnlyClassesMatching(allowedClasses));
   }
 }


Mime
View raw message