diff --git a/src/main/java/org/rundeck/api/RundeckClient.java b/src/main/java/org/rundeck/api/RundeckClient.java index 8147ac1..a002b8b 100644 --- a/src/main/java/org/rundeck/api/RundeckClient.java +++ b/src/main/java/org/rundeck/api/RundeckClient.java @@ -41,19 +41,10 @@ import org.rundeck.api.domain.RundeckProject; import org.rundeck.api.domain.RundeckSystemInfo; import org.rundeck.api.domain.RundeckExecution.ExecutionStatus; import org.rundeck.api.domain.RundeckOutput; -import org.rundeck.api.parser.AbortParser; -import org.rundeck.api.parser.ExecutionParser; -import org.rundeck.api.parser.HistoryParser; -import org.rundeck.api.parser.JobParser; -import org.rundeck.api.parser.JobsImportResultParser; -import org.rundeck.api.parser.ListParser; -import org.rundeck.api.parser.NodeParser; -import org.rundeck.api.parser.ProjectParser; -import org.rundeck.api.parser.StringParser; -import org.rundeck.api.parser.SystemInfoParser; -import org.rundeck.api.parser.OutputParser; +import org.rundeck.api.parser.*; import org.rundeck.api.query.ExecutionQuery; import org.rundeck.api.util.AssertUtil; +import org.rundeck.api.util.PagedResults; import org.rundeck.api.util.ParametersUtil; /** @@ -2027,18 +2018,21 @@ public class RundeckClient implements Serializable { * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace) */ - public List getExecutions(ExecutionQuery query, Long max, Long offset) - throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { - if(!query.notBlank()){ + public PagedResults getExecutions(ExecutionQuery query, Long max, Long offset) + throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { + if (!query.notBlank()) { throw new IllegalArgumentException("Some execution query parameter must be set"); } - AssertUtil.notBlank(query.getProject(),"project is required for execution query"); + AssertUtil.notBlank(query.getProject(), "project is required for execution query"); return new ApiCall(this).get(new ApiPathBuilder("/executions") .param(new ExecutionQueryParameters(query)) .param("max", max) .param("offset", offset), - new ListParser(new ExecutionParser(), - "result/executions/execution")); + new PagedResultParser( + new ListParser(new ExecutionParser(), "execution"), + "result/executions" + ) + ); } /** diff --git a/src/main/java/org/rundeck/api/parser/PagedResultParser.java b/src/main/java/org/rundeck/api/parser/PagedResultParser.java new file mode 100644 index 0000000..3eed01c --- /dev/null +++ b/src/main/java/org/rundeck/api/parser/PagedResultParser.java @@ -0,0 +1,116 @@ +/* + * Copyright 2012 DTO Labs, Inc. (http://dtolabs.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* +* PagedResultParser.java +* +* User: Greg Schueler greg@dtosolutions.com +* Created: 9/28/12 10:37 AM +* +*/ +package org.rundeck.api.parser; + +import org.dom4j.Element; +import org.dom4j.Node; +import org.rundeck.api.util.PagedResults; + +import java.util.*; + + +/** + * PagedResultParser extracts paging data from an xpath node, and includes the List result from a ListParser + * + * @author Greg Schueler greg@dtosolutions.com + */ +public class PagedResultParser implements XmlNodeParser> { + ListParser itemParser; + String xpath; + + /** + * Create a PagedResultParser + * + * @param itemParser the list parser + * @param xpath xpath for list container containing paging attributes + */ + public PagedResultParser(ListParser itemParser, String xpath) { + this.itemParser = itemParser; + this.xpath = xpath; + } + + @Override + public PagedResults parseXmlNode(Node node) { + Node pagedNodeContainer = node.selectSingleNode(xpath); + + Element el = (Element) pagedNodeContainer; + final int max = integerAttribute(el, "max", -1); + final int offset = integerAttribute(el, "offset", -1); + final int total = integerAttribute(el, "total", -1); + final int count = integerAttribute(el, "count", -1); + + final List ts = itemParser.parseXmlNode(pagedNodeContainer); + + + return new PagedResults() { + @Override + public int getMax() { + return max; + } + + @Override + public int getOffset() { + return offset; + } + + @Override + public int getTotal() { + return total; + } + + @Override + public List getResults() { + return ts; + } + + @Override + public int getCount() { + return count; + } + + @Override + public Iterator iterator() { + return ts.iterator(); + } + }; + } + + /** + * Return an integer value of an attribute of an element, or a default value if it is not found or not an integer. + * + * @param el the element + * @param attribute attribute name + * @param defValue default value to return + */ + private int integerAttribute(Element el, final String attribute, final int defValue) { + int parseMax = defValue; + try { + final String max1 = null != el.attribute(attribute) ? el.attribute(attribute).getStringValue() : null; + parseMax = null != max1 ? Integer.parseInt(max1) : defValue; + } catch (NumberFormatException e) { + } + return parseMax; + } +} diff --git a/src/main/java/org/rundeck/api/util/PagedResults.java b/src/main/java/org/rundeck/api/util/PagedResults.java new file mode 100644 index 0000000..31c2985 --- /dev/null +++ b/src/main/java/org/rundeck/api/util/PagedResults.java @@ -0,0 +1,60 @@ +/* + * Copyright 2012 DTO Labs, Inc. (http://dtolabs.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* +* PagedResults.java +* +* User: Greg Schueler greg@dtosolutions.com +* Created: 9/28/12 10:32 AM +* +*/ +package org.rundeck.api.util; + +import java.util.List; + + +/** + * PagedResults contains a List of a certain type, and paging information. + * + * @author Greg Schueler greg@dtosolutions.com + */ +public interface PagedResults extends Iterable{ + /** + * Max number of items returned in page + */ + public int getMax(); + + /** + * Offset into all items + */ + public int getOffset(); + + /** + * Total items to be paged + */ + public int getTotal(); + + /** + * Number of items available in page + */ + public int getCount(); + + /** + * Results list + */ + public List getResults(); +} diff --git a/src/test/java/org/rundeck/api/RundeckClientTest.java b/src/test/java/org/rundeck/api/RundeckClientTest.java index 24b65fd..eec122e 100644 --- a/src/test/java/org/rundeck/api/RundeckClientTest.java +++ b/src/test/java/org/rundeck/api/RundeckClientTest.java @@ -33,6 +33,7 @@ import org.rundeck.api.domain.RundeckProject; import betamax.Betamax; import betamax.Recorder; import org.rundeck.api.query.ExecutionQuery; +import org.rundeck.api.util.PagedResults; /** @@ -133,121 +134,166 @@ public class RundeckClientTest { final String projectName = "blah"; - final List jobTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults jobTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .job("test job") .build(), 2L, 0L); - Assert.assertEquals(2, jobTest.size()); - final List jobExactTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(jobTest, 2, 2, 2, 0, 2); + final PagedResults jobExactTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .jobExact("test job") .build(), 2L, 0L); - Assert.assertEquals(2, jobExactTest.size()); - final List excludeJobTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(jobExactTest, 2, 2, 2, 0, 2); + final PagedResults excludeJobTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeJob("test job") .build(), 2L, 0L); - Assert.assertEquals(2, excludeJobTest.size()); - final List excludeJobExactTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(excludeJobTest, 2, 2, 2, 0, 2); + final PagedResults excludeJobExactTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeJobExact("test job") .build(), 2L, 0L); - Assert.assertEquals(2, excludeJobExactTest.size()); - final List descriptionTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(excludeJobExactTest, 2, 2, 2, 0, 2); + final PagedResults descriptionTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .description("a description") .build(), 2L, 0L); - Assert.assertEquals(2, descriptionTest.size()); - final List abortedbyTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(descriptionTest, 2, 2, 2, 0, 2); + final PagedResults abortedbyTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .abortedby("admin") .build(), 2L, 0L); - Assert.assertEquals(1, abortedbyTest.size()); - final List beginTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(abortedbyTest, 1, 1, 2, 0, 1); + final PagedResults beginTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .begin(new Date(1347581178168L)) .build(), 2L, 0L); - Assert.assertEquals(2, beginTest.size()); - final List endTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(beginTest, 2, 2, 2, 0, 2); + final PagedResults endTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .end(new Date(1347581178168L)) .build(), 2L, 0L); - Assert.assertEquals(2, endTest.size()); + assertPageResults(endTest, 2, 2, 2, 0, 2); final List excludeJobIdList = Arrays.asList("123", "456"); - final List excludeJobIdListTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults excludeJobIdListTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeJobIdList(excludeJobIdList) .build(), 2L, 0L); - Assert.assertEquals(2, excludeJobIdListTest.size()); + assertPageResults(excludeJobIdListTest, 2, 2, 2, 0, 2); final List jobList = Arrays.asList("fruit/mango", "fruit/lemon"); - final List jobListTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults jobListTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .jobList(jobList) .build(), 2L, 0L); - Assert.assertEquals(2, jobListTest.size()); + assertPageResults(jobListTest, 2, 2, 2, 0, 2); final List excludeJobList = Arrays.asList("a/path/job1", "path/to/job2"); - final List excludeJobListTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults excludeJobListTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeJobList(excludeJobList) .build(), 2L, 0L); - Assert.assertEquals(2, excludeJobListTest.size()); + assertPageResults(excludeJobListTest, 2, 2, 2, 0, 2); final List list = Arrays.asList("1f4415d7-3b52-4fc8-ba42-b6ac97508bff", "d9fc5ee6-f1db-4d24-8808-feda18345bab"); - final List jobIdListTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults jobIdListTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .jobIdList(list) .build(), 2L, 0L); - Assert.assertEquals(2, jobIdListTest.size()); - final List groupPathTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(jobIdListTest, 2, 2, 2, 0, 2); + final PagedResults groupPathTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .groupPath("fruit") .build(), 2L, 0L); - Assert.assertEquals(2, groupPathTest.size()); - final List groupPathExactTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(groupPathTest, 2, 2, 2, 0, 2); + final PagedResults groupPathExactTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .groupPathExact("fruit") .build(), 2L, 0L); - Assert.assertEquals(2, groupPathExactTest.size()); + assertPageResults(groupPathExactTest, 2, 2, 2, 0, 2); - final List excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeGroupPath("fruit") .build(), 2L, 0L); - Assert.assertEquals(2, excludeGroupPathTest.size()); - final List excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(excludeGroupPathTest, 2, 2, 2, 0, 2); + final PagedResults excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .excludeGroupPathExact("fruit") .build(), 2L, 0L); - Assert.assertEquals(2, excliudeGroupPathExactTest.size()); + assertPageResults(excliudeGroupPathExactTest, 2, 2, 2, 0, 2); - final List recentTest = client.getExecutions(ExecutionQuery.builder() + final PagedResults recentTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .recent("1h").build(), 2L, 0L); - Assert.assertEquals(2, recentTest.size()); - final List statusTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(recentTest, 2, 2, 2, 0, 2); + final PagedResults statusTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .status(RundeckExecution.ExecutionStatus.SUCCEEDED) .build(), 2L, 0L); - Assert.assertEquals(2, statusTest.size()); - final List adhocTest = client.getExecutions(ExecutionQuery.builder() + assertPageResults(statusTest, 2, 2, 2, 0, 2); + final PagedResults adhocTest = client.getExecutions(ExecutionQuery.builder() .project(projectName) .adhoc(true) .build(), 2L, 0L); - Assert.assertEquals(2, adhocTest.size()); + assertPageResults(adhocTest, 2, 2, 2, 0, 2); + } + + /** + * Test paging values from results + */ + @Test + @Betamax(tape = "get_executions_paging") + public void getExecutionsPaging() throws Exception{ + RundeckClient client = new RundeckClient("http://rundeck.local:4440", "0UUNkeRp4d58EDeCs7S6UdODp334DvK9"); + final String projectName = "blah"; + //2 max, 1 offset + final PagedResults adhocTest = client.getExecutions(ExecutionQuery.builder() + .project(projectName) + .excludeGroupPathExact("fruit") + .build(), 2L, 1L); + //expect 2 count, 3 total + assertPageResults(adhocTest, 2, 2, 2, 1, 3); + + //FAKE results, testing paging attributes parsing + + //1 max, 1 offset + final PagedResults test2 = client.getExecutions(ExecutionQuery.builder() + .project(projectName) + .excludeGroupPathExact("fruit") + .build(), 1L, 1L); + //expect no paging attributes + assertPageResults(test2, 2, -1, -1, -1, -1); + + //1 max, 2 offset + final PagedResults test3 = client.getExecutions(ExecutionQuery.builder() + .project(projectName) + .excludeGroupPathExact("fruit") + .build(), 1L, 2L); + //invalid value for count + assertPageResults(test3, 2, -1, -1, -1, -1); + } + + private void assertPageResults(PagedResults jobTest, + final int size, + final int count, final int max, final int offset, final int total) { + Assert.assertEquals(size, jobTest.getResults().size()); + Assert.assertEquals(count, jobTest.getCount()); + Assert.assertEquals(max, jobTest.getMax()); + Assert.assertEquals(offset, jobTest.getOffset()); + Assert.assertEquals(total, jobTest.getTotal()); } @Before diff --git a/src/test/resources/betamax/tapes/get_executions.yaml b/src/test/resources/betamax/tapes/get_executions.yaml index 2e2e96e..337968b 100644 --- a/src/test/resources/betamax/tapes/get_executions.yaml +++ b/src/test/resources/betamax/tapes/get_executions.yaml @@ -17,7 +17,7 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=zjp992wmk8is;Path=/ - body: admin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a testadmin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps] + body: admin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a testadmin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps] - recorded: 2012-09-14T22:04:13.220Z request: method: GET @@ -32,7 +32,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps]admin2012-09-14T00:07:10Z2012-09-14T00:07:30Ztest job2blaha description to testecho this is a test [... 2 steps] + body: admin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps]admin2012-09-14T00:07:10Z2012-09-14T00:07:30Ztest job2blaha description to testecho this is a test [... 2 steps] - recorded: 2012-09-14T22:04:13.342Z request: method: GET @@ -47,7 +47,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.404Z request: method: GET @@ -62,7 +62,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-07T17:58:43Z2012-09-07T17:58:46Zlocal su testblahecho hi [... 2 steps]admin2012-09-07T17:56:39Z2012-09-07T17:56:40Zlocal su testblahecho hi [... 2 steps] + body: admin2012-09-07T17:58:43Z2012-09-07T17:58:46Zlocal su testblahecho hi [... 2 steps]admin2012-09-07T17:56:39Z2012-09-07T17:56:40Zlocal su testblahecho hi [... 2 steps] - recorded: 2012-09-14T22:04:13.460Z request: method: GET @@ -77,7 +77,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.525Z request: method: GET @@ -92,7 +92,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango + body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango - recorded: 2012-09-14T22:04:13.575Z request: method: GET @@ -107,7 +107,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.631Z request: method: GET @@ -122,7 +122,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango + body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango - recorded: 2012-09-14T22:04:13.682Z request: method: GET @@ -137,7 +137,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango + body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango - recorded: 2012-09-14T22:04:13.735Z request: method: GET @@ -152,7 +152,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango + body: admin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps]admin2012-09-14T17:45:46Z2012-09-14T17:45:47Zmangofruitblahecho mango mango - recorded: 2012-09-14T22:04:13.785Z request: method: GET @@ -167,7 +167,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a testadmin2012-09-13T23:44:24Z2012-09-13T23:44:25Ztest jobblahecho this is a test + body: admin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a testadmin2012-09-13T23:44:24Z2012-09-13T23:44:25Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.836Z request: method: GET @@ -182,7 +182,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.883Z request: method: GET @@ -197,7 +197,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-14T22:04:13.930Z request: method: GET @@ -212,7 +212,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-17T22:46:10.886Z request: method: GET @@ -229,7 +229,7 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=rqe6ggvlwr6p;Path=/ - body: admin2012-09-07T17:50:26Z2012-09-07T17:50:26Zecho hiadmin2012-09-07T17:50:11Z2012-09-07T17:50:11Zecho hi + body: admin2012-09-07T17:50:26Z2012-09-07T17:50:26Zecho hiadmin2012-09-07T17:50:11Z2012-09-07T17:50:11Zecho hi - recorded: 2012-09-17T23:02:35.883Z request: method: GET @@ -246,7 +246,7 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=1ciy2jy8y2agx;Path=/ - body: admin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps] + body: admin2012-09-14T00:08:05Z2012-09-14T00:08:08Zadmintest job2blaha description to testecho this is a test [... 2 steps] - recorded: 2012-09-22T00:05:27.273Z request: method: GET @@ -263,7 +263,7 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=1php90lpv6wvm;Path=/ - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps] + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps] - recorded: 2012-09-22T00:05:27.376Z request: method: GET @@ -278,7 +278,7 @@ interactions: headers: Content-Type: text/xml; charset=utf-8 Server: Jetty(6.1.21) - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps] + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T17:46:15Z2012-09-14T17:46:15Zlemonfruitblahecho lemon lemon [... 2 steps] - recorded: 2012-09-22T00:08:25.613Z request: method: GET @@ -295,7 +295,7 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=173p2d55pbnsv;Path=/ - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test - recorded: 2012-09-22T00:20:49.353Z request: method: GET @@ -312,4 +312,4 @@ interactions: Expires: Thu, 01 Jan 1970 00:00:00 GMT Server: Jetty(6.1.21) Set-Cookie: JSESSIONID=1gkaasiblkk34;Path=/ - body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test diff --git a/src/test/resources/betamax/tapes/get_executions_paging.yaml b/src/test/resources/betamax/tapes/get_executions_paging.yaml new file mode 100644 index 0000000..cdfe850 --- /dev/null +++ b/src/test/resources/betamax/tapes/get_executions_paging.yaml @@ -0,0 +1,54 @@ +!tape +name: get_executions_paging +interactions: +- recorded: 2012-09-22T00:20:49.353Z + request: + method: GET + uri: http://rundeck.local:4440/api/5/executions?project=blah&excludeGroupPathExact=fruit&max=2&offset=1 + headers: + Host: rundeck.local:4440 + Proxy-Connection: Keep-Alive + User-Agent: RunDeck API Java Client 5 + X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9 + response: + status: 200 + headers: + Content-Type: text/xml; charset=utf-8 + Expires: Thu, 01 Jan 1970 00:00:00 GMT + Server: Jetty(6.1.21) + Set-Cookie: JSESSIONID=1gkaasiblkk34;Path=/ + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test +- recorded: 2012-09-22T00:20:49.353Z + request: + method: GET + uri: http://rundeck.local:4440/api/5/executions?project=blah&excludeGroupPathExact=fruit&max=1&offset=1 + headers: + Host: rundeck.local:4440 + Proxy-Connection: Keep-Alive + User-Agent: RunDeck API Java Client 5 + X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9 + response: + status: 200 + headers: + Content-Type: text/xml; charset=utf-8 + Expires: Thu, 01 Jan 1970 00:00:00 GMT + Server: Jetty(6.1.21) + Set-Cookie: JSESSIONID=1gkaasiblkk34;Path=/ + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test +- recorded: 2012-09-22T00:20:49.353Z + request: + method: GET + uri: http://rundeck.local:4440/api/5/executions?project=blah&excludeGroupPathExact=fruit&max=1&offset=2 + headers: + Host: rundeck.local:4440 + Proxy-Connection: Keep-Alive + User-Agent: RunDeck API Java Client 5 + X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9 + response: + status: 200 + headers: + Content-Type: text/xml; charset=utf-8 + Expires: Thu, 01 Jan 1970 00:00:00 GMT + Server: Jetty(6.1.21) + Set-Cookie: JSESSIONID=1gkaasiblkk34;Path=/ + body: admin2012-09-14T22:03:54Z2012-09-14T22:03:54Zbonkers jobblahecho whyadmin2012-09-14T22:01:18Z2012-09-14T22:01:18Ztest jobblahecho this is a test \ No newline at end of file