From 2861ad41064aa6126922847e9e7b82f9d1ec1f1a Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Sat, 18 May 2013 16:52:17 +0100 Subject: [PATCH] [bs-122] Support for Spring Data DomainClassConverter [#49906951] --- pom.xml | 5 ++ spring-bootstrap/pom.xml | 5 ++ .../data/JpaWebAutoConfigurationTests.java | 63 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java diff --git a/pom.xml b/pom.xml index cbefe79171f..2dad9db13dc 100644 --- a/pom.xml +++ b/pom.xml @@ -563,6 +563,11 @@ + + org.springframework.hateoas + spring-hateoas + 0.5.0.RELEASE + org.aspectj aspectjrt diff --git a/spring-bootstrap/pom.xml b/spring-bootstrap/pom.xml index ba034f9f134..94b45b3691f 100644 --- a/spring-bootstrap/pom.xml +++ b/spring-bootstrap/pom.xml @@ -94,6 +94,11 @@ spring-data-jpa true + + org.springframework.hateoas + spring-hateoas + true + org.springframework.batch spring-batch-core diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java new file mode 100644 index 00000000000..8049c9b8f1b --- /dev/null +++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/data/JpaWebAutoConfigurationTests.java @@ -0,0 +1,63 @@ +/* + * Copyright 2012-2013 the original author or authors. + * + * 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.springframework.bootstrap.autoconfigure.data; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.bootstrap.autoconfigure.data.test.City; +import org.springframework.bootstrap.autoconfigure.data.test.CityRepository; +import org.springframework.bootstrap.autoconfigure.jdbc.EmbeddedDatabaseConfiguration; +import org.springframework.bootstrap.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.repository.support.DomainClassConverter; +import org.springframework.mock.web.MockServletContext; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Dave Syer + * + */ +@Ignore +// until spring data commons 1.6.0, jpa 1.5.0 available +public class JpaWebAutoConfigurationTests { + + private AnnotationConfigWebApplicationContext context; + + @Test + public void testDefaultRepositoryConfiguration() throws Exception { + this.context = new AnnotationConfigWebApplicationContext(); + this.context.setServletContext(new MockServletContext()); + this.context.register(TestConfiguration.class, + EmbeddedDatabaseConfiguration.class, HibernateJpaAutoConfiguration.class, + JpaRepositoriesAutoConfiguration.class, + PropertyPlaceholderAutoConfiguration.class); + this.context.refresh(); + assertNotNull(this.context.getBean(CityRepository.class)); + assertNotNull(this.context.getBean(DomainClassConverter.class)); + } + + @Configuration + // @EnableSpringDataWebSupport + @ComponentScan(basePackageClasses = City.class) + protected static class TestConfiguration { + + } + +}