mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-13 08:28:19 +00:00
Support history query v5 additions
This commit is contained in:
parent
4d8959a0fa
commit
c86a9a1b6e
8 changed files with 266 additions and 17 deletions
|
@ -15,11 +15,18 @@
|
|||
*/
|
||||
package org.rundeck.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import betamax.MatchRule;
|
||||
import betamax.TapeMode;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.rundeck.api.domain.RundeckEvent;
|
||||
import org.rundeck.api.domain.RundeckHistory;
|
||||
import org.rundeck.api.domain.RundeckProject;
|
||||
import betamax.Betamax;
|
||||
import betamax.Recorder;
|
||||
|
@ -44,6 +51,55 @@ public class RundeckClientTest {
|
|||
Assert.assertEquals("test", projects.get(0).getName());
|
||||
Assert.assertNull(projects.get(0).getDescription());
|
||||
}
|
||||
@Test
|
||||
@Betamax(tape = "get_history")
|
||||
public void getHistory() throws Exception {
|
||||
final RundeckHistory test = client.getHistory("test");
|
||||
Assert.assertEquals(3, test.getCount());
|
||||
Assert.assertEquals(20, test.getMax());
|
||||
Assert.assertEquals(0, test.getOffset());
|
||||
Assert.assertEquals(5, test.getTotal());
|
||||
final List<RundeckEvent> events = test.getEvents();
|
||||
Assert.assertEquals(3, events.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Betamax(tape = "get_history_joblist",
|
||||
match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */})
|
||||
public void getHistoryJoblist() throws Exception {
|
||||
final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2");
|
||||
final RundeckHistory test = client.getHistory("demo", null, null, jobNames, null, null, null, null, null);
|
||||
Assert.assertEquals(2, test.getCount());
|
||||
Assert.assertEquals(20, test.getMax());
|
||||
Assert.assertEquals(0, test.getOffset());
|
||||
Assert.assertEquals(2, test.getTotal());
|
||||
final List<RundeckEvent> events = test.getEvents();
|
||||
Assert.assertEquals(2, events.size());
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (final RundeckEvent event : events) {
|
||||
names.add(event.getTitle());
|
||||
}
|
||||
Assert.assertEquals(Arrays.asList("malk/blah2", "malk/blah"), names);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Betamax(tape = "get_history_excludeJoblist",
|
||||
match = {MatchRule.uri, MatchRule.method, MatchRule.path, MatchRule.query /*, MatchRule.body */})
|
||||
public void getHistoryExcludeJoblist() throws Exception {
|
||||
final List<String> jobNames = Arrays.asList("malk/blah", "malk/blah2");
|
||||
final RundeckHistory test = client.getHistory("demo", null, null, null, jobNames, null, null, null, null);
|
||||
Assert.assertEquals(2, test.getCount());
|
||||
Assert.assertEquals(20, test.getMax());
|
||||
Assert.assertEquals(0, test.getOffset());
|
||||
Assert.assertEquals(2, test.getTotal());
|
||||
final List<RundeckEvent> events = test.getEvents();
|
||||
Assert.assertEquals(2, events.size());
|
||||
final List<String> names = new ArrayList<String>();
|
||||
for (final RundeckEvent event : events) {
|
||||
names.add(event.getTitle());
|
||||
}
|
||||
Assert.assertEquals(Arrays.asList("fliff", "malk/blah3"), names);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue