beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [1/2] beam git commit: Use Thread context ClassLoader as parent in AvroCoderTest
Date Wed, 03 May 2017 21:09:07 GMT
Repository: beam
Updated Branches:
  refs/heads/master aafa1bba9 -> b263cb776


Use Thread context ClassLoader as parent in AvroCoderTest


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

Branch: refs/heads/master
Commit: cda1405dbdc25888eae32395149c3425bed8dd7f
Parents: 1b0400f
Author: Kenneth Knowles <klk@google.com>
Authored: Wed May 3 09:42:01 2017 -0700
Committer: Kenneth Knowles <klk@google.com>
Committed: Wed May 3 09:42:01 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/beam/sdk/coders/AvroCoderTest.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/cda1405d/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/AvroCoderTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/AvroCoderTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/AvroCoderTest.java
index e1d5359..8942a9e 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/AvroCoderTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/coders/AvroCoderTest.java
@@ -169,6 +169,11 @@ public class AvroCoderTest {
    * A classloader that intercepts loading of Pojo and makes a new one.
    */
   private static class InterceptingUrlClassLoader extends ClassLoader {
+
+    private InterceptingUrlClassLoader(ClassLoader parent) {
+      super(parent);
+    }
+
     @Override
     public Class<?> loadClass(String name) throws ClassNotFoundException {
       if (name.equals(AvroCoderTestPojo.class.getName())) {
@@ -193,8 +198,10 @@ public class AvroCoderTest {
    */
   @Test
   public void testTwoClassLoaders() throws Exception {
-    ClassLoader loader1 = new InterceptingUrlClassLoader();
-    ClassLoader loader2 = new InterceptingUrlClassLoader();
+    ClassLoader loader1 =
+        new InterceptingUrlClassLoader(Thread.currentThread().getContextClassLoader());
+    ClassLoader loader2 =
+        new InterceptingUrlClassLoader(Thread.currentThread().getContextClassLoader());
 
     Class<?> pojoClass1 = loader1.loadClass(AvroCoderTestPojo.class.getName());
     Class<?> pojoClass2 = loader2.loadClass(AvroCoderTestPojo.class.getName());


Mime
View raw message