Merge "Update to Jenkins LTS 1.625.3 and fix function registration"

This commit is contained in:
Jenkins 2016-03-18 16:23:36 +00:00 committed by Gerrit Code Review
commit b879f56ef1
7 changed files with 11 additions and 10 deletions

View File

@ -28,7 +28,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.565.3</version><!-- which version of Jenkins is this plugin built against? -->
<version>1.625.3</version> <!--which version of Jenkins is this plugin built against? -->
</parent>
<artifactId>gearman-plugin</artifactId>

View File

@ -117,7 +117,7 @@ public class ExecutorWorkerThread extends AbstractWorkerThread{
if (!computer.isOffline()) {
Node node = computer.getNode();
List<AbstractProject> allProjects = Jenkins.getInstance().getAllItems(AbstractProject.class);
List<AbstractProject> allProjects = Jenkins.getActiveInstance().getAllItems(AbstractProject.class);
for (AbstractProject<?, ?> project : allProjects) {
if (project.isDisabled()) { // ignore all disabled projects

View File

@ -51,7 +51,7 @@ public class GearmanPluginUtil {
*/
public static String getRealName(Computer computer) {
if (Computer.currentComputer() == computer) {
if (Jenkins.getActiveInstance().getComputer("") == computer) {
return "master";
} else {
return computer.getName();
@ -70,7 +70,7 @@ public class GearmanPluginUtil {
*/
public static Run<?,?> findBuild(String jobName, int buildNumber) {
AbstractProject<?,?> project = Jenkins.getInstance().getItemByFullName(jobName, AbstractProject.class);
AbstractProject<?,?> project = Jenkins.getActiveInstance().getItemByFullName(jobName, AbstractProject.class);
if (project != null){
Run<?,?> run = project.getBuildByNumber(buildNumber);
if (run != null) {

View File

@ -70,7 +70,7 @@ public class GearmanProxy {
String hostname = Constants.GEARMAN_DEFAULT_EXECUTOR_NAME;
// query Jenkins for master's name
try {
master = Jenkins.getInstance().getComputer("");
master = Jenkins.getActiveInstance().getComputer("");
hostname = master.getHostName();
} catch (Exception e) {
logger.warn("Exception while getting hostname", e);
@ -119,7 +119,7 @@ public class GearmanProxy {
// first make sure master is enabled (or has executors)
Node masterNode = null;
try {
masterNode = Computer.currentComputer().getNode();
masterNode = Jenkins.getActiveInstance().getComputer("").getNode();
} catch (NullPointerException npe) {
logger.info("---- Master is offline");
} catch (Exception e) {
@ -136,7 +136,7 @@ public class GearmanProxy {
/*
* Spawn executors for the jenkins slaves
*/
List<Node> nodes = Jenkins.getInstance().getNodes();
List<Node> nodes = Jenkins.getActiveInstance().getNodes();
if (!nodes.isEmpty()) {
for (Node node : nodes) {
Computer computer = node.toComputer();

View File

@ -38,7 +38,7 @@ public class NodeAvailabilityMonitor implements AvailabilityMonitor {
{
this.computer = computer;
queue = Queue.getInstance();
jenkins = Jenkins.getInstance();
jenkins = Jenkins.getActiveInstance();
}
public Computer getComputer() {

View File

@ -48,7 +48,7 @@ public class GearmanPluginConfigTest {
public void setUp() {
Jenkins jenkins = mock(Jenkins.class);
PowerMockito.mockStatic(Jenkins.class);
when(Jenkins.getInstance()).thenReturn(jenkins);
when(Jenkins.getActiveInstance()).thenReturn(jenkins);
gpc = new GearmanPluginConfig();
}

View File

@ -20,6 +20,7 @@ package hudson.plugins.gearman;
import hudson.model.Computer;
import hudson.slaves.DumbSlave;
import jenkins.model.Jenkins;
import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;
@ -45,7 +46,7 @@ public class GearmanPluginUtilTest extends HudsonTestCase {
@Test
public void testGetRealNameMaster() throws Exception {
assertEquals("master", GearmanPluginUtil.getRealName(Computer.currentComputer()));
assertEquals("master", GearmanPluginUtil.getRealName(Jenkins.getActiveInstance().getComputer("")));
}
}