From c6c7d9ce24ac6262c92d06bd8a3793d7696f389b Mon Sep 17 00:00:00 2001 From: mindless Date: Fri, 23 Apr 2010 22:22:28 +0000 Subject: [PATCH] Add the.hpl in loadBundledPlugins if available, so a plugin can find itself in the PluginManager when running its own tests. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@30361 71c3de6d-444a-0410-be80-ed276b4c234a --- .../java/org/jvnet/hudson/test/TestPluginManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java b/test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java index eae934678c..330205ec35 100644 --- a/test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java +++ b/test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java @@ -31,6 +31,7 @@ import hudson.Util; import java.io.File; import java.io.IOException; +import java.net.URL; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -71,6 +72,14 @@ public class TestPluginManager extends PluginManager { LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+child,e); } } + // If running tests for a plugin, include the plugin being tested + URL u = getClass().getClassLoader().getResource("the.hpl"); + if (u!=null) try { + names.add("the.hpl"); + copyBundledPlugin(u, "the.hpl"); + } catch (IOException e) { + LOGGER.log(Level.SEVERE, "Failed to copy the.hpl",e); + } return names; }