summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-18 16:23:36 +0000
committerGerrit Code Review <review@openstack.org>2016-03-18 16:23:36 +0000
commitb879f56ef1ccb3f81edd7768d439c7617edf6df2 (patch)
tree9969c2e7df4c23c33c9422e0b0c0e14bc6d67a04
parentc5637cef49d7c8069c039a40287687fc798eee84 (diff)
parenta5164d65a4c42e784d253c553396b61a24ae0d9c (diff)
Merge "Update to Jenkins LTS 1.625.3 and fix function registration"0.2.0
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java2
-rw-r--r--src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java4
-rw-r--r--src/main/java/hudson/plugins/gearman/GearmanProxy.java6
-rw-r--r--src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java2
-rw-r--r--src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java2
-rw-r--r--src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java3
7 files changed, 11 insertions, 10 deletions
diff --git a/pom.xml b/pom.xml
index 0cf01c6..9d47ff4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
28 <parent> 28 <parent>
29 <groupId>org.jenkins-ci.plugins</groupId> 29 <groupId>org.jenkins-ci.plugins</groupId>
30 <artifactId>plugin</artifactId> 30 <artifactId>plugin</artifactId>
31 <version>1.565.3</version><!-- which version of Jenkins is this plugin built against? --> 31 <version>1.625.3</version> <!--which version of Jenkins is this plugin built against? -->
32 </parent> 32 </parent>
33 33
34 <artifactId>gearman-plugin</artifactId> 34 <artifactId>gearman-plugin</artifactId>
diff --git a/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java b/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
index 7409b00..18bf100 100644
--- a/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
+++ b/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
@@ -117,7 +117,7 @@ public class ExecutorWorkerThread extends AbstractWorkerThread{
117 if (!computer.isOffline()) { 117 if (!computer.isOffline()) {
118 Node node = computer.getNode(); 118 Node node = computer.getNode();
119 119
120 List<AbstractProject> allProjects = Jenkins.getInstance().getAllItems(AbstractProject.class); 120 List<AbstractProject> allProjects = Jenkins.getActiveInstance().getAllItems(AbstractProject.class);
121 for (AbstractProject<?, ?> project : allProjects) { 121 for (AbstractProject<?, ?> project : allProjects) {
122 122
123 if (project.isDisabled()) { // ignore all disabled projects 123 if (project.isDisabled()) { // ignore all disabled projects
diff --git a/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java b/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
index 4f35d84..e16e315 100644
--- a/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
+++ b/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
@@ -51,7 +51,7 @@ public class GearmanPluginUtil {
51 */ 51 */
52 public static String getRealName(Computer computer) { 52 public static String getRealName(Computer computer) {
53 53
54 if (Computer.currentComputer() == computer) { 54 if (Jenkins.getActiveInstance().getComputer("") == computer) {
55 return "master"; 55 return "master";
56 } else { 56 } else {
57 return computer.getName(); 57 return computer.getName();
@@ -70,7 +70,7 @@ public class GearmanPluginUtil {
70 */ 70 */
71 public static Run<?,?> findBuild(String jobName, int buildNumber) { 71 public static Run<?,?> findBuild(String jobName, int buildNumber) {
72 72
73 AbstractProject<?,?> project = Jenkins.getInstance().getItemByFullName(jobName, AbstractProject.class); 73 AbstractProject<?,?> project = Jenkins.getActiveInstance().getItemByFullName(jobName, AbstractProject.class);
74 if (project != null){ 74 if (project != null){
75 Run<?,?> run = project.getBuildByNumber(buildNumber); 75 Run<?,?> run = project.getBuildByNumber(buildNumber);
76 if (run != null) { 76 if (run != null) {
diff --git a/src/main/java/hudson/plugins/gearman/GearmanProxy.java b/src/main/java/hudson/plugins/gearman/GearmanProxy.java
index 38f3360..26935e8 100644
--- a/src/main/java/hudson/plugins/gearman/GearmanProxy.java
+++ b/src/main/java/hudson/plugins/gearman/GearmanProxy.java
@@ -70,7 +70,7 @@ public class GearmanProxy {
70 String hostname = Constants.GEARMAN_DEFAULT_EXECUTOR_NAME; 70 String hostname = Constants.GEARMAN_DEFAULT_EXECUTOR_NAME;
71 // query Jenkins for master's name 71 // query Jenkins for master's name
72 try { 72 try {
73 master = Jenkins.getInstance().getComputer(""); 73 master = Jenkins.getActiveInstance().getComputer("");
74 hostname = master.getHostName(); 74 hostname = master.getHostName();
75 } catch (Exception e) { 75 } catch (Exception e) {
76 logger.warn("Exception while getting hostname", e); 76 logger.warn("Exception while getting hostname", e);
@@ -119,7 +119,7 @@ public class GearmanProxy {
119 // first make sure master is enabled (or has executors) 119 // first make sure master is enabled (or has executors)
120 Node masterNode = null; 120 Node masterNode = null;
121 try { 121 try {
122 masterNode = Computer.currentComputer().getNode(); 122 masterNode = Jenkins.getActiveInstance().getComputer("").getNode();
123 } catch (NullPointerException npe) { 123 } catch (NullPointerException npe) {
124 logger.info("---- Master is offline"); 124 logger.info("---- Master is offline");
125 } catch (Exception e) { 125 } catch (Exception e) {
@@ -136,7 +136,7 @@ public class GearmanProxy {
136 /* 136 /*
137 * Spawn executors for the jenkins slaves 137 * Spawn executors for the jenkins slaves
138 */ 138 */
139 List<Node> nodes = Jenkins.getInstance().getNodes(); 139 List<Node> nodes = Jenkins.getActiveInstance().getNodes();
140 if (!nodes.isEmpty()) { 140 if (!nodes.isEmpty()) {
141 for (Node node : nodes) { 141 for (Node node : nodes) {
142 Computer computer = node.toComputer(); 142 Computer computer = node.toComputer();
diff --git a/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java b/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
index 24f3f66..96b6aae 100644
--- a/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
+++ b/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
@@ -38,7 +38,7 @@ public class NodeAvailabilityMonitor implements AvailabilityMonitor {
38 { 38 {
39 this.computer = computer; 39 this.computer = computer;
40 queue = Queue.getInstance(); 40 queue = Queue.getInstance();
41 jenkins = Jenkins.getInstance(); 41 jenkins = Jenkins.getActiveInstance();
42 } 42 }
43 43
44 public Computer getComputer() { 44 public Computer getComputer() {
diff --git a/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java b/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
index 7382b10..f403387 100644
--- a/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
+++ b/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
@@ -48,7 +48,7 @@ public class GearmanPluginConfigTest {
48 public void setUp() { 48 public void setUp() {
49 Jenkins jenkins = mock(Jenkins.class); 49 Jenkins jenkins = mock(Jenkins.class);
50 PowerMockito.mockStatic(Jenkins.class); 50 PowerMockito.mockStatic(Jenkins.class);
51 when(Jenkins.getInstance()).thenReturn(jenkins); 51 when(Jenkins.getActiveInstance()).thenReturn(jenkins);
52 52
53 gpc = new GearmanPluginConfig(); 53 gpc = new GearmanPluginConfig();
54 } 54 }
diff --git a/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java b/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
index 0f5a269..486efd6 100644
--- a/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
+++ b/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
@@ -20,6 +20,7 @@ package hudson.plugins.gearman;
20 20
21import hudson.model.Computer; 21import hudson.model.Computer;
22import hudson.slaves.DumbSlave; 22import hudson.slaves.DumbSlave;
23import jenkins.model.Jenkins;
23 24
24import org.junit.Test; 25import org.junit.Test;
25import org.jvnet.hudson.test.HudsonTestCase; 26import org.jvnet.hudson.test.HudsonTestCase;
@@ -45,7 +46,7 @@ public class GearmanPluginUtilTest extends HudsonTestCase {
45 @Test 46 @Test
46 public void testGetRealNameMaster() throws Exception { 47 public void testGetRealNameMaster() throws Exception {
47 48
48 assertEquals("master", GearmanPluginUtil.getRealName(Computer.currentComputer())); 49 assertEquals("master", GearmanPluginUtil.getRealName(Jenkins.getActiveInstance().getComputer("")));
49 } 50 }
50 51
51} 52}