Fix #1 execution parser to include argstring

This commit is contained in:
Greg Schueler 2012-10-05 08:39:54 -07:00
parent adfcc6393a
commit 1a810ac463
6 changed files with 27 additions and 3 deletions

View file

@ -50,6 +50,7 @@ public class RundeckExecution implements Serializable {
private String abortedBy;
private String description;
private String argstring;
/**
* @return the duration of the execution in milliseconds (or null if the duration is still running, or has been
@ -170,6 +171,7 @@ public class RundeckExecution implements Serializable {
@Override
public String toString() {
return "RundeckExecution [id=" + id + ", description=" + description + ", url=" + url + ", status=" + status
+ ", argstring=" + argstring
+ ", startedBy=" + startedBy + ", startedAt=" + startedAt + ", endedAt=" + endedAt
+ ", durationInSeconds=" + getDurationInSeconds() + ", abortedBy=" + abortedBy + ", job=" + job + "]";
}
@ -179,6 +181,7 @@ public class RundeckExecution implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((abortedBy == null) ? 0 : abortedBy.hashCode());
result = prime * result + ((argstring == null) ? 0 : argstring.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((endedAt == null) ? 0 : endedAt.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
@ -204,6 +207,11 @@ public class RundeckExecution implements Serializable {
return false;
} else if (!abortedBy.equals(other.abortedBy))
return false;
if (argstring == null) {
if (other.argstring != null)
return false;
} else if (!argstring.equals(other.argstring))
return false;
if (description == null) {
if (other.description != null)
return false;
@ -247,6 +255,17 @@ public class RundeckExecution implements Serializable {
return true;
}
/**
* the argument string for the execution
*/
public String getArgstring() {
return argstring;
}
public void setArgstring(String argstring) {
this.argstring = argstring;
}
/**
* The status of an execution
*/

View file

@ -57,6 +57,7 @@ public class ExecutionParser implements XmlNodeParser<RundeckExecution> {
execution.setStatus(null);
}
execution.setDescription(StringUtils.trimToNull(execNode.valueOf("description")));
execution.setArgstring(StringUtils.trimToNull(execNode.valueOf("argstring")));
execution.setStartedBy(StringUtils.trimToNull(execNode.valueOf("user")));
execution.setAbortedBy(StringUtils.trimToNull(execNode.valueOf("abortedby")));
String startedAt = StringUtils.trimToNull(execNode.valueOf("date-started/@unixtime"));

View file

@ -49,6 +49,7 @@ public class ExecutionParserTest {
Assert.assertEquals(null, execution.getDuration());
Assert.assertEquals(null, execution.getAbortedBy());
Assert.assertEquals("ls ${option.dir}", execution.getDescription());
Assert.assertEquals("-arg1 value -arg2 value", execution.getArgstring());
Assert.assertEquals("1", job.getId());
Assert.assertEquals("ls", job.getName());
@ -75,6 +76,7 @@ public class ExecutionParserTest {
Assert.assertEquals("1 minute 4 seconds", execution.getDuration());
Assert.assertEquals(null, execution.getAbortedBy());
Assert.assertEquals("ls ${option.dir}", execution.getDescription());
Assert.assertEquals("-argA some -argB thing", execution.getArgstring());
Assert.assertEquals("1", job.getId());
Assert.assertEquals("ls", job.getName());
@ -101,6 +103,7 @@ public class ExecutionParserTest {
Assert.assertEquals("0 seconds", execution.getDuration());
Assert.assertEquals(null, execution.getAbortedBy());
Assert.assertEquals("w", execution.getDescription());
Assert.assertEquals("-monkey true", execution.getArgstring());
Assert.assertNull(job);
}
@ -123,6 +126,7 @@ public class ExecutionParserTest {
Assert.assertNull(execution.getDuration());
Assert.assertNull(execution.getAbortedBy());
Assert.assertNull(execution.getDescription());
Assert.assertNull(execution.getArgstring());
Assert.assertNull(job);
}

View file

@ -1 +1 @@
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='succeeded'><user>admin</user><date-started unixtime='1309857539137'>2011-07-05T09:18:59Z</date-started><date-ended unixtime='1309857539606'>2011-07-05T09:18:59Z</date-ended><description>w</description></execution></executions></result>
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='succeeded'><user>admin</user><date-started unixtime='1309857539137'>2011-07-05T09:18:59Z</date-started><date-ended unixtime='1309857539606'>2011-07-05T09:18:59Z</date-ended><description>w</description><argstring>-monkey true</argstring></execution></executions></result>

View file

@ -1 +1 @@
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='running'><user>admin</user><date-started unixtime='1302183830082'>2011-04-07T13:43:50Z</date-started><job id='1'><name>ls</name><group>system</group><project>test</project><description>list files</description></job><description>ls ${option.dir}</description></execution></executions></result>
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='running'><user>admin</user><date-started unixtime='1302183830082'>2011-04-07T13:43:50Z</date-started><job id='1'><name>ls</name><group>system</group><project>test</project><description>list files</description></job><description>ls ${option.dir}</description><argstring>-arg1 value -arg2 value</argstring></execution></executions></result>

View file

@ -1 +1 @@
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='succeeded'><user>admin</user><date-started unixtime="1308322895104">2011-06-17T15:01:35Z</date-started><date-ended unixtime="1308322959420">2011-06-17T15:02:39Z</date-ended><job id='1'><name>ls</name><group>system</group><project>test</project><description>list files</description></job><description>ls ${option.dir}</description></execution></executions></result>
<result success='true' apiversion='1'><executions count='1'><execution id='1' href='http://localhost:4440/execution/follow/1' status='succeeded'><user>admin</user><date-started unixtime="1308322895104">2011-06-17T15:01:35Z</date-started><date-ended unixtime="1308322959420">2011-06-17T15:02:39Z</date-ended><job id='1'><name>ls</name><group>system</group><project>test</project><description>list files</description></job><description>ls ${option.dir}</description><argstring>-argA some -argB thing</argstring></execution></executions></result>