Skip to content

Commit 56ece61

Browse files
committed
Polishing.
See /issues/1041 Original pull request spring-projects/spring-data-r2dbc/pull/720
1 parent 910c340 commit 56ece61

File tree

5 files changed

+78
-73
lines changed

5 files changed

+78
-73
lines changed

spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/core/StatementMapper.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
*/
1616
package org.springframework.data.r2dbc.core;
1717

18-
import java.util.*;
18+
import java.util.ArrayList;
19+
import java.util.Arrays;
20+
import java.util.Collection;
21+
import java.util.Collections;
22+
import java.util.LinkedHashMap;
23+
import java.util.List;
24+
import java.util.Map;
1925
import java.util.function.BiFunction;
2026
import java.util.function.Supplier;
2127
import java.util.stream.Collectors;

spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public String renderForGeneratedValues(SqlIdentifier identifier) {
2323
return identifier.getReference(getIdentifierProcessing());
2424
}
2525

26-
/*
27-
* (non-Javadoc)
28-
* @see org.springframework.data.relational.core.dialect.Dialect#lock()
29-
*/
3026
@Override
3127
public LockClause lock() {
3228
// H2 Dialect does not support the same lock keywords as PostgreSQL, but it supports the ANSI SQL standard.

spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/repository/query/R2dbcQueryCreator.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,16 @@ private Expression[] getSelectProjection() {
158158
for (String projectedProperty : projectedProperties) {
159159

160160
RelationalPersistentProperty property = entity.getPersistentProperty(projectedProperty);
161-
Column column = table
162-
.column(property != null ? property.getColumnName() : SqlIdentifier.unquoted(projectedProperty));
161+
Column column = table.column(property != null //
162+
? property.getColumnName() //
163+
: SqlIdentifier.unquoted(projectedProperty));
163164
expressions.add(column);
164165
}
165166

166167
} else if (tree.isExistsProjection()) {
167168

168-
expressions = dataAccessStrategy.getIdentifierColumns(entityToRead).stream().map(table::column)
169+
expressions = dataAccessStrategy.getIdentifierColumns(entityToRead).stream() //
170+
.map(table::column) //
169171
.collect(Collectors.toList());
170172
} else if (tree.isCountProjection()) {
171173

@@ -175,7 +177,8 @@ private Expression[] getSelectProjection() {
175177

176178
expressions = Collections.singletonList(Functions.count(countExpression));
177179
} else {
178-
expressions = dataAccessStrategy.getAllColumns(entityToRead).stream().map(table::column)
180+
expressions = dataAccessStrategy.getAllColumns(entityToRead).stream() //
181+
.map(table::column) //
179182
.collect(Collectors.toList());
180183
}
181184

spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/repository/AbstractR2dbcRepositoryIntegrationTests.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void before() {
112112

113113
protected abstract Class<? extends LegoSetRepository> getRepositoryInterfaceType();
114114

115-
@Test
115+
@Test // GH-2
116116
void shouldInsertNewItems() {
117117

118118
LegoSet legoSet1 = new LegoSet(null, "SCHAUFELRADBAGGER", 12, true);
@@ -124,7 +124,7 @@ void shouldInsertNewItems() {
124124
.verifyComplete();
125125
}
126126

127-
@Test
127+
@Test // GH-2
128128
void shouldFindItemsByManual() {
129129

130130
shouldInsertNewItems();
@@ -137,7 +137,7 @@ void shouldFindItemsByManual() {
137137
.verifyComplete();
138138
}
139139

140-
@Test
140+
@Test // GH-2
141141
void shouldFindItemsByNameContains() {
142142

143143
shouldInsertNewItems();
@@ -151,7 +151,7 @@ void shouldFindItemsByNameContains() {
151151
}).verifyComplete();
152152
}
153153

154-
@Test // gh-475, gh-607
154+
@Test // GH-475, GH-607
155155
void shouldFindApplyingInterfaceProjection() {
156156

157157
shouldInsertNewItems();
@@ -173,7 +173,7 @@ void shouldFindApplyingInterfaceProjection() {
173173
}).verifyComplete();
174174
}
175175

176-
@Test // gh-475
176+
@Test // GH-475
177177
void shouldByStringQueryApplyingDtoProjection() {
178178

179179
shouldInsertNewItems();
@@ -187,7 +187,7 @@ void shouldByStringQueryApplyingDtoProjection() {
187187
}).verifyComplete();
188188
}
189189

190-
@Test // gh-344
190+
@Test // GH-344
191191
void shouldFindApplyingDistinctProjection() {
192192

193193
LegoSet legoSet1 = new LegoSet(null, "SCHAUFELRADBAGGER", 12, true);
@@ -207,7 +207,7 @@ void shouldFindApplyingDistinctProjection() {
207207
}).verifyComplete();
208208
}
209209

210-
@Test // gh-41
210+
@Test // GH-41
211211
void shouldFindApplyingSimpleTypeProjection() {
212212

213213
shouldInsertNewItems();
@@ -220,7 +220,7 @@ void shouldFindApplyingSimpleTypeProjection() {
220220
}).verifyComplete();
221221
}
222222

223-
@Test // gh-698
223+
@Test // GH-698
224224
void shouldBeTrue() {
225225
shouldInsertNewItems();
226226

@@ -246,7 +246,7 @@ void shouldDeleteUsingQueryMethod() {
246246
assertThat(getCount(count)).satisfies(numberOf(1));
247247
}
248248

249-
@Test // gh-335
249+
@Test // GH-335
250250
void shouldFindByPageable() {
251251

252252
Flux<LegoSet> sets = Flux.fromStream(IntStream.range(0, 100).mapToObj(value -> {
@@ -275,7 +275,7 @@ void shouldFindByPageable() {
275275
}).verifyComplete();
276276
}
277277

278-
@Test // gh-335
278+
@Test // GH-335
279279
void shouldFindTop10() {
280280

281281
Flux<LegoSet> sets = Flux
@@ -292,7 +292,7 @@ void shouldFindTop10() {
292292
.verifyComplete();
293293
}
294294

295-
@Test // gh-341
295+
@Test // GH-341
296296
void shouldDeleteAll() {
297297

298298
shouldInsertNewItems();
@@ -306,7 +306,7 @@ void shouldDeleteAll() {
306306
.verifyComplete();
307307
}
308308

309-
@Test
309+
@Test // GH-2
310310
public void shouldInsertItemsTransactional() {
311311

312312
R2dbcTransactionManager r2dbcTransactionManager = new R2dbcTransactionManager(connectionFactory);
@@ -330,7 +330,7 @@ public void shouldInsertItemsTransactional() {
330330
assertThat(getCount(map)).satisfies(numberOf(2));
331331
}
332332

333-
@Test // gh-363
333+
@Test // GH-363
334334
void derivedQueryWithCountProjection() {
335335

336336
shouldInsertNewItems();
@@ -341,7 +341,7 @@ void derivedQueryWithCountProjection() {
341341
.verifyComplete();
342342
}
343343

344-
@Test // gh-363
344+
@Test // GH-363
345345
void derivedQueryWithCount() {
346346

347347
shouldInsertNewItems();
@@ -352,7 +352,7 @@ void derivedQueryWithCount() {
352352
.verifyComplete();
353353
}
354354

355-
@Test // gh-468
355+
@Test // GH-468
356356
void derivedQueryWithExists() {
357357

358358
shouldInsertNewItems();
@@ -368,7 +368,7 @@ void derivedQueryWithExists() {
368368
.verifyComplete();
369369
}
370370

371-
@Test // gh-421
371+
@Test // GH-421
372372
void shouldDeleteAllAndReturnCount() {
373373

374374
shouldInsertNewItems();
@@ -383,7 +383,7 @@ void shouldDeleteAllAndReturnCount() {
383383
.verifyComplete();
384384
}
385385

386-
@Test
386+
@Test // GH-1041
387387
void getAllByNameWithWriteLock() {
388388

389389
shouldInsertNewItems();
@@ -396,7 +396,7 @@ void getAllByNameWithWriteLock() {
396396
.verifyComplete();
397397
}
398398

399-
@Test
399+
@Test // GH-1041
400400
void findByNameAndFlagWithReadLock() {
401401

402402
shouldInsertNewItems();

0 commit comments

Comments
 (0)