Skip to content

Commit 6b12b6a

Browse files
committed
Fixed #201
o MavenJobWithDetails behaves different than JobWithDetails for methods
1 parent 7356c44 commit 6b12b6a

File tree

5 files changed

+255
-135
lines changed

5 files changed

+255
-135
lines changed

ReleaseNotes.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ public class JenkinsServer {
3939
Returning null instead of IOException if view is not found in JenkinsServer.getView
4040

4141

42+
* [Fixed Issue 201][issue-201]
43+
44+
`MavenJobsWithDetails` is now in line with `JobWithDetails` and returns
45+
`MavenBuild.BUILD_HAS_NEVER_RUN` in cases where the run has not taken
46+
place yet.
47+
48+
```java
49+
public class MavenJobWithDetails {
50+
public MavenBuild getLastBuild();
51+
public MavenBuild getLastCompletedBuild();
52+
public MavenBuild getLastFailedBuild();
53+
public MavenBuild getLastStableBuild();
54+
public MavenBuild getLastSuccessfulBuild();
55+
public MavenBuild getLastUnstableBuild();
56+
public MavenBuild getLastUnsuccessfulBuild();
57+
58+
}
59+
```
60+
61+
The `getBuilds()` method will return an empty list instead of `NULL` in cases no
62+
builds exists.
63+
4264
## Release 0.3.6
4365

4466
### General Changes
@@ -629,6 +651,7 @@ TestReport testReport = mavenJob.getLastSuccessfulBuild().getTestReport();
629651
[issue-179]: https://github.com/jenkinsci/java-client-api/issues/179
630652
[issue-182]: https://github.com/jenkinsci/java-client-api/issues/182
631653
[issue-186]: https://github.com/jenkinsci/java-client-api/issues/186
654+
[issue-201]: https://github.com/jenkinsci/java-client-api/issues/201
632655
[pull-123]: https://github.com/jenkinsci/java-client-api/pull/123
633656
[pull-149]: https://github.com/jenkinsci/java-client-api/pull/149
634657
[pull-158]: https://github.com/jenkinsci/java-client-api/pull/158

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Build.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ public String getUrl() {
5353
return url;
5454
}
5555

56+
protected void setNumber(int number) {
57+
this.number = number;
58+
}
59+
60+
protected void setQueueId(int queueId) {
61+
this.queueId = queueId;
62+
}
63+
64+
protected void setUrl(String url) {
65+
this.url = url;
66+
}
67+
5668
public BuildWithDetails details() throws IOException {
5769
return client.get(url, BuildWithDetails.class);
5870
}

0 commit comments

Comments
 (0)