You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2016/09/13 19:30:25 UTC

[4/4] logging-log4j2 git commit: [LOG4J2-1320] Custom plugins are not loaded, URL protocol vfs is not supported. Clean up resources.

[LOG4J2-1320] Custom plugins are not loaded, URL protocol vfs is not
supported. Clean up resources.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/789d74ad
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/789d74ad
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/789d74ad

Branch: refs/heads/master
Commit: 789d74ad3f2322e46b9e9b617108e36b49fae558
Parents: c4db4df
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Sep 13 12:24:39 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Sep 13 12:24:39 2016 -0700

----------------------------------------------------------------------
 .../config/plugins/util/ResolverUtilCustomProtocolTest.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/789d74ad/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtilCustomProtocolTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtilCustomProtocolTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtilCustomProtocolTest.java
index 8891415..33e0ee1 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtilCustomProtocolTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtilCustomProtocolTest.java
@@ -31,9 +31,11 @@ import java.util.Collections;
 import java.util.Enumeration;
 
 import org.apache.logging.log4j.core.config.plugins.util.PluginRegistry.PluginTest;
+import org.apache.logging.log4j.junit.CleanFolders;
 import org.apache.logging.log4j.junit.URLStreamHandlerFactoryRule;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
 
 /**
  * Tests the ResolverUtil class for custom protocol like bundleresource, vfs, vfszip.
@@ -43,6 +45,9 @@ public class ResolverUtilCustomProtocolTest {
     @Rule
     public URLStreamHandlerFactoryRule rule = new URLStreamHandlerFactoryRule(new NoopURLStreamHandlerFactory());
 
+    @Rule
+    public RuleChain chain = RuleChain.outerRule(new CleanFolders(ResolverUtilTest.WORK_DIR));
+    
     static class NoopURLStreamHandlerFactory implements URLStreamHandlerFactory {
 
         @Override
@@ -181,7 +186,7 @@ public class ResolverUtilCustomProtocolTest {
         try (final URLClassLoader cl = ResolverUtilTest.compileAndCreateClassLoader("3")) {
             final ResolverUtil resolverUtil = new ResolverUtil();
             resolverUtil
-                    .setClassLoader(new SingleURLClassLoader(new URL("vfs:/target/resolverutil3/customplugin3/"), cl));
+                    .setClassLoader(new SingleURLClassLoader(new URL("vfs:/" + ResolverUtilTest.WORK_DIR + "/resolverutil3/customplugin3/"), cl));
             resolverUtil.findInPackage(new PluginTest(), "customplugin3");
             assertEquals("Class not found in packages", 1, resolverUtil.getClasses().size());
             assertEquals("Unexpected class resolved", cl.loadClass("customplugin3.FixedString3Layout"),
@@ -194,7 +199,7 @@ public class ResolverUtilCustomProtocolTest {
         try (final URLClassLoader cl = ResolverUtilTest.compileJarAndCreateClassLoader("4")) {
             final ResolverUtil resolverUtil = new ResolverUtil();
             resolverUtil.setClassLoader(new SingleURLClassLoader(
-                    new URL("vfs:/target/resolverutil4/customplugin4.jar/customplugin4/"), cl));
+                    new URL("vfs:/" + ResolverUtilTest.WORK_DIR + "/resolverutil4/customplugin4.jar/customplugin4/"), cl));
             resolverUtil.findInPackage(new PluginTest(), "customplugin4");
             assertEquals("Class not found in packages", 1, resolverUtil.getClasses().size());
             assertEquals("Unexpected class resolved", cl.loadClass("customplugin4.FixedString4Layout"),