mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-07 13:38:23 +00:00
Test api v11 response for trigger job
This commit is contained in:
parent
c8e1315612
commit
8cc48ecd89
3 changed files with 85 additions and 0 deletions
|
@ -634,6 +634,43 @@ public class RundeckClientTest {
|
|||
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
|
||||
|
||||
}
|
||||
@Test
|
||||
@Betamax(tape = "trigger_job_basic_v11")
|
||||
public void triggerJobBasic_v11() throws Exception {
|
||||
RundeckClient client = createClient(TEST_TOKEN_7, 11);
|
||||
|
||||
final RundeckExecution test
|
||||
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
|
||||
"-3f27cc0ee1a5").build());
|
||||
|
||||
Assert.assertEquals((Long) 943L, test.getId());
|
||||
Assert.assertEquals(null, test.getArgstring());
|
||||
Assert.assertEquals(null, test.getAbortedBy());
|
||||
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
|
||||
Assert.assertEquals("admin", test.getStartedBy());
|
||||
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* Response for API v11 incorrectly includes <result>, but we should handle this case
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Betamax(tape = "trigger_job_basic_v11_patch")
|
||||
public void triggerJobBasic_v11_patch() throws Exception {
|
||||
RundeckClient client = createClient(TEST_TOKEN_7, 11);
|
||||
|
||||
final RundeckExecution test
|
||||
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
|
||||
"-3f27cc0ee1a5").build());
|
||||
|
||||
Assert.assertEquals((Long) 944L, test.getId());
|
||||
Assert.assertEquals(null, test.getArgstring());
|
||||
Assert.assertEquals(null, test.getAbortedBy());
|
||||
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
|
||||
Assert.assertEquals("admin", test.getStartedBy());
|
||||
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Betamax(tape = "trigger_job_as_user")
|
||||
|
|
24
src/test/resources/betamax/tapes/trigger_job_basic_v11.yaml
Normal file
24
src/test/resources/betamax/tapes/trigger_job_basic_v11.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
!tape
|
||||
name: trigger_job_basic_v11
|
||||
interactions:
|
||||
- recorded: 2014-11-08T00:00:58.749Z
|
||||
request:
|
||||
method: GET
|
||||
uri: http://rundeck.local:4440/api/11/job/bda8b956-43a5-4eef-9c67-3f27cc0ee1a5/run
|
||||
headers:
|
||||
Accept: text/xml
|
||||
Host: rundeck.local:4440
|
||||
Proxy-Connection: Keep-Alive
|
||||
User-Agent: RunDeck API Java Client 11
|
||||
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
|
||||
response:
|
||||
status: 200
|
||||
headers:
|
||||
Content-Type: application/xml;charset=UTF-8
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
||||
Server: Jetty(7.6.0.v20120127)
|
||||
Set-Cookie: JSESSIONID=19ui1v6otua3h1714jv2zbkbid;Path=/
|
||||
X-Rundeck-API-Version: '12'
|
||||
X-Rundeck-API-XML-Response-Wrapper: 'false'
|
||||
body: !!binary |-
|
||||
PGV4ZWN1dGlvbnMgY291bnQ9JzEnPgogIDxleGVjdXRpb24gaWQ9Jzk0MycgaHJlZj0naHR0cDovL2RpZ25hbjo0NDQwL2V4ZWN1dGlvbi9mb2xsb3cvOTQzJyBzdGF0dXM9J3J1bm5pbmcnIHByb2plY3Q9J2RlbW8nPgogICAgPHVzZXI+YWRtaW48L3VzZXI+CiAgICA8ZGF0ZS1zdGFydGVkIHVuaXh0aW1lPScxNDE1NDA0ODU4NTE4Jz4yMDE0LTExLTA4VDAwOjAwOjU4WjwvZGF0ZS1zdGFydGVkPgogICAgPGpvYiBpZD0nYmRhOGI5NTYtNDNhNS00ZWVmLTljNjctM2YyN2NjMGVlMWE1Jz4KICAgICAgPG5hbWU+YSBqb2I8L25hbWU+CiAgICAgIDxncm91cD48L2dyb3VwPgogICAgICA8cHJvamVjdD5kZW1vPC9wcm9qZWN0PgogICAgICA8ZGVzY3JpcHRpb24+PC9kZXNjcmlwdGlvbj4KICAgIDwvam9iPgogICAgPGRlc2NyaXB0aW9uPmVjaG8gaGkgdGhlcmUgJHtqb2IudXNlcm5hbWV9IDsgc2xlZXAgOTA8L2Rlc2NyaXB0aW9uPgogICAgPGFyZ3N0cmluZyAvPgogIDwvZXhlY3V0aW9uPgo8L2V4ZWN1dGlvbnM+
|
|
@ -0,0 +1,24 @@
|
|||
!tape
|
||||
name: trigger_job_basic_v11_patch
|
||||
interactions:
|
||||
- recorded: 2014-11-08T00:05:15.235Z
|
||||
request:
|
||||
method: GET
|
||||
uri: http://rundeck.local:4440/api/11/job/bda8b956-43a5-4eef-9c67-3f27cc0ee1a5/run
|
||||
headers:
|
||||
Accept: text/xml
|
||||
Host: rundeck.local:4440
|
||||
Proxy-Connection: Keep-Alive
|
||||
User-Agent: RunDeck API Java Client 11
|
||||
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
|
||||
response:
|
||||
status: 200
|
||||
headers:
|
||||
Content-Type: text/xml;charset=UTF-8
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
||||
Server: Jetty(7.6.0.v20120127)
|
||||
Set-Cookie: JSESSIONID=1dfooymrwshimhr8fe4ncoc93;Path=/
|
||||
X-Rundeck-API-Version: '12'
|
||||
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='944' href='http://dignan:4440/execution/follow/944' status='running' project='demo'>\n <user>admin</user>\n <date-started unixtime='1415405114785'>2014-11-08T00:05:14Z</date-started>\n\
|
||||
\ <job id='bda8b956-43a5-4eef-9c67-3f27cc0ee1a5' averageDuration='90593'>\n <name>a job</name>\n <group></group>\n <project>demo</project>\n <description></description>\n </job>\n <description>echo hi there ${job.username}\
|
||||
\ ; sleep 90</description>\n <argstring />\n </execution>\n </executions>\n</result>"
|
Loading…
Add table
Add a link
Reference in a new issue