diff --git a/pom.xml b/pom.xml
index a04484ee5..dcc9fb871 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,8 +34,10 @@
1.8.0.BUILD-SNAPSHOT2.0.0.BUILD-SNAPSHOT1.4.0.BUILD-SNAPSHOT
+ 1.1.0.BUILD-SNAPSHOT4.3.10.Final
+ 0.9.1false
@@ -67,7 +69,23 @@
+
+ it
+
+
+ spring-data-rest-core
+ spring-data-rest-webmvc
+ spring-data-rest-distribution
+ spring-data-rest-hal-browser
+ spring-data-rest-tests
+
+
+
+
+
+
release
+
@@ -77,6 +95,7 @@
+
@@ -90,45 +109,6 @@
true
-
-
-
- org.springframework.data
- spring-data-jpa
- ${springdata.jpa}
- test
-
-
-
- org.hibernate
- hibernate-entitymanager
- ${hibernate.version}
- test
-
-
-
- org.hsqldb
- hsqldb
- 2.3.2
- test
-
-
-
-
-
- org.springframework.data
- spring-data-mongodb
- ${springdata.mongodb}
- test
-
-
-
- com.querydsl
- querydsl-mongodb
- ${querydsl}
- test
-
-
diff --git a/spring-data-rest-core/pom.xml b/spring-data-rest-core/pom.xml
index 5e4c60ce5..ec9d8c55e 100644
--- a/spring-data-rest-core/pom.xml
+++ b/spring-data-rest-core/pom.xml
@@ -51,13 +51,6 @@
${evoinflector}
-
- joda-time
- joda-time
- ${jodatime}
- true
-
-
com.fasterxml.jackson.corejackson-annotations
@@ -71,6 +64,13 @@
true
+
+ org.springframework.data
+ spring-data-keyvalue
+ ${springdata.keyvalue}
+ test
+
+
diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupConfiguration.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupConfiguration.java
index 52f5a2fcd..f2272699b 100644
--- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupConfiguration.java
+++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -61,7 +61,7 @@ class EntityLookupConfiguration implements EntityLookupRegistrar {
* @see org.springframework.data.rest.core.config.EntityLookupRegistrar#forValueRepository(java.lang.Class)
*/
@Override
- public > IdMappingRegistrar forValueRepository(
+ public > IdMappingRegistrar forLookupRepository(
Class type) {
this.lookupTypes.add(AbstractRepositoryMetadata.getMetadata(type).getDomainType());
return forRepository(type);
diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupRegistrar.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupRegistrar.java
index 2cec18c28..8689a5aec 100644
--- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupRegistrar.java
+++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/config/EntityLookupRegistrar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -38,7 +38,14 @@ public interface EntityLookupRegistrar {
*/
> IdMappingRegistrar forRepository(Class type);
- > IdMappingRegistrar forValueRepository(Class type);
+ /**
+ * Starts building a custom {@link EntityLookup} for the given repository type and registers the domain type of the
+ * given repository as lookup type.
+ *
+ * @param type must not be {@literal null}.
+ * @return
+ */
+ > IdMappingRegistrar forLookupRepository(Class type);
interface IdMappingRegistrar> {
@@ -61,6 +68,14 @@ public interface EntityLookupRegistrar {
> EntityLookupRegistrar forRepository(Class type,
Converter identifierMapping, Lookup lookup);
+ /**
+ * Registers an {@link EntityLookup} for the given repository type, identifier mapping and lookup operation and
+ * registers the domain type managed by the given repository as lookup type.
+ *
+ * @param type must not be {@literal null}.
+ * @param identifierMapping must not be {@literal null}.
+ * @param lookup must not be {@literal null}.
+ */
> EntityLookupRegistrar forValueRepository(Class type,
Converter identifierMapping, Lookup lookup);
diff --git a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/event/ValidatingRepositoryEventListener.java b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/event/ValidatingRepositoryEventListener.java
index 115d00aba..85b9ef17f 100644
--- a/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/event/ValidatingRepositoryEventListener.java
+++ b/spring-data-rest-core/src/main/java/org/springframework/data/rest/core/event/ValidatingRepositoryEventListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -23,7 +23,7 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectFactory;
-import org.springframework.data.repository.support.Repositories;
+import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.RepositoryConstraintViolationException;
import org.springframework.data.rest.core.ValidationErrors;
import org.springframework.util.Assert;
@@ -44,19 +44,19 @@ public class ValidatingRepositoryEventListener extends AbstractRepositoryEventLi
private static final Logger LOGGER = LoggerFactory.getLogger(ValidatingRepositoryEventListener.class);
- private final ObjectFactory repositoriesFactory;
+ private final ObjectFactory persistentEntitiesFactory;
private final MultiValueMap validators;
/**
* Creates a new {@link ValidatingRepositoryEventListener} using the given repositories.
*
- * @param repositoriesFactory must not be {@literal null}.
+ * @param persistentEntitiesFactory must not be {@literal null}.
*/
- public ValidatingRepositoryEventListener(ObjectFactory repositoriesFactory) {
+ public ValidatingRepositoryEventListener(ObjectFactory persistentEntitiesFactory) {
- Assert.notNull(repositoriesFactory, "Repositories must not be null!");
+ Assert.notNull(persistentEntitiesFactory, "PersistentEntities must not be null!");
- this.repositoriesFactory = repositoriesFactory;
+ this.persistentEntitiesFactory = persistentEntitiesFactory;
this.validators = new LinkedMultiValueMap();
}
@@ -159,24 +159,26 @@ public class ValidatingRepositoryEventListener extends AbstractRepositoryEventLi
validate("afterDelete", entity);
}
- private Errors validate(String event, Object o) {
+ private Errors validate(String event, Object entity) {
- if (o == null) {
+ if (entity == null) {
return null;
}
- Class> domainType = o.getClass();
- Repositories repositories = repositoriesFactory.getObject();
- Errors errors = new ValidationErrors(domainType.getSimpleName(), o, repositories.getPersistentEntity(domainType));
+ Class> domainType = entity.getClass();
+ PersistentEntities persistentEntities = persistentEntitiesFactory.getObject();
+ Errors errors = new ValidationErrors(domainType.getSimpleName(), entity,
+ persistentEntities.getPersistentEntity(domainType));
for (Validator v : getValidatorsForEvent(event)) {
+
if (v.supports(domainType)) {
- LOGGER.debug("{}: {} with {}", event, o, v);
- ValidationUtils.invokeValidator(v, o, errors);
+ LOGGER.debug("{}: {} with {}", event, entity, v);
+ ValidationUtils.invokeValidator(v, entity, errors);
}
}
- if (errors.getErrorCount() > 0) {
+ if (errors.hasErrors()) {
throw new RepositoryConstraintViolationException(errors);
}
@@ -184,6 +186,7 @@ public class ValidatingRepositoryEventListener extends AbstractRepositoryEventLi
}
private Collection getValidatorsForEvent(String event) {
+
Collection validators = this.validators.get(event);
return validators == null ? Collections. emptySet() : validators;
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java
index 4ca37f9cb..c9a0f23b3 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/AbstractIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -18,8 +18,8 @@ package org.springframework.data.rest.core;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.rest.core.domain.jpa.Person;
-import org.springframework.data.rest.core.domain.jpa.PersonRepository;
+import org.springframework.data.rest.core.domain.Person;
+import org.springframework.data.rest.core.domain.PersonRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationIntegrationTests.java
index cfb6b8733..82aac1f17 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationIntegrationTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationIntegrationTests.java
@@ -7,7 +7,7 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.config.ResourceMapping;
-import org.springframework.data.rest.core.domain.jpa.ConfiguredPersonRepository;
+import org.springframework.data.rest.core.domain.ConfiguredPersonRepository;
/**
* Tests to check that {@link ResourceMapping}s are handled correctly.
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationUnitTests.java
index 8c83a4e5b..b0e0b6219 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryRestConfigurationUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -25,6 +25,8 @@ import org.springframework.data.rest.core.config.EnumTranslationConfiguration;
import org.springframework.data.rest.core.config.MetadataConfiguration;
import org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.core.domain.Profile;
+import org.springframework.data.rest.core.domain.ProfileRepository;
import org.springframework.http.MediaType;
/**
@@ -125,4 +127,15 @@ public class RepositoryRestConfigurationUnitTests {
assertThat(configuration.returnBodyOnCreate(""), is(true));
assertThat(configuration.returnBodyOnCreate(MediaType.APPLICATION_JSON_VALUE), is(true));
}
+
+ /**
+ * @see DATAREST-776
+ */
+ @Test
+ public void consideresDomainTypeOfValueRepositoryLookupTypes() {
+
+ configuration.withEntityLookup().forLookupRepository(ProfileRepository.class);
+
+ assertThat(configuration.isLookupType(Profile.class), is(true));
+ }
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryTestsConfig.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryTestsConfig.java
index ee57576a7..7bcdca6d8 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryTestsConfig.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/RepositoryTestsConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -24,7 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
+import org.springframework.data.map.repository.config.EnableMapRepositories;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.repository.support.Repositories;
@@ -32,10 +32,9 @@ import org.springframework.data.rest.core.config.EnumTranslationConfiguration;
import org.springframework.data.rest.core.config.MetadataConfiguration;
import org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
-import org.springframework.data.rest.core.domain.jpa.ConfiguredPersonRepository;
-import org.springframework.data.rest.core.domain.jpa.JpaRepositoryConfig;
-import org.springframework.data.rest.core.domain.jpa.Person;
-import org.springframework.data.rest.core.domain.jpa.PersonRepository;
+import org.springframework.data.rest.core.domain.ConfiguredPersonRepository;
+import org.springframework.data.rest.core.domain.Person;
+import org.springframework.data.rest.core.domain.PersonRepository;
import org.springframework.format.support.DefaultFormattingConversionService;
/**
@@ -43,7 +42,7 @@ import org.springframework.format.support.DefaultFormattingConversionService;
* @author Oliver Gierke
*/
@Configuration
-@Import({ JpaRepositoryConfig.class })
+@EnableMapRepositories
public class RepositoryTestsConfig {
@Autowired private ApplicationContext context;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/UriToEntityConverterUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/UriToEntityConverterUnitTests.java
index b9b1e173f..7a983f255 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/UriToEntityConverterUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/UriToEntityConverterUnitTests.java
@@ -32,8 +32,9 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.convert.converter.GenericConverter.ConvertiblePair;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.repository.support.RepositoryInvoker;
@@ -54,14 +55,14 @@ public class UriToEntityConverterUnitTests {
@Mock Repositories repositories;
@Mock RepositoryInvokerFactory invokerFactory;
- MongoMappingContext context;
+ KeyValueMappingContext context;
UriToEntityConverter converter;
@Before
@SuppressWarnings("unchecked")
public void setUp() {
- this.context = new MongoMappingContext();
+ this.context = new KeyValueMappingContext();
this.context.setInitialEntitySet(new HashSet>(Arrays.asList(Entity.class, NonEntity.class)));
this.context.afterPropertiesSet();
@@ -164,7 +165,7 @@ public class UriToEntityConverterUnitTests {
}
static class Entity {
- String id;
+ @Id String id;
}
static class NonEntity {
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java
index 26ddf0241..f68f29be6 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/config/ResourceMappingUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2013 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -26,7 +26,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RestResource;
-import org.springframework.data.rest.core.domain.jpa.Person;
+import org.springframework.data.rest.core.domain.Person;
import org.springframework.data.rest.core.mapping.ResourceMapping;
import org.springframework.hateoas.RelProvider;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java
index 55ecb412a..b16e76b87 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/RepositoryEventIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.rest.core.RepositoryTestsConfig;
-import org.springframework.data.rest.core.domain.jpa.AnnotatedPersonEventHandler;
-import org.springframework.data.rest.core.domain.jpa.EventHandlerInvokedException;
-import org.springframework.data.rest.core.domain.jpa.Person;
-import org.springframework.data.rest.core.domain.jpa.PersonBeforeSaveHandler;
-import org.springframework.data.rest.core.domain.jpa.PersonRepository;
+import org.springframework.data.rest.core.domain.AnnotatedPersonEventHandler;
+import org.springframework.data.rest.core.domain.EventHandlerInvokedException;
+import org.springframework.data.rest.core.domain.Person;
+import org.springframework.data.rest.core.domain.PersonBeforeSaveHandler;
+import org.springframework.data.rest.core.domain.PersonRepository;
import org.springframework.data.rest.core.event.AfterCreateEvent;
import org.springframework.data.rest.core.event.AfterDeleteEvent;
import org.springframework.data.rest.core.event.AfterLinkDeleteEvent;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/ValidatorIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/ValidatorIntegrationTests.java
index dd64d6b1b..c492668a0 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/ValidatorIntegrationTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/context/ValidatorIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -19,49 +19,51 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.data.repository.support.Repositories;
+import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.RepositoryConstraintViolationException;
import org.springframework.data.rest.core.RepositoryTestsConfig;
-import org.springframework.data.rest.core.domain.jpa.Person;
-import org.springframework.data.rest.core.domain.jpa.PersonNameValidator;
+import org.springframework.data.rest.core.domain.JpaRepositoryConfig;
+import org.springframework.data.rest.core.domain.Person;
+import org.springframework.data.rest.core.domain.PersonNameValidator;
import org.springframework.data.rest.core.event.BeforeSaveEvent;
import org.springframework.data.rest.core.event.ValidatingRepositoryEventListener;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.transaction.annotation.Transactional;
/**
* Tests to check the {@link org.springframework.validation.Validator} integration.
*
* @author Jon Brisbin
+ * @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
-@Transactional
public class ValidatorIntegrationTests {
@Configuration
- @Import({ RepositoryTestsConfig.class })
+ @Import({ RepositoryTestsConfig.class, JpaRepositoryConfig.class })
static class ValidatorTestsConfig {
@Bean
- public ValidatingRepositoryEventListener validatingListener(ObjectFactory repositories) {
+ public ValidatingRepositoryEventListener validatingListener(ObjectFactory persistentEntities) {
- ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(repositories);
+ ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(persistentEntities);
listener.addValidator("beforeSave", new PersonNameValidator());
return listener;
}
}
- @Autowired ApplicationContext context;
+ @Autowired ConfigurableApplicationContext context;
@Test(expected = RepositoryConstraintViolationException.class)
public void shouldValidateLastName() throws Exception {
- context.publishEvent(new BeforeSaveEvent(new Person()));
+
+ // Empty name should be rejected by PersonNameValidator
+ context.publishEvent(new BeforeSaveEvent(new Person("Dave", "")));
}
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonEventHandler.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonEventHandler.java
similarity index 95%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonEventHandler.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonEventHandler.java
index 2f154c880..6f0aea12e 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonEventHandler.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonEventHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import org.springframework.data.rest.core.annotation.HandleAfterCreate;
import org.springframework.data.rest.core.annotation.HandleAfterDelete;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonRepository.java
new file mode 100644
index 000000000..04b9a6be9
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AnnotatedPersonRepository.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.NoRepositoryBean;
+import org.springframework.data.rest.core.annotation.RestResource;
+
+/**
+ * A repository to manage {@link org.springframework.data.rest.core.domain.Person}s.
+ *
+ * @author Jon Brisbin
+ */
+@RestResource(rel = "people", exported = false)
+@NoRepositoryBean
+public interface AnnotatedPersonRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Author.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Author.java
similarity index 72%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Author.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Author.java
index 510dfe571..04c590fd8 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Author.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Author.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,19 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
+import org.springframework.data.annotation.Id;
/**
* @author Oliver Gierke
*/
-@Entity
+
public class Author {
- @Id @GeneratedValue Long id;
+ @Id Long id;
String firstname, lastname;
-
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AuthorRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AuthorRepository.java
similarity index 90%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AuthorRepository.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AuthorRepository.java
index ac7e8fc2b..8f491a03a 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AuthorRepository.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/AuthorRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import java.util.List;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/ConfiguredPersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ConfiguredPersonRepository.java
similarity index 84%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/ConfiguredPersonRepository.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ConfiguredPersonRepository.java
index 4c9a1fe58..59f98334c 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/ConfiguredPersonRepository.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ConfiguredPersonRepository.java
@@ -1,4 +1,4 @@
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.NoRepositoryBean;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCard.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCard.java
similarity index 79%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCard.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCard.java
index 1a7a1e83e..4c49a001f 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCard.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCard.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,15 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
-import javax.persistence.Entity;
-import javax.persistence.Id;
+import org.springframework.data.annotation.Id;
/**
* @author Oliver Gierke
*/
-@Entity
public class CreditCard {
@Id Long id;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCardRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCardRepository.java
similarity index 88%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCardRepository.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCardRepository.java
index 540a688f5..a5e547a68 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/CreditCardRepository.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/CreditCardRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import org.springframework.data.repository.CrudRepository;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/EventHandlerInvokedException.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/EventHandlerInvokedException.java
similarity index 87%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/EventHandlerInvokedException.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/EventHandlerInvokedException.java
index 0d5cb8678..ac6f45cb2 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/EventHandlerInvokedException.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/EventHandlerInvokedException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
/**
* @author Oliver Gierke
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/JpaRepositoryConfig.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/JpaRepositoryConfig.java
new file mode 100644
index 000000000..c30e0ca16
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/JpaRepositoryConfig.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import org.springframework.context.MessageSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.ResourceBundleMessageSource;
+import org.springframework.data.map.repository.config.EnableMapRepositories;
+
+/**
+ * @author Jon Brisbin
+ * @author Oliver Gierke
+ */
+@Configuration
+@ComponentScan
+@EnableMapRepositories
+public class JpaRepositoryConfig {
+
+ @Bean
+ public MessageSource messageSource() {
+ ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
+ ms.setBasename("org.springframework.data.rest.core.ValidationErrors");
+ return ms;
+ }
+}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Order.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Order.java
new file mode 100644
index 000000000..b997ff2f2
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Order.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2013-2016 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.data.rest.core.domain;
+
+import lombok.Value;
+
+import java.util.UUID;
+
+import org.springframework.data.annotation.Id;
+import org.springframework.data.annotation.Reference;
+
+/**
+ * @author Oliver Gierke
+ */
+@Value
+public class Order {
+
+ @Id UUID id = UUID.randomUUID();
+ @Reference Person creator;
+}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/OrderRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/OrderRepository.java
similarity index 80%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/OrderRepository.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/OrderRepository.java
index a5496ceb2..c2c6856e6 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/OrderRepository.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/OrderRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,14 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
+
+import java.util.UUID;
import org.springframework.data.repository.CrudRepository;
/**
* @author Oliver Gierke
*/
-public interface OrderRepository extends CrudRepository {
+public interface OrderRepository extends CrudRepository {
/*
* (non-Javadoc)
@@ -34,5 +36,5 @@ public interface OrderRepository extends CrudRepository {
* @see org.springframework.data.repository.CrudRepository#findOne(java.io.Serializable)
*/
@Override
- public Order findOne(Long id);
+ public Order findOne(UUID id);
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Person.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Person.java
new file mode 100644
index 000000000..ce6c7ad13
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Person.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013-2016 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.data.rest.core.domain;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import org.springframework.data.annotation.Id;
+import org.springframework.data.annotation.Reference;
+import org.springframework.data.rest.core.annotation.RestResource;
+
+/**
+ * An entity that represents a person.
+ *
+ * @author Jon Brisbin
+ * @author Oliver Gierke
+ */
+@Data
+public class Person {
+
+ private final @Id UUID id = UUID.randomUUID();
+ private final String firstName, lastName;
+
+ private @Reference List siblings = new ArrayList();
+ private @RestResource(path = "father-mapped") @Reference Person father;
+ private Date created = Calendar.getInstance().getTime();
+
+ public Person addSibling(Person p) {
+ siblings.add(p);
+ return this;
+ }
+}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonBeforeSaveHandler.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonBeforeSaveHandler.java
similarity index 90%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonBeforeSaveHandler.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonBeforeSaveHandler.java
index df09424da..0c61ab4f6 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonBeforeSaveHandler.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonBeforeSaveHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import org.springframework.data.rest.core.event.AbstractRepositoryEventListener;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonNameValidator.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonNameValidator.java
similarity index 93%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonNameValidator.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonNameValidator.java
index 21c786f3d..093b86397 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonNameValidator.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonNameValidator.java
@@ -1,4 +1,4 @@
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import static org.springframework.util.ClassUtils.*;
import static org.springframework.util.StringUtils.*;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonRepository.java
similarity index 77%
rename from spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonRepository.java
rename to spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonRepository.java
index f346f7d28..64f5d3534 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PersonRepository.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PersonRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,19 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.core.domain.jpa;
+package org.springframework.data.rest.core.domain;
import java.util.Date;
+import java.util.UUID;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.format.annotation.DateTimeFormat.ISO;
/**
* A repository to manage {@link Person}s.
@@ -34,17 +32,13 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
* @author Oliver Gierke
*/
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
-public interface PersonRepository extends PagingAndSortingRepository {
+public interface PersonRepository extends PagingAndSortingRepository {
@RestResource(rel = "firstname", path = "firstname")
Page findByFirstName(@Param("firstName") String firstName, Pageable pageable);
Page findByCreatedGreaterThan(@Param("date") Date date, Pageable pageable);
- @Query("select p from Person p where p.created > :date")
- Page findByCreatedUsingISO8601Date(@Param("date") @DateTimeFormat(iso = ISO.DATE_TIME) Date date,
- Pageable pageable);
-
/**
* @see DATAREST-107 - this method matches the earlier one, causing an ambiguous mapping except for the exported
* setting
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PlainPersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PlainPersonRepository.java
new file mode 100644
index 000000000..32c91b64a
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/PlainPersonRepository.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.NoRepositoryBean;
+
+/**
+ * A repository to manage {@link Person}s.
+ *
+ * @author Jon Brisbin
+ */
+@NoRepositoryBean
+public interface PlainPersonRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Profile.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Profile.java
new file mode 100644
index 000000000..b6f864df9
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/Profile.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import lombok.Value;
+
+import java.util.UUID;
+
+import org.springframework.data.annotation.Id;
+
+/**
+ * @author Jon Brisbin
+ * @author Oliver Gierke
+ */
+@Value
+public class Profile {
+
+ @Id UUID id = UUID.randomUUID();
+ String name, type;
+}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileLoader.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileLoader.java
new file mode 100644
index 000000000..c388349b1
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileLoader.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Jon Brisbin
+ * @author Oliver Gierke
+ */
+@Component
+public class ProfileLoader implements InitializingBean {
+
+ @Autowired ProfileRepository profiles;
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ profiles.save(new Profile("jdoe", "account"));
+ }
+}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileRepository.java
new file mode 100644
index 000000000..d08590c46
--- /dev/null
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/ProfileRepository.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2012-2016 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.data.rest.core.domain;
+
+import java.util.UUID;
+
+import org.springframework.data.repository.CrudRepository;
+
+/**
+ * Repository for managing {@link Profile}s.
+ *
+ * @author Jon Brisbin
+ * @author Oliver Gierke
+ */
+public interface ProfileRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonRepository.java
deleted file mode 100644
index 0689a9941..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/AnnotatedPersonRepository.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.springframework.data.rest.core.domain.jpa;
-
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.NoRepositoryBean;
-import org.springframework.data.rest.core.annotation.RestResource;
-
-/**
- * A repository to manage {@link org.springframework.data.rest.core.domain.jpa.Person}s.
- *
- * @author Jon Brisbin
- */
-@RestResource(rel = "people", exported = false)
-@NoRepositoryBean
-public interface AnnotatedPersonRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/JpaRepositoryConfig.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/JpaRepositoryConfig.java
deleted file mode 100644
index a0090d488..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/JpaRepositoryConfig.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.data.rest.core.domain.jpa;
-
-import javax.persistence.EntityManagerFactory;
-import javax.sql.DataSource;
-
-import org.springframework.context.MessageSource;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.support.ResourceBundleMessageSource;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
-import org.springframework.orm.jpa.JpaDialect;
-import org.springframework.orm.jpa.JpaTransactionManager;
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
-import org.springframework.orm.jpa.vendor.Database;
-import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-/**
- * @author Jon Brisbin
- * @author Oliver Gierke
- */
-@Configuration
-@ComponentScan
-@EnableJpaRepositories
-@EnableTransactionManagement
-public class JpaRepositoryConfig {
-
- @Bean
- public MessageSource messageSource() {
- ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
- ms.setBasename("org.springframework.data.rest.core.ValidationErrors");
- return ms;
- }
-
- @Bean
- public DataSource dataSource() {
- EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
- return builder.setType(EmbeddedDatabaseType.HSQL).build();
- }
-
- @Bean
- public EntityManagerFactory entityManagerFactory() {
- HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
- vendorAdapter.setDatabase(Database.HSQL);
- vendorAdapter.setGenerateDdl(true);
-
- LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
- factory.setJpaVendorAdapter(vendorAdapter);
- factory.setPackagesToScan(getClass().getPackage().getName());
- factory.setDataSource(dataSource());
-
- factory.afterPropertiesSet();
-
- return factory.getObject();
- }
-
- @Bean
- public JpaDialect jpaDialect() {
- return new HibernateJpaDialect();
- }
-
- @Bean
- public PlatformTransactionManager transactionManager() {
- JpaTransactionManager txManager = new JpaTransactionManager();
- txManager.setEntityManagerFactory(entityManagerFactory());
- return txManager;
- }
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Order.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Order.java
deleted file mode 100644
index c543a15ef..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Order.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2013-2014 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.data.rest.core.domain.jpa;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-/**
- * @author Oliver Gierke
- */
-@Entity
-@Table(name = "ORDERS")
-public class Order {
-
- private @Id @GeneratedValue Long id;
- private @ManyToOne Person creator;
-
- public Order(Person creator) {
- this.creator = creator;
- }
-
- protected Order() {
-
- }
-
- public Long getId() {
- return id;
- }
-
- public Person getCreator() {
- return creator;
- }
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Person.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Person.java
deleted file mode 100644
index 44a7597b0..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/Person.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2013-2015 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.data.rest.core.domain.jpa;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.PrePersist;
-
-import org.springframework.data.rest.core.annotation.RestResource;
-
-/**
- * An entity that represents a person.
- *
- * @author Jon Brisbin
- * @author Oliver Gierke
- */
-@Entity
-public class Person {
-
- @Id @GeneratedValue private Long id;
- private String firstName;
- private String lastName;
- @OneToMany private List siblings = Collections.emptyList();
- private @RestResource(path = "father-mapped") @ManyToOne Person father;
- private Date created;
-
- public Person() {}
-
- public Person(String firstName, String lastName) {
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- public Long getId() {
- return id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public Person addSibling(Person p) {
- if (siblings == Collections.EMPTY_LIST) {
- siblings = new ArrayList();
- }
- siblings.add(p);
- return this;
- }
-
- public List getSiblings() {
- return siblings;
- }
-
- public void setSiblings(List siblings) {
- this.siblings = siblings;
- }
-
- public Date getCreated() {
- return created;
- }
-
- @PrePersist
- private void prePersist() {
- this.created = Calendar.getInstance().getTime();
- }
-
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PlainPersonRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PlainPersonRepository.java
deleted file mode 100644
index 18e71e3f9..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/jpa/PlainPersonRepository.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.springframework.data.rest.core.domain.jpa;
-
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.data.repository.NoRepositoryBean;
-
-/**
- * A repository to manage {@link Person}s.
- *
- * @author Jon Brisbin
- */
-@NoRepositoryBean
-public interface PlainPersonRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/MongoDbRepositoryConfig.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/MongoDbRepositoryConfig.java
deleted file mode 100644
index 809028bf7..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/MongoDbRepositoryConfig.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.springframework.data.rest.core.domain.mongodb;
-
-import java.net.UnknownHostException;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.mongodb.MongoDbFactory;
-import org.springframework.data.mongodb.core.MongoTemplate;
-import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
-import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
-
-import com.mongodb.MongoClient;
-
-/**
- * @author Jon Brisbin
- */
-@Configuration
-@ComponentScan
-@EnableMongoRepositories
-public class MongoDbRepositoryConfig {
-
- @Bean
- public MongoDbFactory mongoDbFactory() throws UnknownHostException {
- return new SimpleMongoDbFactory(new MongoClient("localhost"), "spring-data-rest");
- }
-
- @Bean
- public MongoTemplate mongoTemplate() throws UnknownHostException {
- return new MongoTemplate(mongoDbFactory());
- }
-
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/Profile.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/Profile.java
deleted file mode 100644
index affcddca2..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/Profile.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.springframework.data.rest.core.domain.mongodb;
-
-import org.springframework.data.annotation.Id;
-import org.springframework.data.mongodb.core.mapping.Document;
-
-/**
- * @author Jon Brisbin
- */
-@Document
-public class Profile {
-
- @Id private String id;
- private String name;
- private String type;
-
- public Profile() {}
-
- public Profile(String id, String name, String type) {
- this.id = id;
- this.name = name;
- this.type = type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public Profile setName(String name) {
- this.name = name;
- return this;
- }
-
- public String getType() {
- return type;
- }
-
- public Profile setType(String type) {
- this.type = type;
- return this;
- }
-
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileLoader.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileLoader.java
deleted file mode 100644
index 5bdf856aa..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileLoader.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.springframework.data.rest.core.domain.mongodb;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-/**
- * @author Jon Brisbin
- */
-@Component
-public class ProfileLoader implements InitializingBean {
-
- @Autowired private ProfileRepository profiles;
-
- @Override
- public void afterPropertiesSet() throws Exception {
- profiles.save(new Profile("jdoe", "jdoe", "account"));
- }
-
-}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileRepository.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileRepository.java
deleted file mode 100644
index 7147d7143..000000000
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/domain/mongodb/ProfileRepository.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.springframework.data.rest.core.domain.mongodb;
-
-import org.bson.types.ObjectId;
-import org.springframework.data.repository.CrudRepository;
-
-/**
- * Repository for managing {@link Profile}s in MongoDB.
- *
- * @author Jon Brisbin
- */
-public interface ProfileRepository extends CrudRepository {}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/event/AnnotatedEventHandlerInvokerUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/event/AnnotatedEventHandlerInvokerUnitTests.java
index 729915538..8a1269404 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/event/AnnotatedEventHandlerInvokerUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/event/AnnotatedEventHandlerInvokerUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -22,7 +22,7 @@ import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.data.rest.core.annotation.HandleBeforeCreate;
import org.springframework.data.rest.core.annotation.RepositoryEventHandler;
-import org.springframework.data.rest.core.domain.jpa.Person;
+import org.springframework.data.rest.core.domain.Person;
import org.springframework.data.rest.core.event.AnnotatedEventHandlerInvoker.EventHandlerMethod;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.MultiValueMap;
@@ -66,7 +66,7 @@ public class AnnotatedEventHandlerInvokerUnitTests {
AnnotatedEventHandlerInvoker invoker = new AnnotatedEventHandlerInvoker();
invoker.postProcessAfterInitialization(sampleHandler, "sampleHandler");
- invoker.onApplicationEvent(new BeforeCreateEvent(new Person()));
+ invoker.onApplicationEvent(new BeforeCreateEvent(new Person("Dave", "Matthews")));
assertThat(sampleHandler.wasCalled, is(true));
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/CrudMethodsSupportedHttpMethodsUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/CrudMethodsSupportedHttpMethodsUnitTests.java
index 44ab9c246..a3c8188f6 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/CrudMethodsSupportedHttpMethodsUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/CrudMethodsSupportedHttpMethodsUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -28,8 +28,8 @@ import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.annotation.ReadOnlyProperty;
import org.springframework.data.annotation.Reference;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;
import org.springframework.data.repository.core.CrudMethods;
@@ -103,8 +103,8 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
@Test
public void exposesMethodsForProperties() {
- MongoMappingContext context = new MongoMappingContext();
- MongoPersistentEntity> entity = context.getPersistentEntity(Entity.class);
+ KeyValueMappingContext context = new KeyValueMappingContext();
+ KeyValuePersistentEntity> entity = context.getPersistentEntity(Entity.class);
SupportedHttpMethods methods = getSupportedHttpMethodsFor(EntityRepository.class);
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/MappingResourceMetadataUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/MappingResourceMetadataUnitTests.java
index 46658e5ba..42ee36b04 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/MappingResourceMetadataUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/MappingResourceMetadataUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -23,11 +23,11 @@ import java.util.Arrays;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.springframework.data.annotation.Reference;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentProperty;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.DBRef;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.data.rest.core.annotation.RestResource;
/**
@@ -38,9 +38,9 @@ import org.springframework.data.rest.core.annotation.RestResource;
@RunWith(MockitoJUnitRunner.class)
public class MappingResourceMetadataUnitTests {
- MongoMappingContext context = new MongoMappingContext();
+ KeyValueMappingContext context = new KeyValueMappingContext();
- MongoPersistentEntity> entity = context.getPersistentEntity(Entity.class);
+ KeyValuePersistentEntity> entity = context.getPersistentEntity(Entity.class);
ResourceMappings resourceMappings = new PersistentEntitiesResourceMappings(
new PersistentEntities(Arrays.asList(context)));
MappingResourceMetadata metadata = new MappingResourceMetadata(entity, resourceMappings);
@@ -51,7 +51,7 @@ public class MappingResourceMetadataUnitTests {
@Test
public void allowsLookupOfPropertyByMappedName() {
- MongoPersistentProperty property = entity.getPersistentProperty("related");
+ KeyValuePersistentProperty property = entity.getPersistentProperty("related");
PropertyAwareResourceMapping propertyMapping = metadata.getProperty("foo");
@@ -81,7 +81,7 @@ public class MappingResourceMetadataUnitTests {
}
static class Entity {
- @DBRef @RestResource(rel = "foo", path = "foo") private Related related;
+ @Reference @RestResource(rel = "foo", path = "foo") private Related related;
}
@RestResource
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/PersistentPropertyResourceMappingUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/PersistentPropertyResourceMappingUnitTests.java
index 48d943e30..361c3c8be 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/PersistentPropertyResourceMappingUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/PersistentPropertyResourceMappingUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2014 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -24,11 +24,11 @@ import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
+import org.springframework.data.annotation.Reference;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentProperty;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.DBRef;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.data.rest.core.Path;
import org.springframework.data.rest.core.annotation.Description;
import org.springframework.data.rest.core.annotation.RestResource;
@@ -41,7 +41,7 @@ import org.springframework.data.rest.core.annotation.RestResource;
@RunWith(MockitoJUnitRunner.class)
public class PersistentPropertyResourceMappingUnitTests {
- MongoMappingContext mappingContext = new MongoMappingContext();
+ KeyValueMappingContext mappingContext = new KeyValueMappingContext();
/**
* @see DATAREST-175
@@ -114,11 +114,11 @@ public class PersistentPropertyResourceMappingUnitTests {
private ResourceMapping getPropertyMappingFor(Class> entity, String propertyName) {
- MongoPersistentEntity> persistentEntity = mappingContext.getPersistentEntity(entity);
- MongoPersistentProperty property = persistentEntity.getPersistentProperty(propertyName);
+ KeyValuePersistentEntity> persistentEntity = mappingContext.getPersistentEntity(entity);
+ KeyValuePersistentProperty property = persistentEntity.getPersistentProperty(propertyName);
- ResourceMappings resourceMappings = new PersistentEntitiesResourceMappings(new PersistentEntities(
- Arrays.asList(mappingContext)));
+ ResourceMappings resourceMappings = new PersistentEntitiesResourceMappings(
+ new PersistentEntities(Arrays.asList(mappingContext)));
return new PersistentPropertyResourceMapping(property, resourceMappings);
}
@@ -126,10 +126,10 @@ public class PersistentPropertyResourceMappingUnitTests {
public static class Entity {
Related first;
- @DBRef Related third;
+ @Reference Related third;
- @DBRef//
- @RestResource(path = "secPath", rel = "secRel", exported = false)//
+ @Reference //
+ @RestResource(path = "secPath", rel = "secRel", exported = false) //
List second;
@Description("Some description") String fourth;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java
index 380b07ce6..db64b072a 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/RepositoryResourceMappingsIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2014 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -28,16 +28,16 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.jpa.mapping.JpaMetamodelMappingContext;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.rest.core.Path;
-import org.springframework.data.rest.core.domain.jpa.Author;
-import org.springframework.data.rest.core.domain.jpa.CreditCard;
-import org.springframework.data.rest.core.domain.jpa.JpaRepositoryConfig;
-import org.springframework.data.rest.core.domain.jpa.Person;
+import org.springframework.data.rest.core.domain.Author;
+import org.springframework.data.rest.core.domain.CreditCard;
+import org.springframework.data.rest.core.domain.JpaRepositoryConfig;
+import org.springframework.data.rest.core.domain.Person;
import org.springframework.data.rest.core.mapping.RepositoryDetectionStrategy.RepositoryDetectionStrategies;
import org.springframework.hateoas.core.EvoInflectorRelProvider;
import org.springframework.test.context.ContextConfiguration;
@@ -56,7 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
public class RepositoryResourceMappingsIntegrationTests {
@Autowired ListableBeanFactory factory;
- @Autowired JpaMetamodelMappingContext mappingContext;
+ @Autowired KeyValueMappingContext mappingContext;
ResourceMappings mappings;
@@ -70,7 +70,7 @@ public class RepositoryResourceMappingsIntegrationTests {
@Test
public void detectsAllMappings() {
- assertThat(mappings, is(Matchers. iterableWithSize(4)));
+ assertThat(mappings, is(Matchers. iterableWithSize(5)));
}
@Test
@@ -143,8 +143,8 @@ public class RepositoryResourceMappingsIntegrationTests {
methodNames.add(method.getMethod().getName());
}
- assertThat(methodNames, hasSize(3));
- assertThat(methodNames, hasItems("findByFirstName", "findByCreatedGreaterThan", "findByCreatedUsingISO8601Date"));
+ assertThat(methodNames, hasSize(2));
+ assertThat(methodNames, hasItems("findByFirstName", "findByCreatedGreaterThan"));
}
/**
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DefaultSelfLinkProviderUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DefaultSelfLinkProviderUnitTests.java
index c39c67117..2efd8cd54 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DefaultSelfLinkProviderUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DefaultSelfLinkProviderUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -23,7 +23,6 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.UUID;
import org.hamcrest.Matchers;
import org.junit.Before;
@@ -35,9 +34,9 @@ import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
-import org.springframework.data.rest.core.domain.mongodb.Profile;
+import org.springframework.data.rest.core.domain.Profile;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.Link;
@@ -73,7 +72,7 @@ public class DefaultSelfLinkProviderUnitTests {
}
});
- MongoMappingContext context = new MongoMappingContext();
+ KeyValueMappingContext context = new KeyValueMappingContext();
context.getPersistentEntity(Profile.class);
context.afterPropertiesSet();
@@ -112,10 +111,10 @@ public class DefaultSelfLinkProviderUnitTests {
@Test
public void usesEntityIdIfNoLookupDefined() {
- String id = UUID.randomUUID().toString();
- Link link = provider.createSelfLinkFor(new Profile(id, "Name", "Type"));
+ Profile profile = new Profile("Name", "Type");
+ Link link = provider.createSelfLinkFor(profile);
- assertThat(link.getHref(), Matchers.endsWith(id));
+ assertThat(link.getHref(), Matchers.endsWith(profile.getId().toString()));
}
/**
@@ -131,8 +130,7 @@ public class DefaultSelfLinkProviderUnitTests {
this.provider = new DefaultSelfLinkProvider(entities, entityLinks, Arrays.asList(lookup));
- String id = UUID.randomUUID().toString();
- Link link = provider.createSelfLinkFor(new Profile(id, "Name", "Type"));
+ Link link = provider.createSelfLinkFor(new Profile("Name", "Type"));
assertThat(link.getHref(), Matchers.endsWith("foo"));
}
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DomainObjectMergerTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DomainObjectMergerTests.java
index a5e4842f1..78e245f80 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DomainObjectMergerTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/DomainObjectMergerTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -28,8 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.data.repository.support.Repositories;
-import org.springframework.data.rest.core.domain.jpa.JpaRepositoryConfig;
-import org.springframework.data.rest.core.domain.jpa.Person;
+import org.springframework.data.rest.core.domain.JpaRepositoryConfig;
+import org.springframework.data.rest.core.domain.Person;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
diff --git a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/UnwrappingRepositoryInvokerFactoryUnitTests.java b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/UnwrappingRepositoryInvokerFactoryUnitTests.java
index 0258be236..fdd864b61 100644
--- a/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/UnwrappingRepositoryInvokerFactoryUnitTests.java
+++ b/spring-data-rest-core/src/test/java/org/springframework/data/rest/core/support/UnwrappingRepositoryInvokerFactoryUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -35,7 +35,7 @@ import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.springframework.data.repository.support.RepositoryInvoker;
import org.springframework.data.repository.support.RepositoryInvokerFactory;
-import org.springframework.data.rest.core.domain.mongodb.Profile;
+import org.springframework.data.rest.core.domain.Profile;
import org.springframework.util.LinkedMultiValueMap;
/**
diff --git a/spring-data-rest-tests/pom.xml b/spring-data-rest-tests/pom.xml
new file mode 100644
index 000000000..7e2c1c835
--- /dev/null
+++ b/spring-data-rest-tests/pom.xml
@@ -0,0 +1,46 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-parent
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests
+ spring-data-rest-tests
+ pom
+
+
+ spring-data-rest-tests-core
+ spring-data-rest-tests-gemfire
+ spring-data-rest-tests-jpa
+ spring-data-rest-tests-mongodb
+ spring-data-rest-tests-security
+ spring-data-rest-tests-solr
+
+
+
+ 2.4.4
+
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+ provided
+
+
+
+ org.codehaus.groovy
+ groovy-all
+ ${groovy.version}
+
+
+
+
+
diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml
new file mode 100644
index 000000000..a1a86d9b5
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/pom.xml
@@ -0,0 +1,55 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests - Core
+ spring-data-rest-tests-core
+
+
+
+
+ org.springframework.data
+ spring-data-rest-webmvc
+ 2.5.0.BUILD-SNAPSHOT
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.0.1
+ provided
+
+
+
+ com.jayway.jsonpath
+ json-path
+ ${jsonpath}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.6
+
+
+
+ test-jar
+
+
+
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractControllerIntegrationTests.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractControllerIntegrationTests.java
index 4b48ef0ff..b48179d6e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractControllerIntegrationTests.java
@@ -1,5 +1,6 @@
+package org.springframework.data.rest.tests;
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
import java.util.Collections;
@@ -31,6 +31,8 @@ import org.springframework.data.rest.core.mapping.ResourceMetadata;
import org.springframework.data.rest.core.support.DefaultSelfLinkProvider;
import org.springframework.data.rest.core.support.EntityLookup;
import org.springframework.data.rest.core.support.SelfLinkProvider;
+import org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler;
+import org.springframework.data.rest.webmvc.RootResourceInformation;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.data.rest.webmvc.support.Projector;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -54,7 +56,7 @@ public abstract class AbstractControllerIntegrationTests {
public static final Path BASE = new Path("http://localhost");
@Configuration
- static class TestConfiguration extends RepositoryRestMvcConfiguration {
+ public static class TestConfiguration extends RepositoryRestMvcConfiguration {
@Bean
public PersistentEntityResourceAssembler persistentEntityResourceAssembler() {
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java
similarity index 98%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java
index d3779d7fe..643f382a8 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AbstractWebIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/AbstractWebIntegrationTests.java
@@ -1,5 +1,6 @@
+package org.springframework.data.rest.tests;
/*
- * Copyright 2013-2014 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/CommonWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/CommonWebTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java
index 58c08cd2b..e83ff0eb3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/CommonWebTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/CommonWebTests.java
@@ -1,5 +1,6 @@
+package org.springframework.data.rest.tests;
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -14,8 +15,6 @@
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
-
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
@@ -29,6 +28,7 @@ import java.util.List;
import java.util.Map;
import org.junit.Test;
+import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;
import org.springframework.hateoas.MediaTypes;
diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java
new file mode 100644
index 000000000..833d901a2
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RepositoryTestsConfig.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2012-2016 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.data.rest.tests;
+
+import static org.mockito.Mockito.*;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.mapping.context.MappingContext;
+import org.springframework.data.mapping.context.PersistentEntities;
+import org.springframework.data.repository.support.DefaultRepositoryInvokerFactory;
+import org.springframework.data.repository.support.DomainClassConverter;
+import org.springframework.data.repository.support.Repositories;
+import org.springframework.data.rest.core.UriToEntityConverter;
+import org.springframework.data.rest.core.config.EnumTranslationConfiguration;
+import org.springframework.data.rest.core.config.MetadataConfiguration;
+import org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration;
+import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.core.mapping.RepositoryResourceMappings;
+import org.springframework.data.rest.core.support.DefaultSelfLinkProvider;
+import org.springframework.data.rest.core.support.EntityLookup;
+import org.springframework.data.rest.core.support.SelfLinkProvider;
+import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
+import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
+import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module;
+import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.LookupObjectSerializer;
+import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
+import org.springframework.data.rest.webmvc.mapping.Associations;
+import org.springframework.data.rest.webmvc.mapping.LinkCollector;
+import org.springframework.data.rest.webmvc.spi.BackendIdConverter;
+import org.springframework.data.rest.webmvc.spi.BackendIdConverter.DefaultIdConverter;
+import org.springframework.data.rest.webmvc.support.ExcerptProjector;
+import org.springframework.data.rest.webmvc.support.PagingAndSortingTemplateVariables;
+import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks;
+import org.springframework.format.support.DefaultFormattingConversionService;
+import org.springframework.format.support.FormattingConversionService;
+import org.springframework.hateoas.EntityLinks;
+import org.springframework.hateoas.RelProvider;
+import org.springframework.hateoas.ResourceProcessor;
+import org.springframework.hateoas.core.EvoInflectorRelProvider;
+import org.springframework.hateoas.hal.Jackson2HalModule;
+import org.springframework.plugin.core.OrderAwarePluginRegistry;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.Module;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * @author Jon Brisbin
+ * @author Greg Turnquist
+ * @author Oliver Gierke
+ */
+@Configuration
+public class RepositoryTestsConfig {
+
+ @Autowired ApplicationContext appCtx;
+ @Autowired(required = false) List> mappingContexts = Collections.emptyList();
+
+ @Bean
+ public Repositories repositories() {
+ return new Repositories(appCtx);
+ }
+
+ @Bean
+ public RepositoryRestConfiguration config() {
+
+ return new RepositoryRestConfiguration(new ProjectionDefinitionConfiguration(), new MetadataConfiguration(),
+ mock(EnumTranslationConfiguration.class));
+ }
+
+ @Bean
+ public DefaultFormattingConversionService defaultConversionService() {
+
+ DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
+
+ DomainClassConverter converter = new DomainClassConverter(
+ conversionService);
+ converter.setApplicationContext(appCtx);
+
+ return conversionService;
+ }
+
+ @Bean
+ public PersistentEntities persistentEntities() {
+ return new PersistentEntities(mappingContexts);
+ }
+
+ @Bean
+ public Module persistentEntityModule() {
+
+ RepositoryResourceMappings mappings = new RepositoryResourceMappings(repositories(), persistentEntities(),
+ config().getRepositoryDetectionStrategy());
+ EntityLinks entityLinks = new RepositoryEntityLinks(repositories(), mappings, config(),
+ mock(PagingAndSortingTemplateVariables.class),
+ OrderAwarePluginRegistry., BackendIdConverter> create(Arrays.asList(DefaultIdConverter.INSTANCE)));
+ SelfLinkProvider selfLinkProvider = new DefaultSelfLinkProvider(persistentEntities(), entityLinks,
+ Collections.> emptyList());
+
+ DefaultRepositoryInvokerFactory invokerFactory = new DefaultRepositoryInvokerFactory(repositories());
+ UriToEntityConverter uriToEntityConverter = new UriToEntityConverter(persistentEntities(), invokerFactory,
+ repositories());
+
+ Associations associations = new Associations(mappings, config());
+ LinkCollector collector = new LinkCollector(persistentEntities(), selfLinkProvider, associations);
+
+ NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities(),
+ new EmbeddedResourcesAssembler(persistentEntities(), associations, mock(ExcerptProjector.class)),
+ new ResourceProcessorInvoker(Collections.> emptyList()));
+
+ return new PersistentEntityJackson2Module(associations, persistentEntities(), uriToEntityConverter, collector,
+ invokerFactory, nestedEntitySerializer, mock(LookupObjectSerializer.class));
+ }
+
+ @Bean
+ public ObjectMapper objectMapper() {
+
+ RelProvider relProvider = new EvoInflectorRelProvider();
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper.registerModule(new Jackson2HalModule());
+ mapper.registerModule(persistentEntityModule());
+ mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(relProvider, null, null));
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.setSerializationInclusion(Include.NON_EMPTY);
+
+ return mapper;
+ }
+}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RequestParameters.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RequestParameters.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RequestParameters.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RequestParameters.java
index 4c9505f81..e21f9a6a6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RequestParameters.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/RequestParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+package org.springframework.data.rest.tests;
import java.util.Collections;
import java.util.HashMap;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ResourceTester.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/ResourceTester.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ResourceTester.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/ResourceTester.java
index 8d0901936..98bb6bb76 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ResourceTester.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/ResourceTester.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+package org.springframework.data.rest.tests;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/TestMvcClient.java b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/TestMvcClient.java
similarity index 99%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/TestMvcClient.java
rename to spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/TestMvcClient.java
index 21f928863..99e60b7e8 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/TestMvcClient.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/java/org/springframework/data/rest/tests/TestMvcClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+package org.springframework.data.rest.tests;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
diff --git a/spring-data-rest-tests/spring-data-rest-tests-core/src/test/resources/logback.xml b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/resources/logback.xml
new file mode 100644
index 000000000..7a648be10
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-core/src/test/resources/logback.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ %d %5p %40.40c:%4L - %m%n
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-data-rest-tests/spring-data-rest-tests-gemfire/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-gemfire/pom.xml
new file mode 100644
index 000000000..08dd56ddc
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/pom.xml
@@ -0,0 +1,34 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests - Gemfire
+ spring-data-rest-tests-gemfire
+
+
+
+
+ org.springframework.data
+ spring-data-rest-tests-core
+ 2.5.0.BUILD-SNAPSHOT
+ test-jar
+
+
+
+
+
+ org.springframework.data
+ spring-data-gemfire
+ ${springdata.gemfire}
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/AbstractPersistentEntity.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/AbstractPersistentEntity.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/AbstractPersistentEntity.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/AbstractPersistentEntity.java
index 25a786161..3152e9e45 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/AbstractPersistentEntity.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/AbstractPersistentEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import org.springframework.data.annotation.Id;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Address.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Address.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Address.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Address.java
index cf400153e..71b8b6b3f 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Address.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Address.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import org.springframework.util.Assert;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Customer.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Customer.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Customer.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Customer.java
index d5aec3b0b..f0a0b1580 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Customer.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Customer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.Collections;
import java.util.HashSet;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/CustomerRepository.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/CustomerRepository.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/CustomerRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/CustomerRepository.java
index 894b1cd2b..8d8c59314 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/CustomerRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/CustomerRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2013 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.List;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/EmailAddress.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/EmailAddress.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/EmailAddress.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/EmailAddress.java
index 7424f9aed..d51d68646 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/EmailAddress.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/EmailAddress.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.regex.Pattern;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/LineItem.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/LineItem.java
similarity index 95%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/LineItem.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/LineItem.java
index d6371353d..f0aa32d0f 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/LineItem.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/LineItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.math.BigDecimal;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Order.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Order.java
similarity index 90%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Order.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Order.java
index 5906a72fa..489301c3e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Order.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Order.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.math.BigDecimal;
import java.util.Collections;
@@ -36,7 +36,7 @@ public class Order extends AbstractPersistentEntity {
private Set lineItems = new HashSet();
/**
- * Creates a new {@link Order} for the given {@link org.springframework.data.rest.webmvc.gemfire.Customer}.
+ * Creates a new {@link Order} for the given {@link org.springframework.data.rest.tests.gemfire.Customer}.
*
* @param id order ID
* @param customerId must not be {@literal null}.
@@ -63,7 +63,7 @@ public class Order extends AbstractPersistentEntity {
}
/**
- * Returns the id of the {@link org.springframework.data.rest.webmvc.gemfire.Customer} who placed the
+ * Returns the id of the {@link org.springframework.data.rest.tests.gemfire.Customer} who placed the
* {@link Order}.
*
* @return
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/OrderRepository.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/OrderRepository.java
similarity index 88%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/OrderRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/OrderRepository.java
index 36bedfd4d..1d28a5efe 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/OrderRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/OrderRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.List;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Product.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Product.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Product.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Product.java
index 9eab50c15..2909642fe 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/Product.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Product.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.math.BigDecimal;
import java.util.Collections;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/ProductRepository.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/ProductRepository.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/ProductRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/ProductRepository.java
index 86d2d7a1f..1e0223c27 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/ProductRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/ProductRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2013 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.List;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireRepositoryConfig.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireRepositoryConfig.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireRepositoryConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireRepositoryConfig.java
index cc2d542f4..30e6f7581 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireRepositoryConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireRepositoryConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireWebTests.java
similarity index 86%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireWebTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireWebTests.java
index 15c982471..4bfd988e6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/gemfire/GemfireWebTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/java/org/springframework/data/rest/tests/gemfire/GemfireWebTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.gemfire;
+package org.springframework.data.rest.tests.gemfire;
import java.util.Arrays;
-import org.springframework.data.rest.webmvc.CommonWebTests;
+import org.springframework.data.rest.tests.CommonWebTests;
import org.springframework.test.context.ContextConfiguration;
/**
diff --git a/spring-data-rest-webmvc/src/test/resources/META-INF/spring/cache-config.xml b/spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/resources/META-INF/spring/cache-config.xml
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/META-INF/spring/cache-config.xml
rename to spring-data-rest-tests/spring-data-rest-tests-gemfire/src/test/resources/META-INF/spring/cache-config.xml
diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-jpa/pom.xml
new file mode 100644
index 000000000..2720b63dc
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/pom.xml
@@ -0,0 +1,66 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests - JPA
+ spring-data-rest-tests-jpa
+
+
+ 4.0.1.RELEASE
+
+
+
+
+
+ org.springframework.data
+ spring-data-rest-tests-core
+ 2.5.0.BUILD-SNAPSHOT
+ test-jar
+
+
+
+
+
+ org.springframework.data
+ spring-data-jpa
+ ${springdata.jpa}
+
+
+
+ org.hibernate
+ hibernate-entitymanager
+ ${hibernate.version}
+ test
+
+
+
+ org.hsqldb
+ hsqldb
+ 2.3.2
+ test
+
+
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-hibernate4
+ ${jackson}
+
+
+
+ org.hibernate
+ hibernate-core
+ ${hibernate.version}
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Address.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Address.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Address.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Address.java
index 1ae854732..c696f3a07 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Address.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Address.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java
index fbaed5355..5370fed4e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AddressRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Author.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Author.java
similarity index 95%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Author.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Author.java
index 4ff8be183..a8cd88cc3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Author.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Author.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java
index e30d94de1..3be066136 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java
index 5f425c79d..b9434d553 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/AuthorsController.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Book.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Book.java
similarity index 83%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Book.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Book.java
index 86bf1680b..2a9d75c55 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Book.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Book.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -32,13 +32,12 @@ import org.springframework.data.rest.core.annotation.RestResource;
@Entity
public class Book {
- @Id @GeneratedValue Long id;
- public String isbn;
+ public @Id @GeneratedValue Long id;
+ public String isbn, title;
- @ManyToMany(cascade = { CascadeType.MERGE })//
- @RestResource(path = "creators") public Set authors;
-
- public String title;
+ @ManyToMany(cascade = { CascadeType.MERGE }) //
+ @RestResource(path = "creators") //
+ public Set authors;
protected Book() {}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java
index ca75c35bf..dc01b80c3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookExcerpt.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java
index 1945de8f3..451dac17b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookIdConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java
index 43d277a80..74663bc01 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/BookRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2014 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java
index 8e028736d..6746d63b7 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCard.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java
index 49f50c552..086316c0e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/CreditCardRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Item.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Item.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Item.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Item.java
index d2cd28f02..c77883c0e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Item.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Item.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java
index 5e11e12ed..15dbc9676 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ItemRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/LineItem.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/LineItem.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/LineItem.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/LineItem.java
index 9377104ea..fcd508e8c 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/LineItem.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/LineItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Order.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Order.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Order.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Order.java
index 97476b3cf..1b66c1b65 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Order.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Order.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java
similarity index 95%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java
index f610e8980..d2b529df6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java
index f650250c8..d38ae6961 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/OrderSummary.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Person.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Person.java
similarity index 98%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Person.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Person.java
index a3060a5a8..de7553a31 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Person.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Person.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java
index bc22c6090..ef311392e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java
index 10494595f..a7af5e60c 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/PersonSummary.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Receipt.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Receipt.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Receipt.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Receipt.java
index 9472a1a20..981b8d188 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Receipt.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Receipt.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -16,13 +16,18 @@
package org.springframework.data.rest.webmvc.jpa;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-import javax.persistence.*;
-import javax.persistence.Entity;
import java.math.BigDecimal;
import java.util.Date;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
/**
* An entity that represents a receipt.
*
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java
index 79b12e2f4..fb42e7188 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/ReceiptRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Type.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Type.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Type.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Type.java
index f95a48092..a221edf7b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/Type.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/Type.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/User.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/User.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/User.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/User.java
index f184abceb..b7f2240e3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/User.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java
index 592488589..3200c17ff 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserExcerpt.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java
index d03ae4b15..9d24786f3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/main/java/org/springframework/data/rest/webmvc/jpa/UserRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java
index 3081e49a2..e5a255191 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryControllerIntegrationTests.java
@@ -17,10 +17,11 @@ package org.springframework.data.rest.webmvc;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import static org.springframework.data.rest.webmvc.TestMvcClient.*;
+import static org.springframework.data.rest.tests.TestMvcClient.*;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java
similarity index 98%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java
index 0f2ba0f73..f1df4d4bc 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryEntityControllerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -18,7 +18,7 @@ package org.springframework.data.rest.webmvc;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-import static org.springframework.data.rest.webmvc.TestMvcClient.*;
+import static org.springframework.data.rest.tests.TestMvcClient.*;
import static org.springframework.http.HttpMethod.*;
import java.util.List;
@@ -31,6 +31,7 @@ import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
import org.springframework.data.repository.support.RepositoryInvoker;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.Address;
import org.springframework.data.rest.webmvc.jpa.AddressRepository;
import org.springframework.data.rest.webmvc.jpa.CreditCard;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java
similarity index 79%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java
index c8480e016..cebe784f7 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceControllerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -22,7 +22,9 @@ import static org.mockito.Mockito.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.Book;
+import org.springframework.data.rest.webmvc.jpa.BookRepository;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.data.rest.webmvc.jpa.TestDataPopulator;
import org.springframework.http.HttpStatus;
@@ -38,6 +40,7 @@ public class RepositoryPropertyReferenceControllerIntegrationTests extends Abstr
@Autowired RepositoryPropertyReferenceController controller;
@Autowired TestDataPopulator populator;
+ @Autowired BookRepository books;
PersistentEntityResourceAssembler assembler;
RootResourceInformation information;
@@ -52,12 +55,18 @@ public class RepositoryPropertyReferenceControllerIntegrationTests extends Abstr
@Test
public void exposesResourceForCustomizedPropertyResourcePath() throws Exception {
- assertThat(controller.followPropertyReference(information, 1L, "creators", assembler).getStatusCode(),
+
+ Book book = books.findAll().iterator().next();
+
+ assertThat(controller.followPropertyReference(information, book.id, "creators", assembler).getStatusCode(),
is(HttpStatus.OK));
}
@Test(expected = ResourceNotFoundException.class)
public void doesNotExposeOriginalPathIfPropertyResourcePathIsCustomized() throws Exception {
- controller.followPropertyReference(information, 1L, "authors", assembler);
+
+ Book book = books.findAll().iterator().next();
+
+ controller.followPropertyReference(information, book.id, "authors", assembler);
}
}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java
similarity index 95%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java
index 9e271cf06..3edd5aa8a 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RepositorySearchControllerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -17,14 +17,16 @@ package org.springframework.data.rest.webmvc;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
-import static org.springframework.data.rest.webmvc.TestMvcClient.*;
+import static org.springframework.data.rest.tests.TestMvcClient.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.rest.core.mapping.ResourceMetadata;
-import org.springframework.data.rest.webmvc.ResourceTester.HasSelfLink;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.ResourceTester;
+import org.springframework.data.rest.tests.ResourceTester.HasSelfLink;
import org.springframework.data.rest.webmvc.jpa.Address;
import org.springframework.data.rest.webmvc.jpa.Author;
import org.springframework.data.rest.webmvc.jpa.Book;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java
index b0b36aa16..0a5a6e167 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -23,6 +23,7 @@ import static org.springframework.http.HttpMethod.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.rest.core.mapping.SupportedHttpMethods;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.Address;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.test.context.ContextConfiguration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java
index 893557025..08ed68b61 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/alps/AlpsControllerIntegrationTests.java
@@ -26,10 +26,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
-import org.springframework.data.rest.webmvc.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.TestMvcClient;
import org.springframework.data.rest.webmvc.ProfileController;
import org.springframework.data.rest.webmvc.RestMediaTypes;
-import org.springframework.data.rest.webmvc.TestMvcClient;
+import org.springframework.data.rest.webmvc.alps.AlpsController;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
import org.springframework.data.rest.webmvc.jpa.Item;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java
similarity index 98%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java
index 48d7376f8..3422260b9 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest262Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/DuplicateLinkListingTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest363Tests.java
similarity index 82%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/DuplicateLinkListingTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest363Tests.java
index 8b81a48df..d5846d13b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/DuplicateLinkListingTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/DataRest363Tests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+package org.springframework.data.rest.webmvc.jpa;
import static org.hamcrest.Matchers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
@@ -26,11 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.tests.TestMvcClient;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
-import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
-import org.springframework.data.rest.webmvc.jpa.Person;
-import org.springframework.data.rest.webmvc.jpa.PersonRepository;
import org.springframework.hateoas.LinkDiscoverer;
import org.springframework.hateoas.LinkDiscoverers;
import org.springframework.hateoas.core.JsonPathLinkDiscoverer;
@@ -51,9 +49,9 @@ import org.springframework.web.context.WebApplicationContext;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
-@ContextConfiguration(classes = { JpaRepositoryConfig.class, RepositoryRestMvcConfiguration.class,
- DuplicateLinkListingTests.Config.class })
-public class DuplicateLinkListingTests {
+@ContextConfiguration(
+ classes = { JpaRepositoryConfig.class, RepositoryRestMvcConfiguration.class, DataRest363Tests.Config.class })
+public class DataRest363Tests {
private static MediaType MEDIA_TYPE = MediaType.APPLICATION_JSON;
@@ -63,6 +61,8 @@ public class DuplicateLinkListingTests {
TestMvcClient testMvcClient;
+ Person frodo;
+
@Configuration
static class Config extends RepositoryRestConfigurerAdapter {
@@ -82,9 +82,9 @@ public class DuplicateLinkListingTests {
MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).//
defaultRequest(get("/")).build();
- testMvcClient = new TestMvcClient(mvc, discoverers);
- personRepository.save(new Person("Frodo", "Baggins"));
+ this.testMvcClient = new TestMvcClient(mvc, discoverers);
+ this.frodo = personRepository.save(new Person("Frodo", "Baggins"));
}
/**
@@ -93,7 +93,7 @@ public class DuplicateLinkListingTests {
@Test
public void testBasics() throws Exception {
- ResultActions frodoActions = testMvcClient.follow("/people/1");
+ ResultActions frodoActions = testMvcClient.follow("/people/".concat(frodo.getId().toString()));
frodoActions.andExpect(jsonPath("$.links").value(hasSize(4)));
}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java
index 3181b94e0..18147b101 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaInfrastructureConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java
index bff2b0c21..c25756e13 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaRepositoryConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
similarity index 99%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
index 35ca5ce37..e6e63773b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/JpaWebTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -35,7 +35,7 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.core.mapping.ResourceMappings;
-import org.springframework.data.rest.webmvc.CommonWebTests;
+import org.springframework.data.rest.tests.CommonWebTests;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;
import org.springframework.hateoas.RelProvider;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ProfileIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/ProfileIntegrationTests.java
similarity index 81%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ProfileIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/ProfileIntegrationTests.java
index 2f24d66d6..3a1f33d7e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/ProfileIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/ProfileIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc;
+package org.springframework.data.rest.webmvc.jpa;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@@ -21,12 +21,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import org.junit.Before;
import org.junit.Test;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.TestMvcClient;
+import org.springframework.data.rest.webmvc.ProfileController;
+import org.springframework.data.rest.webmvc.ProfileResourceProcessor;
+import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
-import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkDiscoverers;
import org.springframework.http.HttpHeaders;
@@ -38,14 +41,14 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
/**
- * Series of tests to verify {@link ProfileController} serves ALPS and JSON Schema metadata from the root level and
- * at collection resource levels.
+ * Series of tests to verify {@link ProfileController} serves ALPS and JSON Schema metadata from the root level and at
+ * collection resource levels.
*
* @author Greg Turnquist
* @since 2.4
*/
@WebAppConfiguration
-@ContextConfiguration(classes = { JpaRepositoryConfig.class, ProfileIntegrationTests.Config.class})
+@ContextConfiguration(classes = { JpaRepositoryConfig.class, ProfileIntegrationTests.Config.class })
public class ProfileIntegrationTests extends AbstractControllerIntegrationTests {
@Autowired WebApplicationContext context;
@@ -102,8 +105,6 @@ public class ProfileIntegrationTests extends AbstractControllerIntegrationTests
assertThat(client.discoverUnique(profileLink, "addresses", MediaType.ALL), is(notNullValue()));
}
-
-
/**
* @see DATAREST-638
*/
@@ -113,13 +114,11 @@ public class ProfileIntegrationTests extends AbstractControllerIntegrationTests
Link peopleLink = client.discoverUnique(new Link(ROOT_URI), "people");
Link profileLink = client.discoverUnique(peopleLink, ProfileResourceProcessor.PROFILE_REL);
- client.follow(profileLink, RestMediaTypes.ALPS_JSON)
- .andExpect(status().is2xxSuccessful())
- .andExpect(header().string(HttpHeaders.CONTENT_TYPE, RestMediaTypes.ALPS_JSON_VALUE));
+ client.follow(profileLink, RestMediaTypes.ALPS_JSON).andExpect(status().is2xxSuccessful())
+ .andExpect(header().string(HttpHeaders.CONTENT_TYPE, RestMediaTypes.ALPS_JSON_VALUE));
- client.follow(profileLink, RestMediaTypes.SCHEMA_JSON)
- .andExpect(status().is2xxSuccessful())
- .andExpect(header().string(HttpHeaders.CONTENT_TYPE, RestMediaTypes.SCHEMA_JSON_VALUE));
+ client.follow(profileLink, RestMediaTypes.SCHEMA_JSON).andExpect(status().is2xxSuccessful())
+ .andExpect(header().string(HttpHeaders.CONTENT_TYPE, RestMediaTypes.SCHEMA_JSON_VALUE));
}
}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java
index f617922d5..2dfcbb2b0 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/TestDataPopulator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClass.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClass.java
similarity index 100%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClass.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClass.java
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java
index 4b3c29fc2..9d953cd8e 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/jpa/groovy/SimulatedGroovyDomainClassRepository.java
@@ -16,6 +16,7 @@
package org.springframework.data.rest.webmvc.jpa.groovy;
import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.rest.webmvc.jpa.groovy.SimulatedGroovyDomainClass;
/**
* Simulates a repository built on a Groovy domain object.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java
similarity index 92%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java
index 004957673..bfdd51638 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/Jackson2DatatypeHelperIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -29,6 +29,7 @@ import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
+import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.data.rest.webmvc.jpa.Order;
import org.springframework.data.rest.webmvc.jpa.OrderRepository;
import org.springframework.data.rest.webmvc.jpa.Person;
@@ -45,7 +46,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { RepositoryTestsConfig.class, RepositoryRestMvcConfiguration.class })
+@ContextConfiguration(classes = { JpaRepositoryConfig.class, RepositoryRestMvcConfiguration.class })
@Transactional
public class Jackson2DatatypeHelperIntegrationTests {
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
similarity index 88%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
index 77b6fb3a4..0f02b3b68 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -36,6 +36,7 @@ import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
+import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.data.rest.webmvc.jpa.LineItem;
import org.springframework.data.rest.webmvc.jpa.Order;
import org.springframework.data.rest.webmvc.jpa.OrderRepository;
@@ -43,9 +44,6 @@ import org.springframework.data.rest.webmvc.jpa.Person;
import org.springframework.data.rest.webmvc.jpa.PersonRepository;
import org.springframework.data.rest.webmvc.jpa.PersonSummary;
import org.springframework.data.rest.webmvc.jpa.UserExcerpt;
-import org.springframework.data.rest.webmvc.mongodb.Address;
-import org.springframework.data.rest.webmvc.mongodb.User;
-import org.springframework.data.rest.webmvc.mongodb.User.Gender;
import org.springframework.data.rest.webmvc.util.TestUtils;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkDiscoverer;
@@ -74,7 +72,7 @@ import com.jayway.jsonpath.JsonPath;
* @author Oliver Gierke
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { RepositoryTestsConfig.class, PersistentEntitySerializationTests.TestConfig.class })
+@ContextConfiguration(classes = { JpaRepositoryConfig.class, PersistentEntitySerializationTests.TestConfig.class })
@Transactional
public class PersistentEntitySerializationTests {
@@ -205,29 +203,6 @@ public class PersistentEntitySerializationTests {
assertThat(order.getLineItems(), hasSize(2));
}
- /**
- * @see DATAREST-250
- */
- @Test
- public void serializesEmbeddedReferencesCorrectly() throws Exception {
-
- User user = new User();
- user.address = new Address();
- user.address.street = "Street";
-
- PersistentEntityResource userResource = PersistentEntityResource.//
- build(user, repositories.getPersistentEntity(User.class)).//
- withLink(new Link("/users/1")).//
- build();
-
- PagedResources persistentEntityResource = new PagedResources(
- Arrays.asList(userResource), new PageMetadata(1, 0, 10));
-
- String result = mapper.writeValueAsString(persistentEntityResource);
-
- assertThat(JsonPath.read(result, "$_embedded.users[*].address"), is(notNullValue()));
- }
-
/**
* @see DATAREST-250
*/
@@ -298,14 +273,6 @@ public class PersistentEntitySerializationTests {
assertThat(JsonPath.read(result, "$_links.processed"), is(notNullValue()));
}
- /**
- * @see DATAREST-654
- */
- @Test
- public void deserializesTranslatedEnumProperty() throws Exception {
- assertThat(mapper.readValue("{ \"gender\" : \"Male\" }", User.class).gender, is(Gender.MALE));
- }
-
/**
* @see DATAREST-697
*/
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java
index 801831019..f766313fb 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/json/RepositoryTestsConfig.java
@@ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.repository.support.DefaultRepositoryInvokerFactory;
@@ -42,14 +41,12 @@ import org.springframework.data.rest.core.support.EntityLookup;
import org.springframework.data.rest.core.support.SelfLinkProvider;
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
-import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.data.rest.webmvc.jpa.Person;
import org.springframework.data.rest.webmvc.jpa.PersonRepository;
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.LookupObjectSerializer;
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.mapping.LinkCollector;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
import org.springframework.data.rest.webmvc.spi.BackendIdConverter;
import org.springframework.data.rest.webmvc.spi.BackendIdConverter.DefaultIdConverter;
import org.springframework.data.rest.webmvc.support.ExcerptProjector;
@@ -75,7 +72,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
* @author Oliver Gierke
*/
@Configuration
-@Import({ JpaRepositoryConfig.class, MongoDbRepositoryConfig.class })
@SuppressWarnings("deprecation")
public class RepositoryTestsConfig {
@@ -132,7 +128,7 @@ public class RepositoryTestsConfig {
UriToEntityConverter uriToEntityConverter = new UriToEntityConverter(persistentEntities(), invokerFactory,
repositories());
- AssociationLinks associations = new AssociationLinks(mappings, config());
+ Associations associations = new Associations(mappings, config());
LinkCollector collector = new LinkCollector(persistentEntities(), selfLinkProvider, associations);
NestedEntitySerializer nestedEntitySerializer = new NestedEntitySerializer(persistentEntities(),
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java
index d69100e9a..3ca0549bc 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/BackendIdConverterHandlerMethodArgumentResolverIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -24,7 +24,7 @@ import java.lang.reflect.Method;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter;
-import org.springframework.data.rest.webmvc.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java
similarity index 95%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java
index da2d84b27..241bf4344 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/ExceptionHandlingCustomizationIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -23,7 +23,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
-import org.springframework.data.rest.webmvc.AbstractWebIntegrationTests;
+import org.springframework.data.rest.tests.AbstractWebIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.hateoas.Link;
import org.springframework.http.HttpHeaders;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java
index 09d12b42c..291b828a3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryEntityLinksIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -23,7 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
-import org.springframework.data.rest.webmvc.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.Book;
import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
import org.springframework.data.rest.webmvc.jpa.Order;
diff --git a/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java
new file mode 100644
index 000000000..600f5a357
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014-2016 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.data.rest.webmvc.util;
+
+import java.nio.charset.Charset;
+import java.util.Scanner;
+
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.data.rest.webmvc.jpa.JpaWebTests;
+
+/**
+ * Test helper methods.
+ *
+ * @author Oliver Gierke
+ * @author Christoph Strobl
+ */
+public class TestUtils {
+
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+
+ public static String readFileFromClasspath(String name) throws Exception {
+
+ ClassPathResource file = new ClassPathResource(name, JpaWebTests.class);
+ StringBuilder builder = new StringBuilder();
+
+ Scanner scanner = new Scanner(file.getFile(), UTF8.name());
+
+ try {
+
+ while (scanner.hasNextLine()) {
+ builder.append(scanner.nextLine());
+ }
+
+ } finally {
+ scanner.close();
+ }
+
+ return builder.toString();
+ }
+}
diff --git a/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/jpa/order.json b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/resources/org/springframework/data/rest/webmvc/jpa/order.json
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/jpa/order.json
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/resources/org/springframework/data/rest/webmvc/jpa/order.json
diff --git a/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/jpa/person.json b/spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/resources/org/springframework/data/rest/webmvc/jpa/person.json
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/jpa/person.json
rename to spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/resources/org/springframework/data/rest/webmvc/jpa/person.json
diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml
new file mode 100644
index 000000000..61610f0b7
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/pom.xml
@@ -0,0 +1,90 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests - MongoDB
+ spring-data-rest-tests-mongodb
+
+
+
+
+ org.springframework.data
+ spring-data-rest-tests-core
+ 2.5.0.BUILD-SNAPSHOT
+ test-jar
+
+
+
+
+
+ org.springframework.data
+ spring-data-mongodb
+ ${springdata.mongodb}
+
+
+
+ com.querydsl
+ querydsl-mongodb
+ ${querydsl}
+ test
+
+
+
+
+
+ com.querydsl
+ querydsl-core
+ ${querydsl}
+
+
+
+ joda-time
+ joda-time
+ ${jodatime}
+ true
+
+
+
+
+
+
+
+ com.mysema.maven
+ apt-maven-plugin
+ ${apt}
+
+
+ com.querydsl
+ querydsl-apt
+ ${querydsl}
+
+
+
+
+ sources
+ generate-sources
+
+ process
+
+
+ target/generated-sources/annotations
+ org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor
+ true
+
+ org.springframework.data.rest.tests.mongodb.groovy,groovy.lang
+
+
+
+
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Address.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Address.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Address.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Address.java
index 41c5f6ca4..73f3a4c8d 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Address.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Address.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Profile.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Profile.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Profile.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Profile.java
index f82ac1e90..aa720711a 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Profile.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Profile.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import java.util.Date;
import java.util.HashMap;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ProfileRepository.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ProfileRepository.java
similarity index 90%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ProfileRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ProfileRepository.java
index bedd42ed5..69a85953a 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ProfileRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ProfileRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import java.util.List;
import java.util.Optional;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Receipt.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Receipt.java
similarity index 91%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Receipt.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Receipt.java
index aea269a93..4b5d3b961 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/Receipt.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/Receipt.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import java.math.BigDecimal;
import java.util.Date;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ReceiptRepository.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ReceiptRepository.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ReceiptRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ReceiptRepository.java
index 275027c1a..38af7b45a 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/ReceiptRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/ReceiptRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import org.springframework.data.repository.CrudRepository;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/User.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/User.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/User.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/User.java
index 59512c3a2..0a8304484 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/User.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import java.math.BigInteger;
import java.time.LocalDateTime;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserRepository.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserRepository.java
similarity index 90%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserRepository.java
index dbabad4c4..8d81a0063 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import java.math.BigInteger;
import java.util.List;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserSummary.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserSummary.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserSummary.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserSummary.java
index 6eb6b7cc4..3cde1cee0 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/UserSummary.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/UserSummary.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import org.springframework.data.rest.core.config.Projection;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClass.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClass.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClass.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClass.java
index f01b65d8e..73daf8472 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClass.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClass.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb.groovy;
+package org.springframework.data.rest.tests.mongodb.groovy;
import groovy.lang.GroovyObject;
import groovy.lang.MetaClass;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClassRepository.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClassRepository.java
similarity index 88%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClassRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClassRepository.java
index f25dacf64..c4685bc97 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/groovy/SimulatedGroovyDomainClassRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/main/java/org/springframework/data/rest/tests/mongodb/groovy/SimulatedGroovyDomainClassRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb.groovy;
+package org.springframework.data.rest.tests.mongodb.groovy;
import org.springframework.data.repository.CrudRepository;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoDbRepositoryConfig.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoDbRepositoryConfig.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoDbRepositoryConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoDbRepositoryConfig.java
index db016f9eb..781e1f386 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoDbRepositoryConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoDbRepositoryConfig.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java
similarity index 90%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoWebTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java
index 45ccb4d81..45b2de90b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mongodb/MongoWebTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/MongoWebTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.mongodb;
+package org.springframework.data.rest.tests.mongodb;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@@ -29,7 +29,13 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.rest.webmvc.CommonWebTests;
+import org.springframework.data.rest.tests.CommonWebTests;
+import org.springframework.data.rest.tests.mongodb.Address;
+import org.springframework.data.rest.tests.mongodb.Profile;
+import org.springframework.data.rest.tests.mongodb.ProfileRepository;
+import org.springframework.data.rest.tests.mongodb.Receipt;
+import org.springframework.data.rest.tests.mongodb.User;
+import org.springframework.data.rest.tests.mongodb.UserRepository;
import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks;
import org.springframework.hateoas.Link;
@@ -164,7 +170,7 @@ public class MongoWebTests extends CommonWebTests {
MockHttpServletResponse response = patchAndGet(userLink,
"[{ \"op\": \"replace\", \"path\": \"/address/zipCode\", \"value\": \"ZIP\" },"
- // + "{ \"op\": \"replace\", \"path\": \"/lastname\", \"value\": null }]", //
+ // + "{ \"op\": \"replace\", \"path\": \"/lastname\", \"value\": null }]", //
+ "{ \"op\": \"remove\", \"path\": \"/lastname\" }]", //
RestMediaTypes.JSON_PATCH_JSON);
@@ -193,15 +199,13 @@ public class MongoWebTests extends CommonWebTests {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(tacosLink.getHref());
String concurrencyTag = createdReceipt.getHeader("ETag");
- mvc.perform(
- patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyBurritos\" }")
- .contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag)).andExpect(
- status().is2xxSuccessful());
+ mvc.perform(patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyBurritos\" }")
+ .contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag))
+ .andExpect(status().is2xxSuccessful());
- mvc.perform(
- patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyTequila\" }")
- .contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag)).andExpect(
- status().isPreconditionFailed());
+ mvc.perform(patch(builder.build().toUriString()).content("{ \"saleItem\" : \"SpringyTequila\" }")
+ .contentType(MediaType.APPLICATION_JSON).header(IF_MATCH, concurrencyTag))
+ .andExpect(status().isPreconditionFailed());
}
/**
diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/TestUtils.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/TestUtils.java
new file mode 100644
index 000000000..40d46e52e
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/tests/mongodb/TestUtils.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014-2016 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.data.rest.tests.mongodb;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import org.springframework.util.Assert;
+
+/**
+ * Test helper methods.
+ *
+ * @author Oliver Gierke
+ * @author Christoph Strobl
+ */
+public class TestUtils {
+
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+
+ /**
+ * Returns the given {@link String} as {@link InputStream}.
+ *
+ * @param source must not be {@literal null}.
+ * @return
+ */
+ public static InputStream asStream(String source) {
+ Assert.notNull(source, "Source string must not be null!");
+ return new ByteArrayInputStream(source.getBytes(UTF8));
+ }
+}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java
similarity index 86%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java
index 17d8246e2..caffe13f1 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssemblerIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -31,10 +31,11 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.support.DefaultSelfLinkProvider;
import org.springframework.data.rest.core.support.EntityLookup;
-import org.springframework.data.rest.webmvc.AbstractControllerIntegrationTests.TestConfiguration;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
-import org.springframework.data.rest.webmvc.mongodb.User;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests.TestConfiguration;
+import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
+import org.springframework.data.rest.tests.mongodb.User;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.Projector;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.Link;
@@ -54,7 +55,7 @@ public class PersistentEntityResourceAssemblerIntegrationTests extends AbstractC
@Autowired PersistentEntities entities;
@Autowired EntityLinks entityLinks;
@Autowired @Qualifier("objectMapper") ObjectMapper objectMapper;
- @Autowired AssociationLinks associations;
+ @Autowired Associations associations;
/**
* @see DATAREST-609
@@ -74,7 +75,6 @@ public class PersistentEntityResourceAssemblerIntegrationTests extends AbstractC
PersistentEntityResource resource = assembler.toResource(user);
- System.out.println(objectMapper.writeValueAsString(resource));
Links links = new Links(resource.getLinks());
assertThat(links, is(Matchers. iterableWithSize(2)));
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java
similarity index 91%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java
index b1a2e8563..d46c96baf 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestHandlerMappingIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -20,7 +20,8 @@ import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
+import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
+import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
import org.springframework.data.rest.webmvc.support.DelegatingHandlerMapping;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java
index f3732f722..b907c12d4 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/AbstractRepositoryRestMvcConfigurationIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java
similarity index 90%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java
index e29fbbb75..b8cd4ba4c 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/JsonPatchHandlerUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -18,7 +18,7 @@ package org.springframework.data.rest.webmvc.config;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-import static org.springframework.data.rest.webmvc.util.TestUtils.*;
+import static org.springframework.data.rest.tests.mongodb.TestUtils.*;
import java.util.Arrays;
@@ -33,11 +33,11 @@ import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.mapping.ResourceMappings;
+import org.springframework.data.rest.tests.mongodb.Address;
+import org.springframework.data.rest.tests.mongodb.User;
import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.json.DomainObjectReader;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
-import org.springframework.data.rest.webmvc.mongodb.Address;
-import org.springframework.data.rest.webmvc.mongodb.User;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.http.converter.HttpMessageNotReadableException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -64,7 +64,7 @@ public class JsonPatchHandlerUnitTests {
PersistentEntities entities = new PersistentEntities(Arrays.asList(context));
- AssociationLinks associations = new AssociationLinks(mappings, mock(RepositoryRestConfiguration.class));
+ Associations associations = new Associations(mappings, mock(RepositoryRestConfiguration.class));
this.handler = new JsonPatchHandler(new ObjectMapper(), new DomainObjectReader(entities, associations));
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java
index edc515ab6..abd825088 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/LegacyRepresentationConfigIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -25,7 +25,7 @@ import org.junit.Test;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
+import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java
index 71e2b0c4f..de38afbc5 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/config/QuerydslAwareRootResourceInformationHandlerMethodArgumentResolverUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -41,10 +41,10 @@ import org.springframework.data.querydsl.binding.QuerydslPredicateBuilder;
import org.springframework.data.repository.support.Repositories;
import org.springframework.data.repository.support.RepositoryInvoker;
import org.springframework.data.repository.support.RepositoryInvokerFactory;
-import org.springframework.data.rest.webmvc.mongodb.QUser;
-import org.springframework.data.rest.webmvc.mongodb.Receipt;
-import org.springframework.data.rest.webmvc.mongodb.ReceiptRepository;
-import org.springframework.data.rest.webmvc.mongodb.User;
+import org.springframework.data.rest.tests.mongodb.QUser;
+import org.springframework.data.rest.tests.mongodb.Receipt;
+import org.springframework.data.rest.tests.mongodb.ReceiptRepository;
+import org.springframework.data.rest.tests.mongodb.User;
import org.springframework.test.util.ReflectionTestUtils;
/**
diff --git a/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
new file mode 100644
index 000000000..efbb2de6e
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntitySerializationTests.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2012-2016 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.data.rest.webmvc.json;
+
+import static org.hamcrest.MatcherAssert.*;
+import static org.hamcrest.Matchers.*;
+
+import java.util.Arrays;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.support.MessageSourceAccessor;
+import org.springframework.context.support.StaticMessageSource;
+import org.springframework.data.projection.ProjectionFactory;
+import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
+import org.springframework.data.repository.support.Repositories;
+import org.springframework.data.rest.tests.RepositoryTestsConfig;
+import org.springframework.data.rest.tests.mongodb.Address;
+import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
+import org.springframework.data.rest.tests.mongodb.User;
+import org.springframework.data.rest.tests.mongodb.User.Gender;
+import org.springframework.data.rest.webmvc.PersistentEntityResource;
+import org.springframework.hateoas.Link;
+import org.springframework.hateoas.LinkDiscoverer;
+import org.springframework.hateoas.PagedResources;
+import org.springframework.hateoas.PagedResources.PageMetadata;
+import org.springframework.hateoas.hal.HalLinkDiscoverer;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletWebRequest;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jayway.jsonpath.JsonPath;
+
+/**
+ * Integration tests for entity (de)serialization.
+ *
+ * @author Jon Brisbin
+ * @author Greg Turnquist
+ * @author Oliver Gierke
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = { MongoDbRepositoryConfig.class, RepositoryTestsConfig.class,
+ PersistentEntitySerializationTests.TestConfig.class })
+@Transactional
+public class PersistentEntitySerializationTests {
+
+ @Autowired ObjectMapper mapper;
+ @Autowired Repositories repositories;
+
+ @Configuration
+ static class TestConfig extends RepositoryTestsConfig {
+
+ @Bean
+ @Override
+ public ObjectMapper objectMapper() {
+
+ ObjectMapper objectMapper = super.objectMapper();
+ objectMapper.registerModule(
+ new JacksonSerializers(new EnumTranslator(new MessageSourceAccessor(new StaticMessageSource()))));
+ return objectMapper;
+ }
+ }
+
+ LinkDiscoverer linkDiscoverer;
+ ProjectionFactory projectionFactory;
+
+ @Before
+ public void setUp() {
+
+ RequestContextHolder.setRequestAttributes(new ServletWebRequest(new MockHttpServletRequest()));
+
+ this.linkDiscoverer = new HalLinkDiscoverer();
+ this.projectionFactory = new SpelAwareProxyProjectionFactory();
+ }
+
+ /**
+ * @see DATAREST-250
+ */
+ @Test
+ public void serializesEmbeddedReferencesCorrectly() throws Exception {
+
+ User user = new User();
+ user.address = new Address();
+ user.address.street = "Street";
+
+ PersistentEntityResource userResource = PersistentEntityResource.//
+ build(user, repositories.getPersistentEntity(User.class)).//
+ withLink(new Link("/users/1")).//
+ build();
+
+ PagedResources persistentEntityResource = new PagedResources(
+ Arrays.asList(userResource), new PageMetadata(1, 0, 10));
+
+ String result = mapper.writeValueAsString(persistentEntityResource);
+
+ assertThat(JsonPath.read(result, "$_embedded.users[*].address"), is(notNullValue()));
+ }
+
+ /**
+ * @see DATAREST-654
+ */
+ @Test
+ public void deserializesTranslatedEnumProperty() throws Exception {
+ assertThat(mapper.readValue("{ \"gender\" : \"Male\" }", User.class).gender, is(Gender.MALE));
+ }
+}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java
index 03ef4e77c..bcd0a92bf 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverterUnitTests.java
@@ -34,18 +34,18 @@ import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.config.JsonSchemaFormat;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
-import org.springframework.data.rest.webmvc.TestMvcClient;
+import org.springframework.data.rest.tests.TestMvcClient;
+import org.springframework.data.rest.tests.mongodb.MongoDbRepositoryConfig;
+import org.springframework.data.rest.tests.mongodb.Profile;
+import org.springframework.data.rest.tests.mongodb.User;
+import org.springframework.data.rest.tests.mongodb.User.EmailAddress;
+import org.springframework.data.rest.tests.mongodb.User.TypeWithPattern;
+import org.springframework.data.rest.tests.mongodb.groovy.SimulatedGroovyDomainClass;
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverter.ValueTypeSchemaPropertyCustomizerFactory;
import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverterUnitTests.TestConfiguration;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
-import org.springframework.data.rest.webmvc.mongodb.Profile;
-import org.springframework.data.rest.webmvc.mongodb.User;
-import org.springframework.data.rest.webmvc.mongodb.User.EmailAddress;
-import org.springframework.data.rest.webmvc.mongodb.User.TypeWithPattern;
-import org.springframework.data.rest.webmvc.mongodb.groovy.SimulatedGroovyDomainClass;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -65,7 +65,7 @@ public class PersistentEntityToJsonSchemaConverterUnitTests {
@Autowired RepositoryRestConfiguration configuration;
@Autowired PersistentEntities entities;
@Autowired @Qualifier("objectMapper") ObjectMapper objectMapper;
- @Autowired AssociationLinks associations;
+ @Autowired Associations associations;
@Configuration
@Import(RepositoryRestMvcConfiguration.class)
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java
similarity index 89%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java
index e4be423d2..bc9eeb6f6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/java/org/springframework/data/rest/webmvc/support/RepositoryLinkBuildUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -25,9 +25,9 @@ import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.rest.core.mapping.PersistentEntitiesResourceMappings;
import org.springframework.data.rest.core.mapping.ResourceMappings;
+import org.springframework.data.rest.tests.TestMvcClient;
+import org.springframework.data.rest.tests.mongodb.Profile;
import org.springframework.data.rest.webmvc.BaseUri;
-import org.springframework.data.rest.webmvc.TestMvcClient;
-import org.springframework.data.rest.webmvc.mongodb.Profile;
import org.springframework.hateoas.Link;
/**
@@ -63,8 +63,8 @@ public class RepositoryLinkBuildUnitTests {
context.getPersistentEntity(Profile.class);
ResourceMappings mappings = new PersistentEntitiesResourceMappings(new PersistentEntities(Arrays.asList(context)));
- RepositoryLinkBuilder builder = new RepositoryLinkBuilder(mappings.getMetadataFor(Profile.class), new BaseUri(
- baseUri));
+ RepositoryLinkBuilder builder = new RepositoryLinkBuilder(mappings.getMetadataFor(Profile.class),
+ new BaseUri(baseUri));
Link link = builder.withSelfRel();
assertThat(link.getHref(), is(expectedUri));
diff --git a/spring-data-rest-webmvc/src/test/resources/rest-messages.properties b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/resources/rest-messages.properties
similarity index 79%
rename from spring-data-rest-webmvc/src/test/resources/rest-messages.properties
rename to spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/resources/rest-messages.properties
index 8b5d0d9c9..601776864 100644
--- a/spring-data-rest-webmvc/src/test/resources/rest-messages.properties
+++ b/spring-data-rest-tests/spring-data-rest-tests-mongodb/src/test/resources/rest-messages.properties
@@ -8,7 +8,7 @@ address._title=Adresse
User.gender._title=Geschlecht
# Property on fully-qualified property
-org.springframework.data.rest.webmvc.mongodb.User.firstname._title=Vorname
+org.springframework.data.rest.tests.mongodb.User.firstname._title=Vorname
# Local property that should be trumped by the more precise definition above
firstname._title=emanroV
\ No newline at end of file
diff --git a/spring-data-rest-tests/spring-data-rest-tests-security/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-security/pom.xml
new file mode 100644
index 000000000..3daf47fba
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/pom.xml
@@ -0,0 +1,67 @@
+
+ 4.0.0
+
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+ ../pom.xml
+
+
+ Spring Data REST Tests - Security
+ spring-data-rest-tests-security
+
+
+ 4.0.1.RELEASE
+
+
+
+
+
+ org.springframework.data
+ spring-data-rest-tests-core
+ 2.5.0.BUILD-SNAPSHOT
+ test-jar
+
+
+
+ org.springframework.data
+ spring-data-keyvalue
+ ${springdata.keyvalue}
+ test
+
+
+
+
+
+ org.springframework.security
+ spring-security-core
+ ${spring-security.version}
+ test
+
+
+
+ org.springframework.security
+ spring-security-config
+ ${spring-security.version}
+ test
+
+
+
+ org.springframework.security
+ spring-security-web
+ ${spring-security.version}
+ test
+
+
+
+ org.springframework.security
+ spring-security-test
+ ${spring-security.version}
+ test
+
+
+
+
+
diff --git a/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Order.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Order.java
new file mode 100644
index 000000000..734d6e959
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Order.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 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.data.rest.tests.security;
+
+import lombok.Value;
+
+import java.util.UUID;
+
+import org.springframework.data.annotation.Id;
+
+/**
+ * @author Oliver Gierke
+ */
+@Value
+public class Order {
+
+ @Id UUID id = UUID.randomUUID();
+ Person customer;
+}
diff --git a/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Person.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Person.java
new file mode 100644
index 000000000..71d89866d
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/main/java/org/springframework/data/rest/tests/security/Person.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 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.data.rest.tests.security;
+
+import lombok.Value;
+
+import java.util.UUID;
+
+import org.springframework.data.annotation.Id;
+
+/**
+ * @author Oliver Gierke
+ */
+@Value
+public class Person {
+
+ @Id UUID id = UUID.randomUUID();
+ String firstname, lastname;
+}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/PreAuthorizedOrderRepository.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/PreAuthorizedOrderRepository.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/PreAuthorizedOrderRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/PreAuthorizedOrderRepository.java
index cc0733336..df72862a3 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/PreAuthorizedOrderRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/PreAuthorizedOrderRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.security;
+package org.springframework.data.rest.tests.security;
+
+import java.util.UUID;
import org.springframework.data.repository.CrudRepository;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -24,11 +26,11 @@ import org.springframework.security.access.prepost.PreAuthorize;
*/
// tag::code[]
@PreAuthorize("hasRole('ROLE_USER')") // <1>
-public interface PreAuthorizedOrderRepository extends CrudRepository {
+public interface PreAuthorizedOrderRepository extends CrudRepository {
@PreAuthorize("hasRole('ROLE_ADMIN')") // <2>
@Override
- void delete(Long aLong);
+ void delete(UUID aLong);
@PreAuthorize("hasRole('ROLE_ADMIN')")
@Override
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecuredPersonRepository.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecuredPersonRepository.java
similarity index 87%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecuredPersonRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecuredPersonRepository.java
index e83d5fd61..9169351eb 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecuredPersonRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecuredPersonRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.security;
+package org.springframework.data.rest.tests.security;
+
+import java.util.UUID;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@@ -22,11 +24,11 @@ import org.springframework.security.access.annotation.Secured;
// tag::code[]
@Secured("ROLE_USER") // <1>
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
-public interface SecuredPersonRepository extends CrudRepository {
+public interface SecuredPersonRepository extends CrudRepository {
@Secured("ROLE_ADMIN") // <2>
@Override
- void delete(Long aLong);
+ void delete(UUID aLong);
@Secured("ROLE_ADMIN")
@Override
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityConfiguration.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityConfiguration.java
similarity index 94%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityConfiguration.java
rename to spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityConfiguration.java
index eab21a5ba..7560e2773 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityConfiguration.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.security;
+package org.springframework.data.rest.tests.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityIntegrationTests.java b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java
similarity index 81%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityIntegrationTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java
index 8f95efbba..d783d8df6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecurityIntegrationTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-security/src/test/java/org/springframework/data/rest/tests/security/SecurityIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.security;
+package org.springframework.data.rest.tests.security;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
@@ -24,9 +24,11 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.rest.webmvc.AbstractWebIntegrationTests;
-import org.springframework.data.rest.webmvc.TestMvcClient;
-import org.springframework.hateoas.config.EnableHypermediaSupport;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.map.repository.config.EnableMapRepositories;
+import org.springframework.data.rest.tests.AbstractWebIntegrationTests;
+import org.springframework.data.rest.tests.TestMvcClient;
+import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor;
@@ -48,9 +50,9 @@ import org.springframework.web.context.WebApplicationContext;
* @author Rob Winch
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = { SecureJpaConfiguration.class, SecurityConfiguration.class })
@Transactional
-@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL)
+@ContextConfiguration(classes = { SecurityIntegrationTests.Config.class, SecurityConfiguration.class,
+ RepositoryRestMvcConfiguration.class })
public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Autowired WebApplicationContext context;
@@ -59,6 +61,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Autowired SecuredPersonRepository personRepository;
@Autowired PreAuthorizedOrderRepository orderRepository;
+ @Configuration
+ @EnableMapRepositories
+ static class Config {}
+
@Before
@Override
public void setUp() {
@@ -85,7 +91,8 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
protected void setupMockMvc() {
this.mvc = MockMvcBuilders.webAppContextSetup(context).//
defaultRequest(get("/").//
- accept(TestMvcClient.DEFAULT_MEDIA_TYPE)).//
+ accept(TestMvcClient.DEFAULT_MEDIA_TYPE))
+ .//
apply(springSecurity()).//
build();
}
@@ -99,8 +106,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
// Getting the collection is not tested here. This is to get the URI that will later be tested for DELETE
final String people = client.discoverUnique("people").expand().getHref();
- MockHttpServletResponse response = mvc.perform(get(people).//
- with(user("user").roles("USER"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(people).//
+ with(user("user").roles("USER")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.people[0]._links.self.href", response);
@@ -116,8 +125,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Test
public void deletePersonAccessDeniedForUsers() throws Exception {
- MockHttpServletResponse response = mvc.perform(get(client.discoverUnique("people").expand().getHref()).//
- with(user("user").roles("USER"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(client.discoverUnique("people").expand().getHref()).//
+ with(user("user").roles("USER")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.people[0]._links.self.href", response);
@@ -134,8 +145,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Test
public void deletePersonAccessGrantedForAdmins() throws Exception {
- MockHttpServletResponse response = mvc.perform(get(client.discoverUnique("people").expand().getHref()).//
- with(user("user").roles("USER", "ADMIN"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(client.discoverUnique("people").expand().getHref()).//
+ with(user("user").roles("USER", "ADMIN")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.people[0]._links.self.href", response);
@@ -143,7 +156,7 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
SecurityContextHolder.clearContext();
mvc.perform(delete(href).with(user("user").roles("USER", "ADMIN")))
- .andExpect(status().is(HttpStatus.NO_CONTENT.value()));
+ .andExpect(status().is(HttpStatus.NO_CONTENT.value()));
}
/**
@@ -185,8 +198,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
public void deleteOrderAccessDeniedForNoCredentials() throws Exception {
// Getting the collection is not tested here. This is to get the URI that will later be tested for DELETE
- MockHttpServletResponse response = mvc.perform(get(client.discoverUnique("orders").expand().getHref()).//
- with(user("user").roles("USER"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(client.discoverUnique("orders").expand().getHref()).//
+ with(user("user").roles("USER")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.orders[0]._links.self.href", response);
@@ -202,8 +217,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Test
public void deleteOrderAccessDeniedForUsers() throws Exception {
- MockHttpServletResponse response = mvc.perform(get(client.discoverUnique("orders").expand().getHref()).//
- with(user("user").roles("USER"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(client.discoverUnique("orders").expand().getHref()).//
+ with(user("user").roles("USER")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.orders[0]._links.self.href", response);
@@ -217,8 +234,10 @@ public class SecurityIntegrationTests extends AbstractWebIntegrationTests {
@Test
public void deleteOrderAccessGrantedForAdmins() throws Exception {
- MockHttpServletResponse response = mvc.perform(get(client.discoverUnique("orders").expand().getHref()).//
- with(user("user").roles("USER"))).//
+ MockHttpServletResponse response = mvc
+ .perform(get(client.discoverUnique("orders").expand().getHref()).//
+ with(user("user").roles("USER")))
+ .//
andReturn().getResponse();
String href = assertHasJsonPathValue("$._embedded.orders[0]._links.self.href", response);
diff --git a/spring-data-rest-tests/spring-data-rest-tests-solr/pom.xml b/spring-data-rest-tests/spring-data-rest-tests-solr/pom.xml
new file mode 100644
index 000000000..61139dcfc
--- /dev/null
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/pom.xml
@@ -0,0 +1,60 @@
+
+ 4.0.0
+
+ org.springframework.data
+ spring-data-rest-tests
+ 2.5.0.BUILD-SNAPSHOT
+
+
+ Spring Data REST Tests - Solr
+ spring-data-rest-tests-solr
+
+
+
+
+ org.springframework.data
+ spring-data-rest-tests-core
+ 2.5.0.BUILD-SNAPSHOT
+ test-jar
+
+
+
+
+
+ org.springframework.data
+ spring-data-solr
+ ${springdata.solr}
+ test
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.6.5
+
+
+
+ org.apache.solr
+ solr-core
+ 5.3.1
+ test
+
+
+ org.slf4j
+ slf4j-api
+
+
+ jdk.tools
+ jdk.tools
+
+
+ com.google
+ guava
+
+
+
+
+
+
+
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java
index a955682b1..b71e02108 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/Product.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java
similarity index 93%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java
index 097d8c62c..27452a662 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/ProductRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java
similarity index 98%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java
index 02935ceda..f45f2f8a2 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrInfrastructureConfig.java
@@ -15,7 +15,7 @@
*/
package org.springframework.data.rest.webmvc.solr;
-import static org.springframework.data.rest.webmvc.util.TestUtils.*;
+import static org.springframework.data.rest.webmvc.solr.TestUtils.*;
import java.io.File;
import java.io.FileOutputStream;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java
similarity index 96%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java
index 641432150..f43c4922b 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrTestBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java
similarity index 97%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java
index bf93cd922..1b8ab0284 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/SolrWebTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.data.rest.webmvc.CommonWebTests;
+import org.springframework.data.rest.tests.CommonWebTests;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;
import org.springframework.hateoas.Link;
import org.springframework.http.MediaType;
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/TestUtils.java
similarity index 63%
rename from spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/TestUtils.java
index e8c53a046..73c3de702 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/util/TestUtils.java
+++ b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/java/org/springframework/data/rest/webmvc/solr/TestUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -13,19 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.data.rest.webmvc.util;
+package org.springframework.data.rest.webmvc.solr;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Map;
-import java.util.Scanner;
import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-import org.springframework.data.rest.webmvc.jpa.JpaWebTests;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StreamUtils;
@@ -37,41 +32,10 @@ import org.springframework.util.StringUtils;
* @author Oliver Gierke
* @author Christoph Strobl
*/
-public class TestUtils {
+class TestUtils {
private static final Charset UTF8 = Charset.forName("UTF-8");
- public static String readFileFromClasspath(String name) throws Exception {
-
- ClassPathResource file = new ClassPathResource(name, JpaWebTests.class);
- StringBuilder builder = new StringBuilder();
-
- Scanner scanner = new Scanner(file.getFile(), UTF8.name());
-
- try {
-
- while (scanner.hasNextLine()) {
- builder.append(scanner.nextLine());
- }
-
- } finally {
- scanner.close();
- }
-
- return builder.toString();
- }
-
- /**
- * Returns the given {@link String} as {@link InputStream}.
- *
- * @param source must not be {@literal null}.
- * @return
- */
- public static InputStream asStream(String source) {
- Assert.notNull(source, "Source string must not be null!");
- return new ByteArrayInputStream(source.getBytes(UTF8));
- }
-
/**
* Filters the given {@link Resource} by replacing values within.
*
@@ -95,5 +59,4 @@ public class TestUtils {
return new ByteArrayResource(temp.getBytes(UTF8));
}
-
}
diff --git a/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/schema.xml b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/schema.xml
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/schema.xml
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/schema.xml
diff --git a/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/solr.xml b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/solr.xml
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/solr.xml
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/solr.xml
diff --git a/spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/solrconfig.xml b/spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/solrconfig.xml
similarity index 100%
rename from spring-data-rest-webmvc/src/test/resources/org/springframework/data/rest/webmvc/solr/solrconfig.xml
rename to spring-data-rest-tests/spring-data-rest-tests-solr/src/test/resources/org/springframework/data/rest/webmvc/solr/solrconfig.xml
diff --git a/spring-data-rest-webmvc/pom.xml b/spring-data-rest-webmvc/pom.xml
index 7070ab2a5..ea5cd3f05 100644
--- a/spring-data-rest-webmvc/pom.xml
+++ b/spring-data-rest-webmvc/pom.xml
@@ -1,5 +1,6 @@
-
+4.0.0
@@ -16,11 +17,8 @@
- 0.9.12.0.92.0.2.1
- 4.0.1.RELEASE
- 2.4.4
@@ -89,7 +87,7 @@
json-patch1.7
-
+
@@ -122,234 +120,14 @@
${jsonpath}test
-
-
- org.codehaus.groovy
- groovy-all
- ${groovy.version}
- test
-
-
-
-
- commons-io
- commons-io
- 2.3
- test
-
-
-
-
+
org.springframework.data
- spring-data-gemfire
- ${springdata.gemfire}
- test
-
-
-
-
-
- org.springframework.data
- spring-data-solr
- ${springdata.solr}
- test
-
-
-
- org.apache.solr
- solr-core
- 5.3.1
- test
-
-
- org.slf4j
- slf4j-api
-
-
- jdk.tools
- jdk.tools
-
-
- com.google
- guava
-
-
-
-
-
-
-
- org.springframework.security
- spring-security-core
- ${spring-security.version}
- test
-
-
-
- org.springframework.security
- spring-security-config
- ${spring-security.version}
- test
-
-
-
- org.springframework.security
- spring-security-web
- ${spring-security.version}
- test
-
-
-
- org.springframework.security
- spring-security-test
- ${spring-security.version}
+ spring-data-keyvalue
+ ${springdata.keyvalue}test
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- default-test
-
-
- **/*
-
-
-
-
- base-tests
-
- test
-
- test
-
-
- **/*Test*.java
-
-
-
- **/cassandra/*Test*.java
- **/gemfire/*Test*.java
- **/jpa/*Test*.java
- **/mongodb/*Test*.java
- **/neo4j/*Test*.java
- **/solr/*Test*.java
-
-
-
-
- cassandra-tests
-
- test
-
- test
-
-
- **/cassandra/*Test*.java
-
-
-
-
- gemfire-tests
-
- test
-
- test
-
-
- **/gemfire/*Test*.java
-
-
-
-
- jpa-tests
-
- test
-
- test
-
-
- **/jpa/*Test*.java
-
-
-
-
- mongodb-tests
-
- test
-
- test
-
-
- **/mongodb/*Test*.java
-
-
-
-
- neo4j-tests
-
- test
-
- test
-
-
- **/neo4j/*Test*.java
-
-
-
-
- solr-tests
-
- test
-
- test
-
-
- **/solr/*Test*.java
-
-
-
-
-
-
-
- com.mysema.maven
- apt-maven-plugin
- ${apt}
-
-
- com.querydsl
- querydsl-apt
- ${querydsl}
-
-
-
-
- test-sources
- generate-test-sources
-
- test-process
-
-
- target/generated-test-sources/test-annotations
- org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor
- true
-
- org.springframework.data.rest.webmvc.mongodb.groovy,groovy.lang
-
-
-
-
-
-
-
-
-
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/EmbeddedResourcesAssembler.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/EmbeddedResourcesAssembler.java
index e87ba4ea0..66dd15657 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/EmbeddedResourcesAssembler.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/EmbeddedResourcesAssembler.java
@@ -29,7 +29,7 @@ import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.SimpleAssociationHandler;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.mapping.ResourceMetadata;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.ExcerptProjector;
import org.springframework.hateoas.core.EmbeddedWrapper;
import org.springframework.hateoas.core.EmbeddedWrappers;
@@ -42,14 +42,14 @@ import org.springframework.util.Assert;
public class EmbeddedResourcesAssembler {
private final @NonNull PersistentEntities entities;
- private final @NonNull AssociationLinks associations;
+ private final @NonNull Associations associations;
private final @NonNull ExcerptProjector projector;
private final @NonNull EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
/**
* Returns the embedded resources to render. This will add an {@link RelatedResource} for linkable associations if
* they have an excerpt projection registered.
- *
+ *
* @param instance must not be {@literal null}.
* @return
*/
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssembler.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssembler.java
index 9787a5a4b..e4ee8474e 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssembler.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/PersistentEntityResourceAssembler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2015 the original author or authors.
+ * Copyright 2013-2016 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.
@@ -22,7 +22,7 @@ import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.support.SelfLinkProvider;
import org.springframework.data.rest.webmvc.PersistentEntityResource.Builder;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.Projector;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.ResourceAssembler;
@@ -40,7 +40,7 @@ public class PersistentEntityResourceAssembler implements ResourceAssembler {
- static final String PROFILE_REL = "profile";
+ public static final String PROFILE_REL = "profile";
private final RepositoryRestConfiguration configuration;
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/RootResourceInformationToAlpsDescriptorConverter.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/RootResourceInformationToAlpsDescriptorConverter.java
index 4cf157093..9a29419ba 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/RootResourceInformationToAlpsDescriptorConverter.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/RootResourceInformationToAlpsDescriptorConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -54,7 +54,7 @@ import org.springframework.data.rest.webmvc.ProfileController;
import org.springframework.data.rest.webmvc.RootResourceInformation;
import org.springframework.data.rest.webmvc.json.EnumTranslator;
import org.springframework.data.rest.webmvc.json.JacksonMetadata;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.TemplateVariable;
@@ -82,7 +82,7 @@ public class RootResourceInformationToAlpsDescriptorConverter {
private static final List UNDOCUMENTED_METHODS = Arrays.asList(HttpMethod.OPTIONS, HttpMethod.HEAD);
- private final @NonNull AssociationLinks associations;
+ private final @NonNull Associations associations;
private final @NonNull Repositories repositories;
private final @NonNull PersistentEntities persistentEntities;
private final @NonNull EntityLinks entityLinks;
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/PersistentEntityResourceAssemblerArgumentResolver.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/PersistentEntityResourceAssemblerArgumentResolver.java
index 256f056d3..d2846853b 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/PersistentEntityResourceAssemblerArgumentResolver.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/PersistentEntityResourceAssemblerArgumentResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -24,7 +24,7 @@ import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.rest.core.projection.ProjectionDefinitions;
import org.springframework.data.rest.core.support.SelfLinkProvider;
import org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.PersistentEntityProjector;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
@@ -43,7 +43,7 @@ public class PersistentEntityResourceAssemblerArgumentResolver implements Handle
private final @NonNull SelfLinkProvider linkProvider;
private final @NonNull ProjectionDefinitions projectionDefinitions;
private final @NonNull ProjectionFactory projectionFactory;
- private final @NonNull AssociationLinks links;
+ private final @NonNull Associations links;
/*
* (non-Javadoc)
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java
index 98cc87540..1d04b567f 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.java
@@ -96,7 +96,7 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverter;
import org.springframework.data.rest.webmvc.json.PersistentEntityToJsonSchemaConverter.ValueTypeSchemaPropertyCustomizerFactory;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.mapping.LinkCollector;
import org.springframework.data.rest.webmvc.spi.BackendIdConverter;
import org.springframework.data.rest.webmvc.spi.BackendIdConverter.DefaultIdConverter;
@@ -232,9 +232,10 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
* {@link org.springframework.validation.Validator} instances assigned to specific domain types.
*/
@Bean
- public ValidatingRepositoryEventListener validatingRepositoryEventListener(ObjectFactory repositories) {
+ public ValidatingRepositoryEventListener validatingRepositoryEventListener(
+ ObjectFactory entities) {
- ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(repositories);
+ ValidatingRepositoryEventListener listener = new ValidatingRepositoryEventListener(entities);
configurerDelegate.configureValidatingRepositoryEventListener(listener);
configureValidatingRepositoryEventListener(listener);
@@ -755,8 +756,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
}
@Bean
- public AssociationLinks associationLinks() {
- return new AssociationLinks(resourceMappings(), config());
+ public Associations associationLinks() {
+ return new Associations(resourceMappings(), config());
}
protected List> getEntityLookups() {
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java
index d48b3a87f..94e9b585b 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/DomainObjectReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -29,7 +29,7 @@ import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.SimplePropertyHandler;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.util.Assert;
@@ -53,7 +53,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
public class DomainObjectReader {
private final @NonNull PersistentEntities entities;
- private final @NonNull AssociationLinks associationLinks;
+ private final @NonNull Associations associationLinks;
private final @NonNull ClassIntrospector introspector = new BasicClassIntrospector();
/**
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java
index cebb62a80..9985322e5 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2Module.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-2016 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.
@@ -44,7 +44,7 @@ import org.springframework.data.rest.core.support.SelfLinkProvider;
import org.springframework.data.rest.webmvc.EmbeddedResourcesAssembler;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
import org.springframework.data.rest.webmvc.ResourceProcessorInvoker;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.mapping.LinkCollector;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Links;
@@ -110,7 +110,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
* @param converter must not be {@literal null}.
* @param linkProvider must not be {@literal null}.
*/
- public PersistentEntityJackson2Module(AssociationLinks associations, PersistentEntities entities,
+ public PersistentEntityJackson2Module(Associations associations, PersistentEntities entities,
UriToEntityConverter converter, LinkCollector collector, RepositoryInvokerFactory factory,
NestedEntitySerializer serializer, LookupObjectSerializer lookupObjectSerializer) {
@@ -144,7 +144,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
/**
* Creates a new {@link PersistentEntityResourceSerializer} using the given {@link PersistentEntities} and
- * {@link AssociationLinks}.
+ * {@link Associations}.
*
* @param entities must not be {@literal null}.
*/
@@ -221,7 +221,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
static class AssociationOmittingSerializerModifier extends BeanSerializerModifier {
private final @NonNull PersistentEntities entities;
- private final @NonNull AssociationLinks associations;
+ private final @NonNull Associations associations;
private final @NonNull NestedEntitySerializer nestedEntitySerializer;
private final @NonNull LookupObjectSerializer lookupObjectSerializer;
@@ -378,7 +378,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
public static class AssociationUriResolvingDeserializerModifier extends BeanDeserializerModifier {
private final @NonNull PersistentEntities entities;
- private final @NonNull AssociationLinks associationLinks;
+ private final @NonNull Associations associationLinks;
private final @NonNull UriToEntityConverter converter;
private final @NonNull RepositoryInvokerFactory factory;
@@ -512,7 +512,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
static class ProjectionSerializer extends StdSerializer {
private final LinkCollector collector;
- private final AssociationLinks associations;
+ private final Associations associations;
private final boolean unwrapping;
/**
@@ -523,7 +523,7 @@ public class PersistentEntityJackson2Module extends SimpleModule {
* @param mappings must not be {@literal null}.
* @param unwrapping
*/
- private ProjectionSerializer(LinkCollector collector, AssociationLinks mappings, boolean unwrapping) {
+ private ProjectionSerializer(LinkCollector collector, Associations mappings, boolean unwrapping) {
super(TargetAware.class);
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverter.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverter.java
index aeab8db67..a865400d5 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverter.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/PersistentEntityToJsonSchemaConverter.java
@@ -51,7 +51,7 @@ import org.springframework.data.rest.webmvc.json.JsonSchema.Definitions;
import org.springframework.data.rest.webmvc.json.JsonSchema.EnumProperty;
import org.springframework.data.rest.webmvc.json.JsonSchema.Item;
import org.springframework.data.rest.webmvc.json.JsonSchema.JsonSchemaProperty;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.util.Assert;
@@ -76,7 +76,7 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
private static final TypeInformation> STRING_TYPE_INFORMATION = ClassTypeInformation.from(String.class);
private final Set convertiblePairs = new HashSet();
- private final AssociationLinks associations;
+ private final Associations associations;
private final PersistentEntities entities;
private final MessageSourceAccessor accessor;
private final ObjectMapper objectMapper;
@@ -93,7 +93,7 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
* @param objectMapper must not be {@literal null}.
* @param configuration must not be {@literal null}.
*/
- public PersistentEntityToJsonSchemaConverter(PersistentEntities entities, AssociationLinks associations,
+ public PersistentEntityToJsonSchemaConverter(PersistentEntities entities, Associations associations,
MessageSourceAccessor accessor, ObjectMapper objectMapper, RepositoryRestConfiguration configuration,
ValueTypeSchemaPropertyCustomizerFactory customizerFactory) {
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/AssociationLinks.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/Associations.java
similarity index 96%
rename from spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/AssociationLinks.java
rename to spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/Associations.java
index c8a139cc9..06a25ae08 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/AssociationLinks.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/Associations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -34,14 +34,14 @@ import org.springframework.hateoas.Link;
import org.springframework.util.Assert;
/**
- * A value object to for {@link Link}s representing an association.
+ * A value object to for {@link Link}s representing associations.
*
* @author Oliver Gierke
* @author Greg Turnquist
* @since 2.1
*/
@RequiredArgsConstructor
-public class AssociationLinks {
+public class Associations {
private final @NonNull @Getter ResourceMappings mappings;
private final @NonNull RepositoryRestConfiguration config;
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollectingAssociationHandler.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollectingAssociationHandler.java
index 096d6cfac..8d8b4be27 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollectingAssociationHandler.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollectingAssociationHandler.java
@@ -39,7 +39,7 @@ public class LinkCollectingAssociationHandler implements SimpleAssociationHandle
private static final String AMBIGUOUS_ASSOCIATIONS = "Detected multiple association links with same relation type! Disambiguate association %s using @RestResource!";
private final PersistentEntities entities;
- private final AssociationLinks associationLinks;
+ private final Associations associations;
private final Path basePath;
private final boolean nested;
@@ -47,25 +47,25 @@ public class LinkCollectingAssociationHandler implements SimpleAssociationHandle
/**
* Creates a new {@link LinkCollectingAssociationHandler} for the given {@link PersistentEntities}, {@link Path} and
- * {@link AssociationLinks}.
+ * {@link Associations}.
*
* @param entities must not be {@literal null}.
* @param path must not be {@literal null}.
- * @param associationLinks must not be {@literal null}.
+ * @param associations must not be {@literal null}.
*/
- public LinkCollectingAssociationHandler(PersistentEntities entities, Path path, AssociationLinks associationLinks) {
- this(entities, path, associationLinks, false);
+ public LinkCollectingAssociationHandler(PersistentEntities entities, Path path, Associations associations) {
+ this(entities, path, associations, false);
}
- private LinkCollectingAssociationHandler(PersistentEntities entities, Path path, AssociationLinks associationLinks,
+ private LinkCollectingAssociationHandler(PersistentEntities entities, Path path, Associations associations,
boolean nested) {
Assert.notNull(entities, "PersistentEntities must not be null!");
Assert.notNull(path, "Path must not be null!");
- Assert.notNull(associationLinks, "AssociationLinks must not be null!");
+ Assert.notNull(associations, "AssociationLinks must not be null!");
this.entities = entities;
- this.associationLinks = associationLinks;
+ this.associations = associations;
this.basePath = path;
this.links = new ArrayList();
@@ -73,7 +73,7 @@ public class LinkCollectingAssociationHandler implements SimpleAssociationHandle
}
public LinkCollectingAssociationHandler nested() {
- return nested ? this : new LinkCollectingAssociationHandler(entities, basePath, associationLinks, true);
+ return nested ? this : new LinkCollectingAssociationHandler(entities, basePath, associations, true);
}
/**
@@ -94,11 +94,11 @@ public class LinkCollectingAssociationHandler implements SimpleAssociationHandle
PersistentProperty> property = association.getInverse();
- if (associationLinks.isLinkableAssociation(property)) {
+ if (associations.isLinkableAssociation(property)) {
Links existingLinks = new Links(links);
- for (Link link : associationLinks.getLinksFor(association, basePath)) {
+ for (Link link : associations.getLinksFor(association, basePath)) {
if (existingLinks.hasLink(link.getRel())) {
throw new MappingException(String.format(AMBIGUOUS_ASSOCIATIONS, property.toString()));
} else {
diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollector.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollector.java
index 77e6a7df4..286281fc9 100644
--- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollector.java
+++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/mapping/LinkCollector.java
@@ -47,17 +47,17 @@ import org.springframework.util.Assert;
public class LinkCollector {
private final PersistentEntities entities;
- private final AssociationLinks associationLinks;
+ private final Associations associationLinks;
private final SelfLinkProvider links;
/**
- * Creates a new {@link PersistentEntities}, {@link SelfLinkProvider} and {@link AssociationLinks}.
- *
+ * Creates a new {@link PersistentEntities}, {@link SelfLinkProvider} and {@link Associations}.
+ *
* @param entities must not be {@literal null}.
* @param linkProvider must not be {@literal null}.
* @param associationLinks must not be {@literal null}.
*/
- public LinkCollector(PersistentEntities entities, SelfLinkProvider linkProvider, AssociationLinks associationLinks) {
+ public LinkCollector(PersistentEntities entities, SelfLinkProvider linkProvider, Associations associationLinks) {
Assert.notNull(entities, "PersistentEntities must not be null!");
Assert.notNull(linkProvider, "SelfLinkProvider must not be null!");
@@ -70,7 +70,7 @@ public class LinkCollector {
/**
* Returns all {@link Links} for the given object.
- *
+ *
* @param object must not be {@literal null}.
* @return
*/
@@ -80,7 +80,7 @@ public class LinkCollector {
/**
* Returns all {@link Links} for the given object and already existing {@link Link}.
- *
+ *
* @param object must not be {@literal null}.
* @param existingLinks must not be {@literal null}.
* @return
@@ -151,7 +151,7 @@ public class LinkCollector {
/**
* {@link SimpleAssociationHandler} that will collect {@link Link}s for all linkable associations.
- *
+ *
* @author Oliver Gierke
* @since 2.1
*/
@@ -162,19 +162,19 @@ public class LinkCollector {
private final @NonNull PersistentEntities entities;
private final @NonNull Path basePath;
- private final @NonNull AssociationLinks associationLinks;
+ private final @NonNull Associations associationLinks;
private final @NonNull List links = new ArrayList();
/**
* Returns the links collected after the {@link Association} has been traversed.
- *
+ *
* @return the links
*/
public List getLinks() {
return links;
}
- /*
+ /*
* (non-Javadoc)
* @see org.springframework.data.mapping.SimpleAssociationHandler#doWithAssociation(org.springframework.data.mapping.Association)
*/
@@ -202,10 +202,10 @@ public class LinkCollector {
private final SelfLinkProvider selfLinks;
private final PersistentPropertyAccessor accessor;
- private final AssociationLinks associations;
+ private final Associations associations;
private final @Getter List links = new ArrayList();
- /*
+ /*
* (non-Javadoc)
* @see org.springframework.data.mapping.SimpleAssociationHandler#doWithAssociation(org.springframework.data.mapping.Association)
*/
@@ -234,7 +234,7 @@ public class LinkCollector {
/**
* Returns a link pointing to the given entity using the given {@link ResourceMapping} to detect the link relation.
- *
+ *
* @param entity must not be {@literal null}.
* @param mapping must not be {@literal null}.
* @return
@@ -246,7 +246,7 @@ public class LinkCollector {
/**
* Returns the given object as {@link Collection}, i.e. the object as is if it's a collection already or wrapped
* into a single-element collection otherwise.
- *
+ *
* @param object can be {@literal null}.
* @return
*/
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AssociationLinksUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AssociationLinksUnitTests.java
index f9edce3de..0b33c3381 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AssociationLinksUnitTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/AssociationLinksUnitTests.java
@@ -28,33 +28,33 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.annotation.Reference;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentProperty;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
-import org.springframework.data.mongodb.core.mapping.MongoPersistentProperty;
import org.springframework.data.rest.core.Path;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.mapping.PersistentEntitiesResourceMappings;
import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.rest.core.mapping.ResourceMetadata;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.hateoas.Link;
/**
- * Unit tests for {@link AssociationLinks}.
+ * Unit tests for {@link Associations}.
*
* @author Oliver Gierke
*/
@RunWith(MockitoJUnitRunner.class)
public class AssociationLinksUnitTests {
- AssociationLinks links;
+ Associations links;
ResourceMappings mappings;
- MongoMappingContext mappingContext;
- MongoPersistentEntity> entity;
+ KeyValueMappingContext mappingContext;
+ KeyValuePersistentEntity> entity;
ResourceMetadata sampleResourceMetadata;
@Mock RepositoryRestConfiguration config;
@@ -62,10 +62,10 @@ public class AssociationLinksUnitTests {
@Before
public void setUp() {
- this.mappingContext = new MongoMappingContext();
+ this.mappingContext = new KeyValueMappingContext();
this.entity = mappingContext.getPersistentEntity(Sample.class);
this.mappings = new PersistentEntitiesResourceMappings(new PersistentEntities(Arrays.asList(mappingContext)));
- this.links = new AssociationLinks(mappings, config);
+ this.links = new Associations(mappings, config);
}
/**
@@ -73,12 +73,12 @@ public class AssociationLinksUnitTests {
*/
@Test(expected = IllegalArgumentException.class)
public void rejectsNullMappings() {
- new AssociationLinks(null, mock(RepositoryRestConfiguration.class));
+ new Associations(null, mock(RepositoryRestConfiguration.class));
}
@Test(expected = IllegalArgumentException.class)
public void rejectsNullConfiguration() {
- new AssociationLinks(mappings, null);
+ new Associations(mappings, null);
}
/**
@@ -103,7 +103,7 @@ public class AssociationLinksUnitTests {
@Test
public void considersUnexportedPropertyUnlinkable() {
- MongoPersistentProperty property = entity.getPersistentProperty("unexportedProperty");
+ KeyValuePersistentProperty property = entity.getPersistentProperty("unexportedProperty");
assertThat(links.isLinkableAssociation(property), is(false));
}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestMvcTestConfig.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestMvcTestConfig.java
deleted file mode 100644
index 8fdc794fa..000000000
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/RepositoryRestMvcTestConfig.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.springframework.data.rest.webmvc;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
-import org.springframework.data.rest.webmvc.gemfire.GemfireRepositoryConfig;
-import org.springframework.data.rest.webmvc.jpa.JpaRepositoryConfig;
-import org.springframework.data.rest.webmvc.mongodb.MongoDbRepositoryConfig;
-
-/**
- * @author Jon Brisbin
- */
-@Configuration
-@Import({ JpaRepositoryConfig.class, MongoDbRepositoryConfig.class, GemfireRepositoryConfig.class })
-public class RepositoryRestMvcTestConfig extends RepositoryRestMvcConfiguration {}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/DomainObjectReaderUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/DomainObjectReaderUnitTests.java
index c1047165f..5ec0b1280 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/DomainObjectReaderUnitTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/DomainObjectReaderUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -30,11 +30,11 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.mapping.ResourceMappings;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
@@ -59,7 +59,7 @@ public class DomainObjectReaderUnitTests {
@Before
public void setUp() {
- MongoMappingContext mappingContext = new MongoMappingContext();
+ KeyValueMappingContext mappingContext = new KeyValueMappingContext();
mappingContext.getPersistentEntity(SampleUser.class);
mappingContext.getPersistentEntity(Person.class);
mappingContext.getPersistentEntity(TypeWithGenericMap.class);
@@ -68,8 +68,7 @@ public class DomainObjectReaderUnitTests {
PersistentEntities entities = new PersistentEntities(Collections.singleton(mappingContext));
- this.reader = new DomainObjectReader(entities,
- new AssociationLinks(mappings, mock(RepositoryRestConfiguration.class)));
+ this.reader = new DomainObjectReader(entities, new Associations(mappings, mock(RepositoryRestConfiguration.class)));
}
/**
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/JacksonMetadataUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/JacksonMetadataUnitTests.java
index da8848de4..3b8ad44d6 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/JacksonMetadataUnitTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/JacksonMetadataUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2016 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.
@@ -22,10 +22,10 @@ import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.MappingContext;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -51,7 +51,7 @@ public class JacksonMetadataUnitTests {
@Before
public void setUp() {
- this.context = new MongoMappingContext();
+ this.context = new KeyValueMappingContext();
this.mapper = new ObjectMapper();
this.mapper.disable(MapperFeature.INFER_PROPERTY_MUTATORS);
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2ModuleUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2ModuleUnitTests.java
index a56857179..052d133a9 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2ModuleUnitTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/json/PersistentEntityJackson2ModuleUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -30,9 +30,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.PersistentEntities;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.repository.support.RepositoryInvokerFactory;
import org.springframework.data.rest.core.UriToEntityConverter;
import org.springframework.data.rest.core.mapping.ResourceMappings;
@@ -44,7 +44,7 @@ import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.AssociationUriResolvingDeserializerModifier;
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.LookupObjectSerializer;
import org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module.NestedEntitySerializer;
-import org.springframework.data.rest.webmvc.mapping.AssociationLinks;
+import org.springframework.data.rest.webmvc.mapping.Associations;
import org.springframework.data.rest.webmvc.support.ExcerptProjector;
import org.springframework.hateoas.EntityLinks;
import org.springframework.hateoas.ResourceProcessor;
@@ -66,7 +66,7 @@ import com.jayway.jsonpath.JsonPath;
@RunWith(MockitoJUnitRunner.class)
public class PersistentEntityJackson2ModuleUnitTests {
- @Mock AssociationLinks associations;
+ @Mock Associations associations;
@Mock UriToEntityConverter converter;
@Mock EntityLinks entityLinks;
@Mock ResourceMappings mappings;
@@ -78,7 +78,7 @@ public class PersistentEntityJackson2ModuleUnitTests {
@Before
public void setUp() {
- MongoMappingContext mappingContext = new MongoMappingContext();
+ KeyValueMappingContext mappingContext = new KeyValueMappingContext();
mappingContext.getPersistentEntity(Sample.class);
mappingContext.getPersistentEntity(SampleWithAdditionalGetters.class);
mappingContext.getPersistentEntity(PersistentEntityJackson2ModuleUnitTests.PetOwner.class);
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mapping/AssociationsUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mapping/AssociationsUnitTests.java
new file mode 100644
index 000000000..3248113af
--- /dev/null
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/mapping/AssociationsUnitTests.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2016 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.data.rest.webmvc.mapping;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.springframework.data.annotation.Reference;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentEntity;
+import org.springframework.data.keyvalue.core.mapping.KeyValuePersistentProperty;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
+import org.springframework.data.mapping.Association;
+import org.springframework.data.mapping.PersistentEntity;
+import org.springframework.data.mapping.PersistentProperty;
+import org.springframework.data.mapping.context.PersistentEntities;
+import org.springframework.data.rest.core.Path;
+import org.springframework.data.rest.core.annotation.RestResource;
+import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
+import org.springframework.data.rest.core.mapping.PersistentEntitiesResourceMappings;
+import org.springframework.data.rest.core.mapping.ResourceMappings;
+import org.springframework.hateoas.Link;
+
+/**
+ * @author Oliver Gierke
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class AssociationsUnitTests {
+
+ @Mock RepositoryRestConfiguration configuration;
+
+ @Mock PersistentEntity, ?> entity;
+ @Mock PersistentProperty> property;
+
+ Associations associations;
+
+ KeyValueMappingContext mappingContext;
+ ResourceMappings mappings;
+
+ @Before
+ public void setUp() {
+
+ this.mappingContext = new KeyValueMappingContext();
+ this.mappingContext.getPersistentEntity(Root.class);
+
+ this.mappings = new PersistentEntitiesResourceMappings(new PersistentEntities(Arrays.asList(mappingContext)));
+
+ this.associations = new Associations(mappings, configuration);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void rejectsNullMappings() {
+ new Associations(null, configuration);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void rejectsNullConfiguration() {
+ new Associations(mappings, null);
+ }
+
+ @Test
+ public void handlesNullPropertyForLookupTypeCheck() {
+ assertThat(associations.isLookupType(null), is(false));
+ }
+
+ @Test
+ public void forwardsLookupTypeCheckToConfiguration() {
+
+ doReturn(Root.class).when(property).getActualType();
+ assertThat(associations.isLookupType(property), is(false));
+
+ doReturn(true).when(configuration).isLookupType(Root.class);
+ assertThat(associations.isLookupType(property), is(true));
+ }
+
+ @Test
+ public void forwardsIdExposureCheckToConfiguration() {
+
+ doReturn(Root.class).when(entity).getType();
+ assertThat(associations.isIdExposed(entity), is(false));
+
+ doReturn(true).when(configuration).isIdExposedFor(Root.class);
+ assertThat(associations.isIdExposed(entity), is(true));
+ }
+
+ @Test
+ public void exposesConfiguredMapping() {
+ assertThat(associations.getMappings(), is(mappings));
+ }
+
+ @Test
+ public void forwardsMetadataLookupToMappings() {
+ assertThat(associations.getMetadataFor(Root.class), is(notNullValue()));
+ }
+
+ @Test
+ public void detectsAssociationLinks() {
+
+ List links = associations.getLinksFor(getAssociation(Root.class, "relatedAndExported"), new Path(""));
+
+ assertThat(links, hasSize(1));
+ assertThat(links, hasItem(new Link("/relatedAndExported", "relatedAndExported")));
+ }
+
+ @Test
+ public void doesNotCreateAssociationLinkIfTargetIsNotExported() {
+
+ List links = associations.getLinksFor(getAssociation(Root.class, "relatedButNotExported"), new Path(""));
+
+ assertThat(links, hasSize(0));
+ }
+
+ private Association extends PersistentProperty>> getAssociation(Class> type, String name) {
+
+ KeyValuePersistentEntity> rootEntity = mappingContext.getPersistentEntity(type);
+ return new Association(rootEntity.getPersistentProperty(name), null);
+ }
+
+ static class Root {
+ @Reference RelatedAndExported relatedAndExported;
+ @Reference RelatedButNotExported relatedButNotExported;
+ }
+
+ @RestResource(exported = true)
+ static class RelatedAndExported {}
+
+ static class RelatedButNotExported {}
+}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Order.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Order.java
deleted file mode 100644
index 953cb3bff..000000000
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Order.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 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.data.rest.webmvc.security;
-
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-/**
- * @author Oliver Gierke
- * @author Greg Turnquist
- */
-@Entity
-@Table(name = "ORDERS")
-public class Order {
-
- @Id @GeneratedValue//
- private Long id;
-
- @ManyToOne(fetch = FetchType.LAZY)//
- Person creator;
-
- public Order(Person creator) {
- this.creator = creator;
- }
-
- protected Order() {
-
- }
-
- public Long getId() {
- return id;
- }
-
- public Person getCreator() {
- return creator;
- }
-
-}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Person.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Person.java
deleted file mode 100644
index 3ba17509b..000000000
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/Person.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2012-2015 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.data.rest.webmvc.security;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.PrePersist;
-import javax.validation.constraints.NotNull;
-
-import org.springframework.data.rest.core.annotation.Description;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-/**
- * An entity that represents a person.
- *
- * @author Jon Brisbin
- */
-@Entity
-@JsonIgnoreProperties({ "height", "weight" })
-public class Person {
-
- private Long id;
- @Description("A person's first name") private String firstName;
- @Description("A person's last name") private String lastName;
- @Description("A person's siblings") private List siblings = Collections.emptyList();
- private Person father;
- @Description("Timestamp this person object was created") private Date created;
- private int age, height, weight;
-
- public Person() {}
-
- public Person(String firstName, String lastName) {
- this.firstName = firstName;
- this.lastName = lastName;
- }
-
- @Id
- @GeneratedValue
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- @NotNull
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public Person addSibling(Person p) {
- if (siblings == Collections.EMPTY_LIST) {
- siblings = new ArrayList();
- }
- siblings.add(p);
- return this;
- }
-
- @ManyToMany
- public List getSiblings() {
- return siblings;
- }
-
- public void setSiblings(List siblings) {
- this.siblings = siblings;
- }
-
- @ManyToOne
- public Person getFather() {
- return father;
- }
-
- public void setFather(Person father) {
- this.father = father;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public void setCreated(Date created) {}
-
- @PrePersist
- private void prePersist() {
- this.created = Calendar.getInstance().getTime();
- }
-
- @JsonIgnore
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public void setWeight(int weight) {
- this.weight = weight;
- }
-}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecureJpaConfiguration.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecureJpaConfiguration.java
deleted file mode 100644
index 83ab02409..000000000
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/security/SecureJpaConfiguration.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2014-2015 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.data.rest.webmvc.security;
-
-import javax.sql.DataSource;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
-import org.springframework.orm.jpa.JpaTransactionManager;
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
-import org.springframework.orm.jpa.vendor.Database;
-import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-/**
- * @author Greg Turnquist
- */
-@Configuration
-@EnableJpaRepositories
-@EnableTransactionManagement
-public class SecureJpaConfiguration {
-
- @Bean
- public DataSource dataSource() {
- EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
- return builder.setType(EmbeddedDatabaseType.HSQL).build();
- }
-
- @Bean
- public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
-
- HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
- vendorAdapter.setDatabase(Database.HSQL);
- vendorAdapter.setGenerateDdl(true);
-
- LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
- factory.setJpaVendorAdapter(vendorAdapter);
- factory.setPackagesToScan(getClass().getPackage().getName());
- factory.setPersistenceUnitName("spring-data-rest-webmvc");
- factory.setDataSource(dataSource());
- factory.afterPropertiesSet();
-
- return factory;
- }
-
- @Bean
- public PlatformTransactionManager transactionManager() {
- return new JpaTransactionManager();
- }
-}
diff --git a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ETagUnitTests.java b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ETagUnitTests.java
index c0961bddf..180f19c03 100644
--- a/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ETagUnitTests.java
+++ b/spring-data-rest-webmvc/src/test/java/org/springframework/data/rest/webmvc/support/ETagUnitTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 the original author or authors.
+ * Copyright 2014-2016 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.
@@ -22,8 +22,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.annotation.Version;
+import org.springframework.data.keyvalue.core.mapping.context.KeyValueMappingContext;
import org.springframework.data.mapping.PersistentEntity;
-import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.rest.webmvc.PersistentEntityResource;
import org.springframework.http.HttpHeaders;
@@ -36,7 +36,7 @@ import org.springframework.http.HttpHeaders;
@RunWith(MockitoJUnitRunner.class)
public class ETagUnitTests {
- MongoMappingContext context = new MongoMappingContext();
+ KeyValueMappingContext context = new KeyValueMappingContext();
/**
* @see DATAREST-160
diff --git a/spring-data-rest-webmvc/src/test/resources/META-INF/persistence.xml b/spring-data-rest-webmvc/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index a92748d1c..000000000
--- a/spring-data-rest-webmvc/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file