Permalink
Browse files

Merge branch 'release/1.0.1'

* release/1.0.1: (66 commits)
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release halbuilder-1.0.1
  Added release plugin config for local checkout.
  Added description.
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release halbuilder-1.0.1
  Added Javadoc, moved Renderer to SPI
  Added Serializable after Richards suggestion.
  Updated TestNG
  Removed http client from builder, to move to halclient.
  Added single rel lookup
  Updated clojure it
  Renamed factory methods
  Updated
  Updated
  Updated readme
  Added initial http client support
  Only wrap reader with BufferedReader when markSupported is false.
  Test data fix
  Fix JSON Rendering with multiple sub resources
  ...
  • Loading branch information...
2 parents 600d33c + b35081c commit 70a836e366f41a6ce8bba8a8e29fd5531502338a @talios talios committed Feb 18, 2012
Showing with 2,589 additions and 296 deletions.
  1. +4 −0 .gitignore
  2. +29 −0 README.md
  3. +62 −4 pom.xml
  4. +2 −0 src/it/clojure-hal/goals.txt
  5. +41 −0 src/it/clojure-hal/pom.xml
  6. +9 −0 src/it/clojure-hal/src/test/clojure/haltest.clj
  7. +7 −0 src/it/clojure-hal/verify.bsh
  8. +35 −0 src/it/settings.xml
  9. +0 −189 src/main/java/com/theoryinpractise/halbuilder/HalResource.java
  10. +0 −7 src/main/java/com/theoryinpractise/halbuilder/HalResourceException.java
  11. +125 −0 src/main/java/com/theoryinpractise/halbuilder/ResourceFactory.java
  12. +61 −0 src/main/java/com/theoryinpractise/halbuilder/impl/ContentType.java
  13. +10 −0 src/main/java/com/theoryinpractise/halbuilder/impl/api/ResourceReader.java
  14. +22 −0 src/main/java/com/theoryinpractise/halbuilder/impl/api/Support.java
  15. +40 −0 src/main/java/com/theoryinpractise/halbuilder/impl/bytecode/InterfaceContract.java
  16. +55 −0 src/main/java/com/theoryinpractise/halbuilder/impl/bytecode/InterfaceRenderer.java
  17. +13 −0 src/main/java/com/theoryinpractise/halbuilder/impl/bytecode/InterfaceSupport.java
  18. +150 −0 src/main/java/com/theoryinpractise/halbuilder/impl/json/JsonRenderer.java
  19. +125 −0 src/main/java/com/theoryinpractise/halbuilder/impl/json/JsonResourceReader.java
  20. +226 −0 src/main/java/com/theoryinpractise/halbuilder/impl/resources/BaseResource.java
  21. +61 −0 src/main/java/com/theoryinpractise/halbuilder/impl/resources/ImmutableResource.java
  22. +24 −0 src/main/java/com/theoryinpractise/halbuilder/impl/resources/LinkPredicate.java
  23. +159 −0 src/main/java/com/theoryinpractise/halbuilder/impl/resources/MutableResource.java
  24. +101 −0 src/main/java/com/theoryinpractise/halbuilder/impl/xml/XmlRenderer.java
  25. +84 −0 src/main/java/com/theoryinpractise/halbuilder/impl/xml/XmlResourceReader.java
  26. +19 −0 src/main/java/com/theoryinpractise/halbuilder/spi/Contract.java
  27. +70 −0 src/main/java/com/theoryinpractise/halbuilder/spi/Link.java
  28. +104 −0 src/main/java/com/theoryinpractise/halbuilder/spi/ReadableResource.java
  29. +28 −0 src/main/java/com/theoryinpractise/halbuilder/spi/RenderableResource.java
  30. +21 −0 src/main/java/com/theoryinpractise/halbuilder/spi/Renderer.java
  31. +30 −0 src/main/java/com/theoryinpractise/halbuilder/spi/Resource.java
  32. +11 −0 src/main/java/com/theoryinpractise/halbuilder/spi/ResourceException.java
  33. +15 −0 src/main/java/com/theoryinpractise/halbuilder/spi/Serializable.java
  34. +103 −0 src/test/java/com/theoryinpractise/halbuilder/CollatedLinksTest.java
  35. +58 −0 src/test/java/com/theoryinpractise/halbuilder/CurrieOptimizationTest.java
  36. +0 −65 src/test/java/com/theoryinpractise/halbuilder/HalResourceTest.java
  37. +116 −0 src/test/java/com/theoryinpractise/halbuilder/InterfaceSatisfactionTest.java
  38. +252 −0 src/test/java/com/theoryinpractise/halbuilder/RenderingTest.java
  39. +62 −0 src/test/java/com/theoryinpractise/halbuilder/ResourceReaderTest.java
  40. +88 −0 src/test/java/com/theoryinpractise/halbuilder/ResourceTest.java
  41. +25 −0 src/test/java/com/theoryinpractise/halbuilder/impl/ContentTypeTest.java
  42. +25 −0 src/test/resources/com/theoryinpractise/halbuilder/example.json
  43. +9 −0 src/test/resources/com/theoryinpractise/halbuilder/example.xml
  44. +45 −0 src/test/resources/com/theoryinpractise/halbuilder/exampleWithMultipleSubresources.json
  45. +18 −0 src/test/resources/com/theoryinpractise/halbuilder/exampleWithMultipleSubresources.xml
  46. +34 −0 src/test/resources/com/theoryinpractise/halbuilder/exampleWithSubresource.json
  47. +11 −0 src/test/resources/com/theoryinpractise/halbuilder/exampleWithSubresource.xml
  48. +0 −31 src/test/resources/example.xml
View
@@ -1 +1,5 @@
target
+.idea
+*.iml
+*.ipr
+*.iws
View
@@ -0,0 +1,29 @@
+Halbuilder is a simple Java API for generating and consuming HAL documents conforming to the
+[HAL Specification](http://stateless.co/hal_specification.html).
+
+### Generating Local Resources
+
+ ResourceFactory resourceFactory = new ResourceFactory();
+
+ Resource owner = resourceFactory.newResource("http://example.com/mike")
+ .withLink("td:friend", "http://example.com/mamund")
+ .withProperty("name", "Mike")
+ .withProperty("age", "36");
+
+ Resource halResource = resourceFactory.newResource("http://example.com/todo-list")
+ .withNamespace("td", "http://example.com/todoapp/rels/")
+ .withLink("td:search", "/todo-list/search;{searchterm}")
+ .withLink("td:description", "/todo-list/description")
+ .withProperty("created_at", "2010-01-16")
+ .withProperty("updated_at", "2010-02-21")
+ .withProperty("summary", "An example list")
+ .withSubresource("td:owner", owner);
+
+ String xml = halResource.renderContent(ResourceFactory.HALXML);
+ String json = halResource.renderContent(ResourceFactory.HALJSON);
+
+### Reading Local Resources
+
+ ResourceFactory resourceFactory = new ResourceFactory();
+
+ Resource resource = resourceFactory.newResource(new InputStreamReader(Some.class.getResourceAsStream("/test.xml")));
View
66 pom.xml
@@ -1,10 +1,10 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.theoryinpractise</groupId>
<artifactId>halbuilder</artifactId>
- <version>1.0.1-SNAPSHOT</version>
+ <version>1.0.2-SNAPSHOT</version>
+ <description>Java based builder for the Hal specification http://stateless.co/hal_specification.html</description>
<packaging>jar</packaging>
<name>halbuilder</name>
@@ -76,12 +76,65 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.2.2</version>
+ <configuration>
+ <preparationGoals>clean install</preparationGoals>
+ <goals>deploy</goals>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+ <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <postBuildHookScript>verify.bsh</postBuildHookScript>
+ <debug>true</debug>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert</artifactId>
+ <version>1.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>6.2.1</version>
+ <version>6.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>11.0.1</version>
</dependency>
+
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
@@ -92,5 +145,10 @@
<artifactId>jackson-core-asl</artifactId>
<version>1.9.0</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.0</version>
+ </dependency>
</dependencies>
</project>
@@ -0,0 +1,2 @@
+clean install
+
View
@@ -0,0 +1,41 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.theoryinpractise.it</groupId>
+ <artifactId>clojure-hal</artifactId>
+ <version>testing</version>
+ <packaging>clojure</packaging>
+
+ <name>clojure-hal</name>
+ <url>http://maven.apache.org</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ <version>1.3.8</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>halbuilder</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+</project>
@@ -0,0 +1,9 @@
+(ns haltest
+ (:use [clojure.test]))
+
+(deftest haltest
+ (let [resource-factory (com.theoryinpractise.halbuilder.ResourceFactory.)
+ resource (doto (.newResource resource-factory "/foo")
+ (.withProperty "name" "Mark")
+ (.withLink "/home" "home"))]
+ (println (.renderContent (.asRenderableResource resource) "application/hal+xml"))) )
@@ -0,0 +1,7 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+File file = new File( basedir, "target/clojure-hal-testing.jar" );
+if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+}
View
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
Oops, something went wrong.

0 comments on commit 70a836e

Please sign in to comment.