From 877a74b8bc05b28fa6bdfed620cb1a406b1df4e1 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Wed, 19 Mar 2014 14:30:35 +0100 Subject: [PATCH] DATACMNS-471 - Added sample config files for PagedResourcesAssembler setup in XML. Related issues: Spring HATEOAS - #161. --- ...bleResourcesAssemblerIntegrationTests.java | 23 +++++++++++++++++++ .../data/web/config/manual.xml | 15 ++++++++++++ .../data/web/config/via-config-class.xml | 12 ++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/test/resources/org/springframework/data/web/config/manual.xml create mode 100644 src/test/resources/org/springframework/data/web/config/via-config-class.xml diff --git a/src/test/java/org/springframework/data/web/config/PageableResourcesAssemblerIntegrationTests.java b/src/test/java/org/springframework/data/web/config/PageableResourcesAssemblerIntegrationTests.java index 1f6083e36..28e58fe1e 100644 --- a/src/test/java/org/springframework/data/web/config/PageableResourcesAssemblerIntegrationTests.java +++ b/src/test/java/org/springframework/data/web/config/PageableResourcesAssemblerIntegrationTests.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.SpringVersion; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -79,6 +80,28 @@ public class PageableResourcesAssemblerIntegrationTests { assertThat(resources.getLink(Link.REL_SELF), is(notNullValue())); } + /** + * @see DATACMNS-471 + */ + @Test + public void setsUpPagedResourcesAssemblerFromManualXmlConfig() { + + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("manual.xml", getClass()); + assertThat(context.getBean(PagedResourcesAssembler.class), is(notNullValue())); + context.close(); + } + + /** + * @see DATACMNS-471 + */ + @Test + public void setsUpPagedResourcesAssemblerFromJavaConfigXmlConfig() { + + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("via-config-class.xml", getClass()); + assertThat(context.getBean(PagedResourcesAssembler.class), is(notNullValue())); + context.close(); + } + @Controller static class SampleController { diff --git a/src/test/resources/org/springframework/data/web/config/manual.xml b/src/test/resources/org/springframework/data/web/config/manual.xml new file mode 100644 index 000000000..32b09e546 --- /dev/null +++ b/src/test/resources/org/springframework/data/web/config/manual.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/org/springframework/data/web/config/via-config-class.xml b/src/test/resources/org/springframework/data/web/config/via-config-class.xml new file mode 100644 index 000000000..8384e7dc4 --- /dev/null +++ b/src/test/resources/org/springframework/data/web/config/via-config-class.xml @@ -0,0 +1,12 @@ + + + + + + + +