diff --git a/src/main/java/org/springframework/data/annotation/CreatedBy.java b/src/main/java/org/springframework/data/annotation/CreatedBy.java index cb0ae37f1..31cac3bd5 100644 --- a/src/main/java/org/springframework/data/annotation/CreatedBy.java +++ b/src/main/java/org/springframework/data/annotation/CreatedBy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,6 +29,6 @@ import java.lang.annotation.Target; * @since 1.5 */ @Retention(RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.ANNOTATION_TYPE }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface CreatedBy { } diff --git a/src/main/java/org/springframework/data/annotation/CreatedDate.java b/src/main/java/org/springframework/data/annotation/CreatedDate.java index 14896d38f..c4a0e3ba4 100644 --- a/src/main/java/org/springframework/data/annotation/CreatedDate.java +++ b/src/main/java/org/springframework/data/annotation/CreatedDate.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,6 +29,6 @@ import java.lang.annotation.Target; * @since 1.5 */ @Retention(RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.ANNOTATION_TYPE }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface CreatedDate { } diff --git a/src/main/java/org/springframework/data/annotation/Id.java b/src/main/java/org/springframework/data/annotation/Id.java index e3ed02b2f..f804a2e4f 100644 --- a/src/main/java/org/springframework/data/annotation/Id.java +++ b/src/main/java/org/springframework/data/annotation/Id.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011 by the original author(s). + * Copyright 2011-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 + * 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, @@ -13,18 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * @author J. Brisbin + * Demarcates an identifier. + * + * @author Jon Brisbin + * @author Oliver Gierke */ @Retention(RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface Id { } diff --git a/src/main/java/org/springframework/data/annotation/LastModifiedBy.java b/src/main/java/org/springframework/data/annotation/LastModifiedBy.java index fdac44919..2a07d874f 100644 --- a/src/main/java/org/springframework/data/annotation/LastModifiedBy.java +++ b/src/main/java/org/springframework/data/annotation/LastModifiedBy.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,6 +29,6 @@ import java.lang.annotation.Target; * @since 1.5 */ @Retention(RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.ANNOTATION_TYPE }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface LastModifiedBy { } diff --git a/src/main/java/org/springframework/data/annotation/LastModifiedDate.java b/src/main/java/org/springframework/data/annotation/LastModifiedDate.java index 1259bdb60..11c7410a3 100644 --- a/src/main/java/org/springframework/data/annotation/LastModifiedDate.java +++ b/src/main/java/org/springframework/data/annotation/LastModifiedDate.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,6 +29,6 @@ import java.lang.annotation.Target; * @since 1.5 */ @Retention(RetentionPolicy.RUNTIME) -@Target(value = { ElementType.FIELD, ElementType.ANNOTATION_TYPE }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface LastModifiedDate { } diff --git a/src/main/java/org/springframework/data/annotation/Reference.java b/src/main/java/org/springframework/data/annotation/Reference.java index c299b2222..2d2deffbd 100644 --- a/src/main/java/org/springframework/data/annotation/Reference.java +++ b/src/main/java/org/springframework/data/annotation/Reference.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2012 the original author or authors. + * Copyright 2011-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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -27,6 +28,6 @@ import java.lang.annotation.Target; * @author Jon Brisbin */ @Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.ANNOTATION_TYPE, ElementType.FIELD }) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface Reference { } diff --git a/src/main/java/org/springframework/data/annotation/Transient.java b/src/main/java/org/springframework/data/annotation/Transient.java index 36a67d4c1..995ac4494 100644 --- a/src/main/java/org/springframework/data/annotation/Transient.java +++ b/src/main/java/org/springframework/data/annotation/Transient.java @@ -1,5 +1,5 @@ /* - * Copyright 20011-2012 the original author or authors. + * Copyright 20011-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. @@ -15,7 +15,8 @@ */ package org.springframework.data.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.*; + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -28,6 +29,6 @@ import java.lang.annotation.Target; * @author Jon Brisbin */ @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface Transient { } diff --git a/src/main/java/org/springframework/data/annotation/Version.java b/src/main/java/org/springframework/data/annotation/Version.java index 3a3c0cba3..1da3d73dd 100644 --- a/src/main/java/org/springframework/data/annotation/Version.java +++ b/src/main/java/org/springframework/data/annotation/Version.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -30,8 +30,8 @@ import java.lang.annotation.Target; * @author Oliver Gierke */ @Documented -@Target({ FIELD, ANNOTATION_TYPE }) @Retention(RUNTIME) +@Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) public @interface Version { } diff --git a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java index a675ac840..6f1a991d2 100644 --- a/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java +++ b/src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java @@ -1,11 +1,11 @@ /* - * Copyright (c) 2011 by the original author(s). + * Copyright 2011-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 + * 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, @@ -18,6 +18,8 @@ package org.springframework.data.mapping.model; import java.beans.PropertyDescriptor; import java.lang.annotation.Annotation; import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.Arrays; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -29,6 +31,7 @@ import org.springframework.data.annotation.Version; import org.springframework.data.mapping.Association; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.mapping.PersistentProperty; +import org.springframework.util.Assert; /** * Special {@link PersistentProperty} that takes annotations at a property into account. @@ -43,16 +46,15 @@ public abstract class AnnotationBasedPersistentProperty

owner, SimpleTypeHolder simpleTypeHolder) { super(field, propertyDescriptor, owner, simpleTypeHolder); - this.value = field.getAnnotation(Value.class); - field.isAnnotationPresent(Autowired.class); + this.value = findAnnotation(Value.class); } /** @@ -75,9 +77,8 @@ public abstract class AnnotationBasedPersistentProperty

A findAnnotation(Class annotationType) { + + Assert.notNull(annotationType, "Annotation type must not be null!"); + + for (Method method : Arrays.asList(getGetter(), getSetter())) { - // TODO: do we need this? Shouldn't the section above already find that annotation? - for (Annotation annotation : field.getDeclaredAnnotations()) { - if (annotation.annotationType().isAnnotationPresent(Reference.class)) { - return true; + if (method == null) { + continue; + } + + A annotation = AnnotationUtils.findAnnotation(method, annotationType); + + if (annotation != null) { + return annotation; } } - return false; + return AnnotationUtils.getAnnotation(field, annotationType); + } + + /** + * Returns whether the property carries the an annotation of the given type. + * + * @param annotationType the annotation type to look up. + * @return + */ + protected boolean isAnnotationPresent(Class annotationType) { + return findAnnotation(annotationType) != null; } } diff --git a/src/test/java/org/springframework/data/convert/MappingContextTypeInformationMapperUnitTests.java b/src/test/java/org/springframework/data/convert/MappingContextTypeInformationMapperUnitTests.java index 66dc4d656..549fc5520 100644 --- a/src/test/java/org/springframework/data/convert/MappingContextTypeInformationMapperUnitTests.java +++ b/src/test/java/org/springframework/data/convert/MappingContextTypeInformationMapperUnitTests.java @@ -24,10 +24,9 @@ import java.util.Collections; import org.junit.Before; import org.junit.Test; import org.springframework.data.annotation.TypeAlias; -import org.springframework.data.mapping.MappingMetadataTests; -import org.springframework.data.mapping.MappingMetadataTests.SampleMappingContext; -import org.springframework.data.mapping.MappingMetadataTests.SampleProperty; import org.springframework.data.mapping.PersistentEntity; +import org.springframework.data.mapping.context.SampleMappingContext; +import org.springframework.data.mapping.context.SamplePersistentProperty; import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; @@ -43,7 +42,7 @@ public class MappingContextTypeInformationMapperUnitTests { @Before public void setUp() { - mappingContext = new MappingMetadataTests.SampleMappingContext(); + mappingContext = new SampleMappingContext(); } @Test(expected = IllegalArgumentException.class) @@ -65,7 +64,7 @@ public class MappingContextTypeInformationMapperUnitTests { @Test public void extractsAliasForUnknownType() { - SampleMappingContext mappingContext = new MappingMetadataTests.SampleMappingContext(); + SampleMappingContext mappingContext = new SampleMappingContext(); mappingContext.initialize(); mapper = new MappingContextTypeInformationMapper(mappingContext); @@ -76,7 +75,7 @@ public class MappingContextTypeInformationMapperUnitTests { @Test public void doesNotReturnTypeAliasForSimpleType() { - SampleMappingContext mappingContext = new MappingMetadataTests.SampleMappingContext(); + SampleMappingContext mappingContext = new SampleMappingContext(); mappingContext.initialize(); mapper = new MappingContextTypeInformationMapper(mappingContext); @@ -87,13 +86,13 @@ public class MappingContextTypeInformationMapperUnitTests { @SuppressWarnings("rawtypes") public void detectsTypeForUnknownEntity() { - SampleMappingContext mappingContext = new MappingMetadataTests.SampleMappingContext(); + SampleMappingContext mappingContext = new SampleMappingContext(); mappingContext.initialize(); mapper = new MappingContextTypeInformationMapper(mappingContext); assertThat(mapper.resolveTypeFrom("foo"), is(nullValue())); - PersistentEntity entity = mappingContext.getPersistentEntity(Entity.class); + PersistentEntity entity = mappingContext.getPersistentEntity(Entity.class); assertThat(entity, is(notNullValue())); assertThat(mapper.resolveTypeFrom("foo"), is((TypeInformation) from(Entity.class))); diff --git a/src/test/java/org/springframework/data/mapping/MappingMetadataTests.java b/src/test/java/org/springframework/data/mapping/MappingMetadataTests.java index 5cd152961..795bc425f 100644 --- a/src/test/java/org/springframework/data/mapping/MappingMetadataTests.java +++ b/src/test/java/org/springframework/data/mapping/MappingMetadataTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2012 the original author or authors. + * Copyright 2011-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. @@ -17,18 +17,12 @@ package org.springframework.data.mapping; import static org.junit.Assert.*; -import java.beans.PropertyDescriptor; -import java.lang.reflect.Field; import java.util.Collections; import org.junit.Before; import org.junit.Test; -import org.springframework.data.mapping.context.AbstractMappingContext; -import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty; -import org.springframework.data.mapping.model.BasicPersistentEntity; -import org.springframework.data.mapping.model.MutablePersistentEntity; -import org.springframework.data.mapping.model.SimpleTypeHolder; -import org.springframework.data.util.TypeInformation; +import org.springframework.data.mapping.context.SampleMappingContext; +import org.springframework.data.mapping.context.SamplePersistentProperty; /** * Integration tests for Mapping metadata. @@ -51,7 +45,7 @@ public class MappingMetadataTests { ctx.setInitialEntitySet(Collections.singleton(PersonWithId.class)); ctx.initialize(); - PersistentEntity person = ctx.getPersistentEntity(PersonWithId.class); + PersistentEntity person = ctx.getPersistentEntity(PersonWithId.class); assertNotNull(person.getIdProperty()); assertEquals(String.class, person.getIdProperty().getType()); } @@ -62,46 +56,11 @@ public class MappingMetadataTests { ctx.setInitialEntitySet(Collections.singleton(PersonWithChildren.class)); ctx.initialize(); - PersistentEntity person = ctx.getPersistentEntity(PersonWithChildren.class); - person.doWithAssociations(new AssociationHandler() { - public void doWithAssociation(Association association) { + PersistentEntity person = ctx.getPersistentEntity(PersonWithChildren.class); + person.doWithAssociations(new AssociationHandler() { + public void doWithAssociation(Association association) { assertEquals(Child.class, association.getInverse().getComponentType()); } }); } - - public interface SampleProperty extends PersistentProperty { - } - - public static class SampleMappingContext extends - AbstractMappingContext, SampleProperty> { - - @Override - protected MutablePersistentEntity createPersistentEntity(TypeInformation typeInformation) { - - return new BasicPersistentEntity(typeInformation); - } - - @Override - protected SampleProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, - MutablePersistentEntity owner, SimpleTypeHolder simpleTypeHolder) { - return new SamplePropertyImpl(field, descriptor, owner, simpleTypeHolder); - } - } - - public static class SamplePropertyImpl extends AnnotationBasedPersistentProperty implements - SampleProperty { - - public SamplePropertyImpl(Field field, PropertyDescriptor propertyDescriptor, - PersistentEntity owner, SimpleTypeHolder simpleTypeHolder) { - - super(field, propertyDescriptor, owner, simpleTypeHolder); - } - - @Override - protected Association createAssociation() { - - return new Association(this, null); - } - } } diff --git a/src/test/java/org/springframework/data/mapping/context/SampleMappingContext.java b/src/test/java/org/springframework/data/mapping/context/SampleMappingContext.java index 7c603ea74..3ad3e4d49 100644 --- a/src/test/java/org/springframework/data/mapping/context/SampleMappingContext.java +++ b/src/test/java/org/springframework/data/mapping/context/SampleMappingContext.java @@ -7,7 +7,7 @@ import org.springframework.data.mapping.model.BasicPersistentEntity; import org.springframework.data.mapping.model.SimpleTypeHolder; import org.springframework.data.util.TypeInformation; -class SampleMappingContext extends +public class SampleMappingContext extends AbstractMappingContext, SamplePersistentProperty> { @Override diff --git a/src/test/java/org/springframework/data/mapping/context/SamplePersistentProperty.java b/src/test/java/org/springframework/data/mapping/context/SamplePersistentProperty.java index 1cba0f8ac..b089b0eb4 100644 --- a/src/test/java/org/springframework/data/mapping/context/SamplePersistentProperty.java +++ b/src/test/java/org/springframework/data/mapping/context/SamplePersistentProperty.java @@ -23,7 +23,7 @@ import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty; import org.springframework.data.mapping.model.BasicPersistentEntity; import org.springframework.data.mapping.model.SimpleTypeHolder; -class SamplePersistentProperty extends AnnotationBasedPersistentProperty { +public class SamplePersistentProperty extends AnnotationBasedPersistentProperty { public SamplePersistentProperty(Field field, PropertyDescriptor propertyDescriptor, BasicPersistentEntity owner, SimpleTypeHolder simpleTypeHolder) { diff --git a/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java b/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java new file mode 100644 index 000000000..3df79a599 --- /dev/null +++ b/src/test/java/org/springframework/data/mapping/model/AbstractAnnotationBasedPropertyUnitTests.java @@ -0,0 +1,123 @@ +/* + * 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.mapping.model; + +import static java.lang.annotation.ElementType.*; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + +import java.lang.annotation.Annotation; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.junit.Before; +import org.junit.Test; +import org.springframework.data.annotation.Id; +import org.springframework.data.mapping.context.SampleMappingContext; +import org.springframework.data.mapping.context.SamplePersistentProperty; + +/** + * @author Oliver Gierke + */ +public class AbstractAnnotationBasedPropertyUnitTests

> { + + BasicPersistentEntity entity; + + @Before + public void setUp() { + + SampleMappingContext context = new SampleMappingContext(); + entity = context.getPersistentEntity(Sample.class); + } + + @Test + public void discoversAnnotationOnField() { + assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("field")); + } + + @Test + public void discoversAnnotationOnGetters() { + assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("getter")); + } + + @Test + public void discoversAnnotationOnSetters() { + assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("setter")); + } + + @Test + public void prefersAnnotationOnMethodsToOverride() { + MyAnnotation annotation = assertAnnotationPresent(MyAnnotation.class, entity.getPersistentProperty("override")); + assertThat(annotation.value(), is("method")); + } + + @Test + public void findsMetaAnnotation() { + + assertAnnotationPresent(MyId.class, entity.getPersistentProperty("id")); + assertAnnotationPresent(Id.class, entity.getPersistentProperty("id")); + } + + private A assertAnnotationPresent(Class annotationType, + AnnotationBasedPersistentProperty property) { + + A annotation = property.findAnnotation(annotationType); + assertThat(annotation, is(notNullValue())); + return annotation; + } + + static class Sample { + + @MyId + String id; + + @MyAnnotation + String field; + String getter; + String setter; + + @MyAnnotation("field") + String override; + + @MyAnnotation + public String getGetter() { + return getter; + } + + @MyAnnotation + public void setSetter(String setter) { + this.setter = setter; + } + + @MyAnnotation("method") + public String getOverride() { + return override; + } + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) + public static @interface MyAnnotation { + String value() default ""; + } + + @Retention(RetentionPolicy.RUNTIME) + @Target(value = { FIELD, METHOD, ANNOTATION_TYPE }) + @Id + public static @interface MyId { + } +} diff --git a/src/test/java/org/springframework/data/mapping/model/MappingContextIsNewStrategyFactoryUnitTests.java b/src/test/java/org/springframework/data/mapping/model/MappingContextIsNewStrategyFactoryUnitTests.java index e0f8d963b..4bb752718 100644 --- a/src/test/java/org/springframework/data/mapping/model/MappingContextIsNewStrategyFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/mapping/model/MappingContextIsNewStrategyFactoryUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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. @@ -23,7 +23,7 @@ import org.junit.Test; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Version; import org.springframework.data.domain.Persistable; -import org.springframework.data.mapping.MappingMetadataTests.SampleMappingContext; +import org.springframework.data.mapping.context.SampleMappingContext; import org.springframework.data.mapping.model.MappingContextIsNewStrategyFactory.PropertyIsNullIsNewStrategy; import org.springframework.data.mapping.model.MappingContextIsNewStrategyFactory.PropertyIsNullOrZeroNumberIsNewStrategy; import org.springframework.data.support.IsNewStrategy; diff --git a/src/test/java/org/springframework/data/repository/support/RepositoriesUnitTests.java b/src/test/java/org/springframework/data/repository/support/RepositoriesUnitTests.java index 0060ae281..5517b442c 100644 --- a/src/test/java/org/springframework/data/repository/support/RepositoriesUnitTests.java +++ b/src/test/java/org/springframework/data/repository/support/RepositoriesUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 the original author or authors. + * 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 @@ -33,8 +33,8 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.context.ApplicationContext; -import org.springframework.data.mapping.MappingMetadataTests.SampleMappingContext; import org.springframework.data.mapping.PersistentEntity; +import org.springframework.data.mapping.context.SampleMappingContext; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.Repository; import org.springframework.data.repository.core.EntityInformation;