diff --git a/pom.xml b/pom.xml index aadc26a..decf4cf 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ org.rundeck rundeck-api-java-client - 2.0-SNAPSHOT + 2.1-SNAPSHOT jar RunDeck API - Java Client Java client for the RunDeck REST API @@ -81,31 +81,30 @@ UTF-8 - 1.6 - 2.2.1 + 1.7 + 2.2.2 2.6 - 2.6 + 2.8 2.4.1 2.3.2 2.3 - 2.6 + 2.7 2.8 1.0.1 2.3.2 - 1.3 + 1.4 2.1.1 2.3.1 - 2.3.1 + 2.3.2 2.8 2.3 - 2.5 + 2.6 2.4 - 2.2 + 2.2.1 2.5 - - 2.3 + 3.0 2.1.2 - 2.9 + 2.10 2.4 1.2 @@ -308,9 +307,26 @@ maven-javadoc-plugin ${plugin.javadoc.version} - - http://download.oracle.com/javase/6/docs/api/ - + + com.google.doclava + doclava + 1.0.3 + + com.google.doclava.Doclava + + ${sun.boot.class.path} + + -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 + + false + + -J-Xmx1024m @@ -399,12 +415,12 @@ org.apache.httpcomponents httpclient - 4.1.1 + 4.1.2 org.apache.httpcomponents httpmime - 4.1.1 + 4.1.2 @@ -415,7 +431,7 @@ commons-io commons-io - 2.0.1 + 2.1 @@ -432,42 +448,22 @@ junit junit - 4.8.2 + 4.10 + test + + + com.github.robfletcher + betamax + 1.0 + test + + + org.codehaus.groovy + groovy-all + 1.8.4 test - - - - maven-3 - - - - ${basedir} - - - - 3.0-beta-3 - - - - - org.apache.maven.plugins - maven-site-plugin - - - attach-descriptor - - attach-descriptor - - - - - - - - - diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1336d15..f70e1aa 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -22,7 +22,7 @@ Vincent Behar - + Token-based authentication diff --git a/src/main/java/org/rundeck/api/RundeckClient.java b/src/main/java/org/rundeck/api/RundeckClient.java index 82f8f77..8f7d3ef 100644 --- a/src/main/java/org/rundeck/api/RundeckClient.java +++ b/src/main/java/org/rundeck/api/RundeckClient.java @@ -68,7 +68,7 @@ import org.rundeck.api.util.ParametersUtil; *
* Usage :
* - *
+ * 
  * // 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