diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java index d864e6814..61890370b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java @@ -21,6 +21,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.core.annotation.AliasFor; import org.springframework.data.annotation.QueryAnnotation; /** @@ -36,28 +37,40 @@ public @interface Meta { /** * Set the maximum time limit in milliseconds for processing operations. - * + * + * @deprecated since 1.10 because of spelling issues. Please use {@link #maxExecutionTimeMs()} instead. * @return */ + @AliasFor("maxExecutionTimeMs") + @Deprecated long maxExcecutionTime() default -1; + /** + * Set the maximum time limit in milliseconds for processing operations. + * + * @return + * @since 1.10 + */ + @AliasFor("maxExcecutionTime") + long maxExecutionTimeMs() default -1; + /** * Only scan the specified number of documents. - * + * * @return */ long maxScanDocuments() default -1; /** * Add a comment to the query. - * + * * @return */ String comment() default ""; /** * Using snapshot prevents the cursor from returning a document more than once. - * + * * @return */ boolean snapshot() default false; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java index e591d6687..efea28a23 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/query/MongoQueryMethodUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 the original author or authors. + * Copyright 2011-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. @@ -43,9 +43,10 @@ import org.springframework.data.repository.core.support.DefaultRepositoryMetadat /** * Unit test for {@link MongoQueryMethod}. - * + * * @author Oliver Gierke * @author Christoph Strobl + * @author Mark Paluch */ public class MongoQueryMethodUnitTests { @@ -151,6 +152,19 @@ public class MongoQueryMethodUnitTests { assertThat(method.getQueryMetaAttributes().getMaxTimeMsec(), is(100L)); } + + /** + * @see DATAMONGO-1403 + */ + @Test + public void createsMongoQueryMethodWithSpellFixedMaxExecutionTimeCorrectly() throws Exception { + + MongoQueryMethod method = queryMethod(PersonRepository.class, "metaWithSpellFixedMaxExecutionTime"); + + assertThat(method.hasQueryMetaAttributes(), is(true)); + assertThat(method.getQueryMetaAttributes().getMaxTimeMsec(), is(100L)); + } + /** * @see DATAMONGO-957 */ @@ -224,6 +238,9 @@ public class MongoQueryMethodUnitTests { @Meta(maxExcecutionTime = 100) List metaWithMaxExecutionTime(); + @Meta(maxExecutionTimeMs = 100) + List metaWithSpellFixedMaxExecutionTime(); + @Meta(maxScanDocuments = 10) List metaWithMaxScan();