Skip to content

Commit 254955c

Browse files
committed
o Improved the Build class which now contains the queueId
o JobWithDetails o Added QueueItem o Added inQueue
1 parent a29bbf3 commit 254955c

6 files changed

Lines changed: 493 additions & 227 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
public class Build extends BaseModel {
1414

1515
int number;
16+
int queueId;
1617
String url;
1718

1819
public Build() {}
@@ -29,6 +30,10 @@ public Build(int number, String url) {
2930
public int getNumber() {
3031
return number;
3132
}
33+
34+
public int getQueueId() {
35+
return queueId;
36+
}
3237

3338
public String getUrl() {
3439
return url;

src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
public class BuildWithDetails extends Build {
2020

21-
List actions;
21+
List actions; //Should be improved.
2222
boolean building;
2323
String description;
2424
int duration;
@@ -125,6 +125,11 @@ public boolean apply(Map<String, Object> action) {
125125
return params;
126126
}
127127

128+
/**
129+
* @return The console output of the build. The
130+
* line separation is done by {@code CR+LF}.
131+
* @throws IOException in case of a failure.
132+
*/
128133
public String getConsoleOutputText() throws IOException {
129134
return client.get(url + "/logText/progressiveText");
130135
}

src/main/java/com/offbytwo/jenkins/model/Executable.java

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,65 @@
22

33
public class Executable
44
{
5-
Long number;
6-
String url;
7-
public Long getNumber()
8-
{
9-
return number;
10-
}
11-
public void setNumber(Long number)
12-
{
13-
this.number = number;
14-
}
15-
public String getUrl()
16-
{
17-
return url;
18-
}
19-
public void setUrl(String url)
20-
{
21-
this.url = url;
22-
}
23-
24-
5+
Long number;
6+
7+
String url;
8+
9+
public Long getNumber()
10+
{
11+
return number;
12+
}
13+
14+
public void setNumber( Long number )
15+
{
16+
this.number = number;
17+
}
18+
19+
public String getUrl()
20+
{
21+
return url;
22+
}
23+
24+
public void setUrl( String url )
25+
{
26+
this.url = url;
27+
}
28+
29+
@Override
30+
public int hashCode()
31+
{
32+
final int prime = 31;
33+
int result = 1;
34+
result = prime * result + ( ( number == null ) ? 0 : number.hashCode() );
35+
result = prime * result + ( ( url == null ) ? 0 : url.hashCode() );
36+
return result;
37+
}
38+
39+
@Override
40+
public boolean equals( Object obj )
41+
{
42+
if ( this == obj )
43+
return true;
44+
if ( obj == null )
45+
return false;
46+
if ( getClass() != obj.getClass() )
47+
return false;
48+
Executable other = (Executable) obj;
49+
if ( number == null )
50+
{
51+
if ( other.number != null )
52+
return false;
53+
}
54+
else if ( !number.equals( other.number ) )
55+
return false;
56+
if ( url == null )
57+
{
58+
if ( other.url != null )
59+
return false;
60+
}
61+
else if ( !url.equals( other.url ) )
62+
return false;
63+
return true;
64+
}
65+
2566
}

src/main/java/com/offbytwo/jenkins/model/Job.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public JobWithDetails details() throws IOException {
4545
* Trigger a build without parameters
4646
*/
4747
public void build() throws IOException {
48+
System.out.println( "URL:" + url );
4849
client.post(url + "build", true);
4950
}
5051

0 commit comments

Comments
 (0)