|
|
|
|
@@ -102,7 +102,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
dataAccessStrategy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttribute() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstName", String.class);
|
|
|
|
|
@@ -114,7 +114,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryWithIsNullCondition() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstName", String.class);
|
|
|
|
|
@@ -126,7 +126,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name IS NULL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryWithLimitForExistsProjection() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("existsByFirstName", String.class);
|
|
|
|
|
@@ -138,7 +138,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + TABLE + ".id FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1 LIMIT 1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByTwoStringAttributes() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByLastNameAndFirstName", String.class, String.class);
|
|
|
|
|
@@ -151,7 +151,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
+ ".last_name = $1 AND (" + TABLE + ".first_name = $2)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByOneOfTwoStringAttributes() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByLastNameOrFirstName", String.class, String.class);
|
|
|
|
|
@@ -164,7 +164,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
+ ".last_name = $1 OR (" + TABLE + ".first_name = $2)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282, gh-349
|
|
|
|
|
@Test // GH-282, gh-349
|
|
|
|
|
void createsQueryToFindAllEntitiesByDateAttributeBetween() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByDateOfBirthBetween", Date.class, Date.class);
|
|
|
|
|
@@ -185,7 +185,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
verify(bindTarget, times(1)).bind(1, to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeLessThan() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeLessThan", Integer.class);
|
|
|
|
|
@@ -198,7 +198,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age < $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeLessThanEqual() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeLessThanEqual", Integer.class);
|
|
|
|
|
@@ -211,7 +211,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age <= $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeGreaterThan() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeGreaterThan", Integer.class);
|
|
|
|
|
@@ -224,7 +224,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age > $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeGreaterThanEqual() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeGreaterThanEqual", Integer.class);
|
|
|
|
|
@@ -237,7 +237,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age >= $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByDateAttributeAfter() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByDateOfBirthAfter", Date.class);
|
|
|
|
|
@@ -250,7 +250,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".date_of_birth > $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByDateAttributeBefore() throws Exception {
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByDateOfBirthBefore", Date.class);
|
|
|
|
|
PartTreeR2dbcQuery r2dbcQuery = new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter,
|
|
|
|
|
@@ -262,7 +262,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".date_of_birth < $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeIsNull() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeIsNull");
|
|
|
|
|
@@ -275,7 +275,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age IS NULL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeIsNotNull() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeIsNotNull");
|
|
|
|
|
@@ -288,7 +288,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age IS NOT NULL");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeLike() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameLike", String.class);
|
|
|
|
|
@@ -301,7 +301,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeNotLike() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameNotLike", String.class);
|
|
|
|
|
@@ -314,7 +314,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name NOT LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeStartingWith() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameStartingWith", String.class);
|
|
|
|
|
@@ -327,7 +327,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void appendsLikeOperatorParameterWithPercentSymbolForStartingWithQuery() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameStartingWith", String.class);
|
|
|
|
|
@@ -341,7 +341,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
verify(bindTarget, times(1)).bind(0, "Jo%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeEndingWith() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameEndingWith", String.class);
|
|
|
|
|
@@ -354,7 +354,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void prependsLikeOperatorParameterWithPercentSymbolForEndingWithQuery() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameEndingWith", String.class);
|
|
|
|
|
@@ -368,7 +368,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
verify(bindTarget, times(1)).bind(0, "%hn");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeContaining() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameContaining", String.class);
|
|
|
|
|
@@ -381,7 +381,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void wrapsLikeOperatorParameterWithPercentSymbolsForContainingQuery() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameContaining", String.class);
|
|
|
|
|
@@ -395,7 +395,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
verify(bindTarget, times(1)).bind(0, "%oh%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeNotContaining() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameNotContaining", String.class);
|
|
|
|
|
@@ -408,7 +408,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name NOT LIKE $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void wrapsLikeOperatorParameterWithPercentSymbolsForNotContainingQuery() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameNotContaining", String.class);
|
|
|
|
|
@@ -422,7 +422,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
verify(bindTarget, times(1)).bind(0, "%oh%");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeWithDescendingOrderingByStringAttribute()
|
|
|
|
|
throws Exception {
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeOrderByLastNameDesc", Integer.class);
|
|
|
|
|
@@ -436,7 +436,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
"SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY users.last_name DESC");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeWithAscendingOrderingByStringAttribute() throws Exception {
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeOrderByLastNameAsc", Integer.class);
|
|
|
|
|
PartTreeR2dbcQuery r2dbcQuery = new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter,
|
|
|
|
|
@@ -449,7 +449,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
"SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age = $1 ORDER BY users.last_name ASC");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeNot() throws Exception {
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByLastNameNot", String.class);
|
|
|
|
|
PartTreeR2dbcQuery r2dbcQuery = new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter,
|
|
|
|
|
@@ -461,7 +461,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".last_name != $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeIn() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeIn", Collection.class);
|
|
|
|
|
@@ -475,7 +475,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age IN ($1)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByIntegerAttributeNotIn() throws Exception {
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByAgeNotIn", Collection.class);
|
|
|
|
|
PartTreeR2dbcQuery r2dbcQuery = new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter,
|
|
|
|
|
@@ -488,7 +488,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".age NOT IN ($1)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282, gh-698
|
|
|
|
|
@Test // GH-282, gh-698
|
|
|
|
|
void createsQueryToFindAllEntitiesByBooleanAttributeTrue() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByActiveTrue");
|
|
|
|
|
@@ -501,7 +501,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".active = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282, gh-698
|
|
|
|
|
@Test // GH-282, gh-698
|
|
|
|
|
void createsQueryToFindAllEntitiesByBooleanAttributeFalse() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByActiveFalse");
|
|
|
|
|
@@ -514,7 +514,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".active = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeIgnoringCase() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameIgnoreCase", String.class);
|
|
|
|
|
@@ -527,7 +527,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE UPPER(" + TABLE + ".first_name) = UPPER($1)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void throwsExceptionWhenIgnoringCaseIsImpossible() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findByIdIgnoringCase", Long.class);
|
|
|
|
|
@@ -538,7 +538,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isThrownBy(() -> createQuery(r2dbcQuery, getAccessor(queryMethod, new Object[] { 1L })));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void throwsExceptionWhenInPredicateHasNonIterableParameter() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByIdIn", Long.class);
|
|
|
|
|
@@ -547,7 +547,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isThrownBy(() -> new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter, dataAccessStrategy));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void throwsExceptionWhenSimplePropertyPredicateHasIterableParameter() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllById", Collection.class);
|
|
|
|
|
@@ -556,7 +556,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isThrownBy(() -> new PartTreeR2dbcQuery(queryMethod, operations, r2dbcConverter, dataAccessStrategy));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void throwsExceptionWhenConditionKeywordIsUnsupported() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByIdIsEmpty");
|
|
|
|
|
@@ -567,7 +567,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isThrownBy(() -> createQuery(r2dbcQuery, getAccessor(queryMethod, new Object[0])));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void throwsExceptionWhenInvalidNumberOfParameterIsGiven() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstName", String.class);
|
|
|
|
|
@@ -578,7 +578,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isThrownBy(() -> createQuery(r2dbcQuery, getAccessor(queryMethod, new Object[0])));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryWithLimitToFindEntitiesByStringAttribute() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findTop3ByFirstName", String.class);
|
|
|
|
|
@@ -591,7 +591,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1 LIMIT 3");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-282
|
|
|
|
|
@Test // GH-282
|
|
|
|
|
void createsQueryToFindFirstEntityByStringAttribute() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findFirstByFirstName", String.class);
|
|
|
|
|
@@ -604,7 +604,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT " + ALL_FIELDS + " FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1 LIMIT 1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-341
|
|
|
|
|
@Test // GH-341
|
|
|
|
|
void createsQueryToDeleteByFirstName() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("deleteByFirstName", String.class);
|
|
|
|
|
@@ -616,7 +616,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
assertThat(preparedOperation.get()).isEqualTo("DELETE FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-344
|
|
|
|
|
@Test // GH-344
|
|
|
|
|
void createsQueryToFindAllEntitiesByStringAttributeWithDistinct() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findDistinctByFirstName", String.class);
|
|
|
|
|
@@ -628,7 +628,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
+ ".foo FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-475
|
|
|
|
|
@Test // GH-475
|
|
|
|
|
void createsQueryToFindByOpenProjection() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findOpenProjectionBy");
|
|
|
|
|
@@ -641,7 +641,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
+ TABLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-475
|
|
|
|
|
@Test // GH-475
|
|
|
|
|
void createsDtoProjectionQuery() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAsDtoProjectionBy");
|
|
|
|
|
@@ -654,7 +654,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
+ TABLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-363
|
|
|
|
|
@Test // GH-363
|
|
|
|
|
void createsQueryForCountProjection() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("countByFirstName", String.class);
|
|
|
|
|
@@ -666,7 +666,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
.isEqualTo("SELECT COUNT(users.id) FROM " + TABLE + " WHERE " + TABLE + ".first_name = $1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-1041
|
|
|
|
|
@Test // GH-1041
|
|
|
|
|
void createQueryWithPessimisticWriteLock() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameAndLastName", String.class, String.class);
|
|
|
|
|
@@ -681,7 +681,7 @@ class PartTreeR2dbcQueryUnitTests {
|
|
|
|
|
"SELECT users.id, users.first_name, users.last_name, users.date_of_birth, users.age, users.active FROM users WHERE users.first_name = $1 AND (users.last_name = $2) FOR UPDATE OF users");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // gh-1041
|
|
|
|
|
@Test // GH-1041
|
|
|
|
|
void createQueryWithPessimisticReadLock() throws Exception {
|
|
|
|
|
|
|
|
|
|
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstNameAndAge", String.class, Integer.class);
|
|
|
|
|
|