- *
+ *
* // using login-based authentication :
* RundeckClient rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
* // or for a token-based authentication :
diff --git a/src/site/confluence/groovy.confluence b/src/site/confluence/groovy.confluence
index 7cda443..6dc06e5 100644
--- a/src/site/confluence/groovy.confluence
+++ b/src/site/confluence/groovy.confluence
@@ -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...
diff --git a/src/site/confluence/index.confluence b/src/site/confluence/index.confluence
index 702dc90..5e3eda1 100644
--- a/src/site/confluence/index.confluence
+++ b/src/site/confluence/index.confluence
@@ -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].
diff --git a/src/site/confluence/jruby.confluence b/src/site/confluence/jruby.confluence
index 99f1cf4..cedb4ae 100644
--- a/src/site/confluence/jruby.confluence
+++ b/src/site/confluence/jruby.confluence
@@ -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...
diff --git a/src/site/confluence/jython.confluence b/src/site/confluence/jython.confluence
index ebafcce..b2dbc94 100644
--- a/src/site/confluence/jython.confluence
+++ b/src/site/confluence/jython.confluence
@@ -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...
diff --git a/src/site/site.xml b/src/site/site.xml
index 1526382..83bea9e 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -21,6 +21,11 @@
UA-23435653-1
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.0
+
diff --git a/src/test/java/org/rundeck/api/RundeckClientTest.java b/src/test/java/org/rundeck/api/RundeckClientTest.java
new file mode 100644
index 0000000..19081ba
--- /dev/null
+++ b/src/test/java/org/rundeck/api/RundeckClientTest.java
@@ -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 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");
+ }
+
+}
diff --git a/src/test/resources/betamax.properties b/src/test/resources/betamax.properties
new file mode 100644
index 0000000..e212574
--- /dev/null
+++ b/src/test/resources/betamax.properties
@@ -0,0 +1,4 @@
+betamax.tapeRoot=src/test/resources/betamax/tapes
+betamax.proxyPort=1337
+betamax.proxyTimeout=5000
+betamax.defaultMode=READ_ONLY
\ No newline at end of file
diff --git a/src/test/resources/betamax/tapes/get_projects.yaml b/src/test/resources/betamax/tapes/get_projects.yaml
new file mode 100644
index 0000000..e07efd6
--- /dev/null
+++ b/src/test/resources/betamax/tapes/get_projects.yaml
@@ -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: test