From 1f589b40fdcb89c6e5f7839afdce096aef3fee4a Mon Sep 17 00:00:00 2001 From: Jon Brisbin Date: Tue, 1 May 2012 10:45:43 -0500 Subject: [PATCH] Tweaking build. --- .../repository/spec/JpaMetadataSpec.groovy | 18 ++++++++---------- .../test/resources/JpaMetadataSpec-test.xml | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/spring-data-rest-repository/src/test/groovy/org/springframework/data/rest/repository/spec/JpaMetadataSpec.groovy b/spring-data-rest-repository/src/test/groovy/org/springframework/data/rest/repository/spec/JpaMetadataSpec.groovy index 827ce1de6..d73113c60 100644 --- a/spring-data-rest-repository/src/test/groovy/org/springframework/data/rest/repository/spec/JpaMetadataSpec.groovy +++ b/spring-data-rest-repository/src/test/groovy/org/springframework/data/rest/repository/spec/JpaMetadataSpec.groovy @@ -4,7 +4,7 @@ import javax.persistence.EntityManager import javax.persistence.PersistenceContext import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.ApplicationContext -import org.springframework.data.repository.CrudRepository + import org.springframework.data.rest.repository.RepositoryExporter import org.springframework.data.rest.repository.RepositoryMetadata import org.springframework.data.rest.repository.test.Family @@ -25,25 +25,23 @@ class JpaMetadataSpec extends Specification { @PersistenceContext EntityManager entityManager @Autowired - Collection repositories - @Autowired List exporters - RepositoryMetadata repositoryMetadataFor(name) { + RepositoryMetadata metadata(name) { exporters.find { null != it.repositoryMetadataFor(name) }?.repositoryMetadataFor(name) } def "finds repositories in ApplicationContext"() { when: "find repo by String identifier" - def repo = repositoryMetadataFor("person")?.repository() + def repo = metadata("person")?.repository() then: null != repo repo instanceof PersonRepository when: "find repo by domain Class" - repo = repositoryMetadataFor(Family)?.repository() + repo = metadata(Family)?.repository() then: null != repo @@ -54,8 +52,8 @@ class JpaMetadataSpec extends Specification { def "provides entity metadata"() { given: - def personRepo = repositoryMetadataFor(Person)?.repository() - def familyRepo = repositoryMetadataFor(Family)?.repository() + def personRepo = metadata(Person)?.repository() + def familyRepo = metadata(Family)?.repository() def johnDoe = personRepo?.save(new Person("John Doe")) def janeDoe = personRepo?.save(new Person("Jane Doe")) def doeFamily = familyRepo?.save(new Family( @@ -64,8 +62,8 @@ class JpaMetadataSpec extends Specification { )) when: - def personMeta = repositoryMetadataFor(Person)?.entityMetadata() - def familyMeta = repositoryMetadataFor(Family)?.entityMetadata() + def personMeta = metadata(Person)?.entityMetadata() + def familyMeta = metadata(Family)?.entityMetadata() then: personMeta?.attribute("name")?.get(johnDoe) == "John Doe" diff --git a/spring-data-rest-repository/src/test/resources/JpaMetadataSpec-test.xml b/spring-data-rest-repository/src/test/resources/JpaMetadataSpec-test.xml index dea85fab1..3fd6c23d4 100644 --- a/spring-data-rest-repository/src/test/resources/JpaMetadataSpec-test.xml +++ b/spring-data-rest-repository/src/test/resources/JpaMetadataSpec-test.xml @@ -26,8 +26,8 @@ - - + + \ No newline at end of file