mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-06 13:08:38 +00:00
Merge branch 'master' into new-style
This commit is contained in:
commit
ca48a23f4b
11 changed files with 138 additions and 58 deletions
98
pom.xml
98
pom.xml
|
@ -27,7 +27,7 @@
|
|||
<!-- Project informations -->
|
||||
<groupId>org.rundeck</groupId>
|
||||
<artifactId>rundeck-api-java-client</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>RunDeck API - Java Client</name>
|
||||
<description>Java client for the RunDeck REST API</description>
|
||||
|
@ -81,31 +81,30 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<!-- Plugins version -->
|
||||
<plugin.antrun.version>1.6</plugin.antrun.version>
|
||||
<plugin.assembly.version>2.2.1</plugin.assembly.version>
|
||||
<plugin.antrun.version>1.7</plugin.antrun.version>
|
||||
<plugin.assembly.version>2.2.2</plugin.assembly.version>
|
||||
<plugin.changes.version>2.6</plugin.changes.version>
|
||||
<plugin.checkstyle.version>2.6</plugin.checkstyle.version>
|
||||
<plugin.checkstyle.version>2.8</plugin.checkstyle.version>
|
||||
<plugin.clean.version>2.4.1</plugin.clean.version>
|
||||
<plugin.compiler.version>2.3.2</plugin.compiler.version>
|
||||
<plugin.dependency.version>2.3</plugin.dependency.version>
|
||||
<plugin.deploy.version>2.6</plugin.deploy.version>
|
||||
<plugin.deploy.version>2.7</plugin.deploy.version>
|
||||
<plugin.eclipse.version>2.8</plugin.eclipse.version>
|
||||
<plugin.enforcer.version>1.0.1</plugin.enforcer.version>
|
||||
<plugin.findbugs.version>2.3.2</plugin.findbugs.version>
|
||||
<plugin.gpg.version>1.3</plugin.gpg.version>
|
||||
<plugin.gpg.version>1.4</plugin.gpg.version>
|
||||
<plugin.help.version>2.1.1</plugin.help.version>
|
||||
<plugin.install.version>2.3.1</plugin.install.version>
|
||||
<plugin.jar.version>2.3.1</plugin.jar.version>
|
||||
<plugin.jar.version>2.3.2</plugin.jar.version>
|
||||
<plugin.javadoc.version>2.8</plugin.javadoc.version>
|
||||
<plugin.jxr.version>2.3</plugin.jxr.version>
|
||||
<plugin.pmd.version>2.5</plugin.pmd.version>
|
||||
<plugin.pmd.version>2.6</plugin.pmd.version>
|
||||
<plugin.project-info-reports.version>2.4</plugin.project-info-reports.version>
|
||||
<plugin.release.version>2.2</plugin.release.version>
|
||||
<plugin.release.version>2.2.1</plugin.release.version>
|
||||
<plugin.resources.version>2.5</plugin.resources.version>
|
||||
<!-- site 2.3 for maven 2.x and site 3.0-x for maven 3.x -->
|
||||
<plugin.site.version>2.3</plugin.site.version>
|
||||
<plugin.site.version>3.0</plugin.site.version>
|
||||
<plugin.source.version>2.1.2</plugin.source.version>
|
||||
<plugin.surefire.version>2.9</plugin.surefire.version>
|
||||
<plugin.surefire.version>2.10</plugin.surefire.version>
|
||||
<plugin.taglist.version>2.4</plugin.taglist.version>
|
||||
<plugin.versions.version>1.2</plugin.versions.version>
|
||||
</properties>
|
||||
|
@ -308,9 +307,26 @@
|
|||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${plugin.javadoc.version}</version>
|
||||
<configuration>
|
||||
<links>
|
||||
<link>http://download.oracle.com/javase/6/docs/api/</link>
|
||||
</links>
|
||||
<docletArtifact>
|
||||
<groupId>com.google.doclava</groupId>
|
||||
<artifactId>doclava</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</docletArtifact>
|
||||
<doclet>com.google.doclava.Doclava</doclet>
|
||||
<!-- bootclasspath required by Sun's JVM -->
|
||||
<bootclasspath>${sun.boot.class.path}</bootclasspath>
|
||||
<additionalparam>
|
||||
-quiet
|
||||
-federate JDK http://download.oracle.com/javase/6/docs/api/index.html?
|
||||
-federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml
|
||||
-hdf project.name "${project.name}"
|
||||
-d .
|
||||
-hide 101
|
||||
-proofread ./proof-read.txt
|
||||
</additionalparam>
|
||||
<useStandardDocletOptions>false</useStandardDocletOptions>
|
||||
<!-- Apple's JVM sometimes requires more memory -->
|
||||
<additionalJOption>-J-Xmx1024m</additionalJOption>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -399,12 +415,12 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<!-- Commons -->
|
||||
<dependency>
|
||||
|
@ -415,7 +431,7 @@
|
|||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<!-- XML Parsing -->
|
||||
<dependency>
|
||||
|
@ -432,42 +448,22 @@
|
|||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.robfletcher</groupId>
|
||||
<artifactId>betamax</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>1.8.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- maven 3 specific configuration -->
|
||||
<id>maven-3</id>
|
||||
<activation>
|
||||
<file>
|
||||
<!-- This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
|
||||
<exists>${basedir}</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<properties>
|
||||
<plugin.site.version>3.0-beta-3</plugin.site.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-descriptor</id>
|
||||
<goals>
|
||||
<goal>attach-descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<author>Vincent Behar</author>
|
||||
</properties>
|
||||
<body>
|
||||
<release version="2.0" date="Not Yet Released" description="Use RunDeck REST API version 2 (RunDeck 1.3+)">
|
||||
<release version="2.0" date="2011-08-01" description="Use RunDeck REST API version 2 (RunDeck 1.3+)">
|
||||
<action dev="vbehar" type="add">Token-based authentication</action>
|
||||
</release>
|
||||
<release version="1.2" date="2011-07-31" description="Ad-hoc scripts + history events">
|
||||
|
|
|
@ -68,7 +68,7 @@ import org.rundeck.api.util.ParametersUtil;
|
|||
* <br>
|
||||
* Usage : <br>
|
||||
* <code>
|
||||
* <pre>
|
||||
* <pre class="prettyprint">
|
||||
* // using login-based authentication :
|
||||
* RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
|
||||
* // or for a token-based authentication :
|
||||
|
|
|
@ -11,7 +11,7 @@ Save the following script in a file named "{{rundeck.groovy}}", and execute it w
|
|||
|
||||
{code}
|
||||
// we use Grape (Ivy) to download the lib (and its dependencies) from Maven Central Repository
|
||||
@Grab(group='org.rundeck', module='rundeck-api-java-client', version='1.2')
|
||||
@Grab(group='org.rundeck', module='rundeck-api-java-client', version='2.0')
|
||||
import org.rundeck.api.RundeckClient
|
||||
|
||||
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
|
||||
|
@ -124,5 +124,5 @@ println "${result.succeededJobs.size} jobs successfully imported, ${result.skipp
|
|||
|
||||
h2. And more...
|
||||
|
||||
See the API documentation of the [RundeckClient|./apidocs/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ h2. What can I do with it ?
|
|||
|
||||
h2. Where can I get more information ?
|
||||
|
||||
* You can read the [API documentation|./apidocs/index.html], starting with the [RundeckClient|./apidocs/org/rundeck/api/RundeckClient.html] class.
|
||||
* You can read the [API documentation|./apidocs/index.html], starting with the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class.
|
||||
* Or you can "Use the [Source|./source-repository.html], Luke !"
|
||||
* Read more on the Maven auto-generated pages : [project information|./project-info.html] and [project reports|./project-reports.html].
|
||||
|
||||
|
|
|
@ -132,5 +132,5 @@ puts "#{result.succeededJobs.size} jobs successfully imported, #{result.skippedJ
|
|||
|
||||
h2. And more...
|
||||
|
||||
See the API documentation of the [RundeckClient|./apidocs/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
|
||||
|
|
|
@ -116,5 +116,5 @@ print("%s jobs successfully imported, %s jobs skipped, and %s jobs failed" % (re
|
|||
|
||||
h2. And more...
|
||||
|
||||
See the API documentation of the [RundeckClient|./apidocs/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
<googleAnalyticsAccountId>UA-23435653-1</googleAnalyticsAccountId>
|
||||
<publishDate position="right" />
|
||||
<version position="right" />
|
||||
<skin>
|
||||
<groupId>org.apache.maven.skins</groupId>
|
||||
<artifactId>maven-fluido-skin</artifactId>
|
||||
<version>1.0</version>
|
||||
</skin>
|
||||
<body>
|
||||
<breadcrumbs>
|
||||
<item name="RunDeck" href="http://rundeck.org" />
|
||||
|
|
55
src/test/java/org/rundeck/api/RundeckClientTest.java
Normal file
55
src/test/java/org/rundeck/api/RundeckClientTest.java
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright 2011 Vincent Behar
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package org.rundeck.api;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.rundeck.api.domain.RundeckProject;
|
||||
import betamax.Betamax;
|
||||
import betamax.Recorder;
|
||||
|
||||
/**
|
||||
* Test the {@link RundeckClient}. Uses betamax to unit-test HTTP requests without a live RunDeck instance.
|
||||
*
|
||||
* @author Vincent Behar
|
||||
*/
|
||||
public class RundeckClientTest {
|
||||
|
||||
@Rule
|
||||
public Recorder recorder = new Recorder();
|
||||
|
||||
private RundeckClient client;
|
||||
|
||||
@Test
|
||||
@Betamax(tape = "get_projects")
|
||||
public void getProjects() throws Exception {
|
||||
List<RundeckProject> projects = client.getProjects();
|
||||
Assert.assertEquals(1, projects.size());
|
||||
Assert.assertEquals("test", projects.get(0).getName());
|
||||
Assert.assertNull(projects.get(0).getDescription());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// not that you can put whatever here, because we don't actually connect to the RunDeck instance
|
||||
// but instead use betamax as a proxy to serve the previously recorded tapes (in src/test/resources)
|
||||
client = new RundeckClient("http://rundeck.local:4440", "PVnN5K3OPc5vduS3uVuVnEsD57pDC5pd");
|
||||
}
|
||||
|
||||
}
|
4
src/test/resources/betamax.properties
Normal file
4
src/test/resources/betamax.properties
Normal file
|
@ -0,0 +1,4 @@
|
|||
betamax.tapeRoot=src/test/resources/betamax/tapes
|
||||
betamax.proxyPort=1337
|
||||
betamax.proxyTimeout=5000
|
||||
betamax.defaultMode=READ_ONLY
|
20
src/test/resources/betamax/tapes/get_projects.yaml
Normal file
20
src/test/resources/betamax/tapes/get_projects.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
!tape
|
||||
name: get_projects
|
||||
interactions:
|
||||
- recorded: 2011-09-18T16:04:45.973Z
|
||||
request:
|
||||
method: GET
|
||||
uri: http://rundeck.local:4440/api/2/projects
|
||||
headers:
|
||||
Host: rundeck.local:4440
|
||||
Proxy-Connection: Keep-Alive
|
||||
User-Agent: RunDeck API Java Client 2
|
||||
X-RunDeck-Auth-Token: PVnN5K3OPc5vduS3uVuVnEsD57pDC5pd
|
||||
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=mxrbh6byhvxt;Path=/
|
||||
body: <result success='true' apiversion='2'><projects count='1'><project><name>test</name><description></description></project></projects></result>
|
Loading…
Add table
Add a link
Reference in a new issue