DATAMONGO-1403 - Add maxExecutionTimeMs alias for @Meta(maxExcecutionTime).
We added maxExecutionTimeMs as an alias for maxExcecutionTime which has been deprecated due to spelling issues. Original pull request: #356.
This commit is contained in:
committed by
Christoph Strobl
parent
f5cfcda673
commit
13a52b5ac9
@@ -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;
|
||||
|
||||
@@ -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<User> metaWithMaxExecutionTime();
|
||||
|
||||
@Meta(maxExecutionTimeMs = 100)
|
||||
List<User> metaWithSpellFixedMaxExecutionTime();
|
||||
|
||||
@Meta(maxScanDocuments = 10)
|
||||
List<User> metaWithMaxScan();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user