Incorporated recent changes to Spring Data Commons and dependent projects that obsoleted the need to manage domain object metadata within Spring Data REST. Required updating to the latest snapshots available for spring-data-commons and spring-data-jpa.

Additional changes include:

* Re-wrote the monolithic Controller into separate controller classes that have a more narrow focus.
* Implemented common functionality as a `HandlerMethodArgumentResolver` rather than as a helper method in a controller class.
* Re-implemented JSONP functionality as an HttpMessageConverter rather than inline within a controller class.
* Updated to Jackson 2 for all JSON handling.
* By relying on spring-data-commons, spring-data-rest now handles all supported Repository types: JPA, MongoDB, and GemFire.

Added support for MongoDB and GemFire repositories by relying on spring-data-commons to provide the metadata rather than maintaining internal metadata information that is store-specific.

Replaced Spock spec tests with JMock unit and integration tests. Started integrating Jetty 8 into the testing so MVC testing can be done against a live server.
This commit is contained in:
Jon Brisbin
2013-01-04 11:13:04 -06:00
parent 269d6f5983
commit 6e4e7da142
242 changed files with 8466 additions and 9335 deletions

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="jpa.sample">
<class>org.springframework.data.rest.test.webmvc.Address</class>
<class>org.springframework.data.rest.test.webmvc.Child</class>
<class>org.springframework.data.rest.test.webmvc.Customer</class>
<class>org.springframework.data.rest.test.webmvc.CustomerTracker</class>
<class>org.springframework.data.rest.test.webmvc.Family</class>
<class>org.springframework.data.rest.test.webmvc.Person</class>
<class>org.springframework.data.rest.test.webmvc.Profile</class>
<class>org.springframework.data.rest.test.webmvc.UuidTest</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:spring"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="baseUri" class="java.net.URI">
<constructor-arg value="http://localhost:8080/data"/>
</bean>
<bean id="config" class="org.springframework.data.rest.webmvc.RepositoryRestConfiguration"
p:jsonpParamName="callback"
p:jsonpOnErrParamName="errback"
p:baseUri-ref="baseUri">
<property name="domainTypeToRepositoryMappings">
<map key-type="java.lang.Class" value-type="java.lang.Class">
<entry key="org.springframework.data.rest.test.webmvc.Person"
value="org.springframework.data.rest.test.webmvc.PersonRepository"/>
</map>
</property>
</bean>
<!--
If you need to add Converters to the REST exporter to handle the property types you're using
in your entities, then just configure a ConversionServiceFactoryBean here, add the Converters
you need, and they will, in turn, be added to the FormattingConversionService the REST exporter
uses internally.
Uncomment this block to add the included UUID <-> String converters, which are not included by default.
-->
<bean class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="org.springframework.data.rest.core.convert.StringToUUIDConverter"/>
<bean class="org.springframework.data.rest.core.convert.UUIDToStringConverter"/>
</set>
</property>
</bean>
<!--
The manual configuration (which doesn't look at the bean name) can be done by declaring the
event listener instance yourself. It's significantly more XML, but if you need more control:
-->
<!--
<bean class="org.springframework.data.rest.repository.context.ValidatingRepositoryEventListener">
<property name="validators">
<map>
<entry key="beforeSave">
<list>
<bean class="org.springframework.data.rest.test.webmvc.PersonValidator"/>
</list>
</entry>
</map>
</property>
</bean>
-->
</beans>

View File

@@ -1,15 +0,0 @@
#!/bin/sh
curl -v -d '{"surname" : "Doe"}' -H "Content-Type: application/json" http://localhost:8080/family
curl -v -d '{"name" : "John Doe"}' -H "Content-Type: application/json" http://localhost:8080/people
curl -v -d '{"name" : "Jane Doe"}' -H "Content-Type: application/json" http://localhost:8080/people
curl -v -d 'http://localhost:8080/people/1
http://localhost:8080/people/2' -H "Content-Type: text/uri-list" http://localhost:8080/family/1/members
curl -v -d '{"postalCode":"12345","province":"MO","lines":["1 W 1st St."],"city":"Univille","person": {"href":"http://localhost:8080/people/1"}}' -H "Content-Type: application/json" http://localhost:8080/address
curl -v -d "http://localhost:8080/address/1" -H "Content-Type: text/uri-list" http://localhost:8080/people/1/addresses
curl -v -d "http://localhost:8080/people/1" -X PUT -H "Content-Type: text/uri-list" http://localhost:8080/address/1/person
curl -v -d '{"postalCode":"54321","province":"MO","lines":["2 W 1st St."],"city":"Univille","person": {"href":"http://localhost:8080/people/2"}}' -H "Content-Type: application/json" http://localhost:8080/address
curl -v -d "http://localhost:8080/address/2" -H "Content-Type: text/uri-list" http://localhost:8080/people/2/addresses
curl -v -d '{"type" : "twitter", "url": "#!/johndoe", "person": {"href": "http://localhost:8080/people/1"}}' -H "Content-Type: application/json" http://localhost:8080/profile
#curl -v -d "http://localhost:8080/profile/1" -H "Content-Type: text/uri-list" http://localhost:8080/people/1/profiles
curl -v -d '{"type" : "facebook", "url": "/janedoe", "person": {"href": "http://localhost:8080/people/2"}}' -H "Content-Type: application/json" http://localhost:8080/profile
#curl -v -d '{"links": [{"rel":"facebook", "href": "http://localhost:8080/profile/2"}]}' -H "Content-Type: application/json" http://localhost:8080/people/2/profiles

View File

@@ -1,8 +0,0 @@
require "json"
require "net/http"
client = Net::HTTP.new("localhost", 8080)
File.open("names.txt").each_line do |name|
client.post("/people", JSON.dump({"name" => name.chomp}), {"Content-Type"=>"application/json"})
end

View File

@@ -1,19 +0,0 @@
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<logger name="org.springframework.data.rest.auditlog" level="INFO"/>
<logger name="org.springframework.data.rest" level="DEBUG"/>
<logger name="org.springframework.data" level="INFO"/>
<root level="INFO">
<appender-ref ref="stdout"/>
</root>
</configuration>

View File

@@ -1,100 +0,0 @@
Adalberto Raymos
Adrien Maytubby
Alonzo Schroyer
Alva Sauvageau
Amalia Velie
Amber Pay
Annabell Zozaya
Antone Ryan
Antonia Maslanka
Art Esperanza
Ashlee Mittan
Audrie Smid
Augustine Crosswell
Benny Graden
Billye Bornmann
Blythe Milby
Bret Pistole
Briana Angry
Bruno Feeley
Carol Cruikshank
Chanell Neidlinger
Cher Griswould
Cheri Batson
Claud Bardon
Crysta Kooker
Cyrus Balius
Daniel Vangieson
Daron Gardocki
Delana Rowley
Devon Osei
Diego Schaefer
Dionna Chavers
Doretha Folden
Edna Codner
Elfreda Capron
Eli Ekhoff
Elijah Canard
Emile Steenburg
Erline Santiago
Ervin Kennemore
Ezekiel Clinkenbeard
Felisa Burmeister
Fleta Mckiney
Frankie Mires
Gaston Spille
Gerardo Mandiola
Gilda Wilbers
Guadalupe Boutiette
Hannah Perloff
Jeanna Rundstrom
Kandis Netherland
Keneth Sigg
Kenton Layssard
Kimberlee Turlington
Kimiko Corlew
Latricia Fickas
Leanna Wedel
Lindsey Mccalister
Lucas Trischitta
Marhta Genther
Mathew Garramone
Maxie Coke
Micheal Veronesi
Miguel Eveland
Ona Hardrick
Orville Mccarson
Raguel Moscowitz
Rana Bussmann
Rashad Deuser
Renata Labate
Reva Larger
Rey Durtschi
Rosalina Merthie
Rusty Biafore
Samual Moree
Samual Plattsmier
Scot Cheely
Seymour Kohls
Shaniqua Khan
Shanon Kueny
Sharmaine Musel
Shelby Prator
Sheldon Loiselle
Shenita Broxterman
Silas Scarth
Sol Stockfisch
Sonia Otsuka
Stephine Daum
Stewart Lenzo
Theron Carmell
Titus Streck
Tomi Minasian
Tyrone Hopton
Usha Horsely
Val Hoffmeyer
Vicente Perko
Virgil Cousin
Walton Svoboda
Winford Hagwood
Yoshiko Dekany