You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2020/06/05 20:23:39 UTC
[nifi] branch master updated: NIFI-7508: Reset classloader after
running TestStandardControllerServiceInvocationHandler and fix checkstyle
violation on NiFiSystemIT
This is an automated email from the ASF dual-hosted git repository.
markap14 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new dfefeb7 NIFI-7508: Reset classloader after running TestStandardControllerServiceInvocationHandler and fix checkstyle violation on NiFiSystemIT
dfefeb7 is described below
commit dfefeb7b18ebcc46807d82acda5b37ed6477c321
Author: Joey Frazee <jf...@apache.org>
AuthorDate: Thu Jun 4 23:14:51 2020 -0500
NIFI-7508: Reset classloader after running TestStandardControllerServiceInvocationHandler
and fix checkstyle violation on NiFiSystemIT
---
.../TestStandardControllerServiceInvocationHandler.java | 12 +++++++++++-
.../test/java/org/apache/nifi/tests/system/NiFiSystemIT.java | 1 -
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
index bee0b34..7d94b37 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/service/TestStandardControllerServiceInvocationHandler.java
@@ -20,6 +20,7 @@ package org.apache.nifi.controller.service;
import org.apache.nifi.controller.AbstractControllerService;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.nar.ExtensionManager;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -35,13 +36,22 @@ import static org.junit.Assert.assertTrue;
public class TestStandardControllerServiceInvocationHandler {
+ private ClassLoader originalClassLoader;
+
@Before
- public void setClassLoader() {
+ public void setEmptyClassLoader() {
+ this.originalClassLoader = Thread.currentThread().getContextClassLoader();
+
// Change context class loader to a new, empty class loader so that calls to Controller Service will need to proxy returned objects.
final URLClassLoader classLoader = new URLClassLoader(new URL[] {}, null);
Thread.currentThread().setContextClassLoader(classLoader);
}
+ @After
+ public void setOriginalClassLoaderBack() {
+ if (originalClassLoader != null) Thread.currentThread().setContextClassLoader(originalClassLoader);
+ }
+
@Test
public void testSimpleProxy() {
final BaseControllerService proxiedService = createProxyService();
diff --git a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiSystemIT.java b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiSystemIT.java
index a57d4ea..55b1402 100644
--- a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiSystemIT.java
+++ b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/NiFiSystemIT.java
@@ -40,7 +40,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BooleanSupplier;
import java.util.regex.Matcher;