[ 
https://issues.apache.org/jira/browse/BEAM-3479?focusedWorklogId=90120&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-90120
 ]

ASF GitHub Bot logged work on BEAM-3479:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Apr/18 18:52
            Start Date: 11/Apr/18 18:52
    Worklog Time Spent: 10m 
      Work Description: rmannibucau commented on a change in pull request 
#4412: [BEAM-3479] adding a test to ensure the right classloader is used to 
defined the dofninvoker
URL: https://github.com/apache/beam/pull/4412#discussion_r180861562
 
 

 ##########
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactoryTest.java
 ##########
 @@ -0,0 +1,74 @@
+/*
+ * 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.transforms.reflect;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.beam.sdk.testing.InterceptingUrlClassLoader;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.junit.Test;
+
+/**
+ * Tests for the proxy generator based on byte buddy.
+ */
+public class ByteBuddyDoFnInvokerFactoryTest {
+  /**
+   * Ensuring we define the subclass using bytebuddy in the right classloader,
+   * i.e. the doFn classloader and not beam classloader.
+   */
+  @Test
+  public void validateProxyClassLoaderSelectionLogic() throws Exception {
+    final ClassLoader testLoader = 
Thread.currentThread().getContextClassLoader();
+    final ClassLoader loader = new InterceptingUrlClassLoader(testLoader, 
MyDoFn.class.getName());
+    final Class<? extends DoFn<?, ?>> source = (Class<? extends DoFn<?, ?>>) 
loader.loadClass(
+        
"org.apache.beam.sdk.transforms.reflect.ByteBuddyDoFnInvokerFactoryTest$MyDoFn");
+    assertEquals(loader, source.getClassLoader()); // precondition check
+    final String proxyName = source.getName()
 
 Review comment:
   yes, this is what is tested, maybe not the way you think? guess it can just 
be a phrasing issue at the end.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 90120)
    Time Spent: 2h 10m  (was: 2h)

> Add a regression test for the DoFn classloader selection
> --------------------------------------------------------
>
>                 Key: BEAM-3479
>                 URL: https://issues.apache.org/jira/browse/BEAM-3479
>             Project: Beam
>          Issue Type: Task
>          Components: sdk-java-core
>            Reporter: Romain Manni-Bucau
>            Assignee: Romain Manni-Bucau
>            Priority: Major
>             Fix For: 2.5.0
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Follow up task after https://github.com/apache/beam/pull/4235 merge. This 
> task is about ensuring we test that.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to