15
15
*/
16
16
package org .springframework .data .jpa .repository .support ;
17
17
18
+ import static org .assertj .core .api .Assertions .*;
19
+
20
+ import jakarta .persistence .EntityManager ;
21
+ import jakarta .persistence .PersistenceContext ;
22
+
23
+ import java .util .List ;
24
+
25
+ import org .junit .jupiter .api .BeforeEach ;
18
26
import org .junit .jupiter .api .Disabled ;
27
+ import org .junit .jupiter .api .Test ;
28
+
29
+ import org .springframework .data .jpa .domain .sample .User ;
19
30
import org .springframework .test .context .ContextConfiguration ;
20
31
21
32
/**
22
33
* Integration tests to execute {@link JpaRepositoryTests} against EclipseLink.
23
34
*
24
35
* @author Oliver Gierke
25
36
* @author Greg Turnquist
37
+ * @author Mark Paluch
26
38
*/
27
39
@ ContextConfiguration ("classpath:eclipselink.xml" )
28
40
class EclipseLinkJpaRepositoryTests extends JpaRepositoryTests {
29
41
42
+ @ PersistenceContext EntityManager em ;
43
+
44
+ SimpleJpaRepository <User , Integer > repository ;
45
+ User firstUser , secondUser ;
46
+
47
+ @ BeforeEach
48
+ @ Override
49
+ void setUp () {
50
+
51
+ super .setUp ();
52
+
53
+ repository = new SimpleJpaRepository <>(User .class , em );
54
+
55
+ firstUser =
new User (
"Oliver" ,
"Gierke" ,
"[email protected] " );
56
+ firstUser .setAge (28 );
57
+ secondUser =
new User (
"Joachim" ,
"Arrasz" ,
"[email protected] " );
58
+ secondUser .setAge (35 );
59
+
60
+ repository .deleteAll ();
61
+ repository .saveAllAndFlush (List .of (firstUser , secondUser ));
62
+ }
63
+
64
+ @ Test // GH-3990
65
+ void deleteAllBySimpleIdInBatch () {
66
+
67
+ repository .deleteAllByIdInBatch (List .of (firstUser .getId (), secondUser .getId ()));
68
+
69
+ assertThat (repository .count ()).isZero ();
70
+ }
71
+
72
+ @ Test // GH-3990
73
+ void deleteAllInBatch () {
74
+
75
+ repository .deleteAllInBatch (List .of (firstUser , secondUser ));
76
+
77
+ assertThat (repository .count ()).isZero ();
78
+ }
79
+
30
80
@ Override
31
81
@ Disabled ("https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477" )
32
82
void deleteAllByIdInBatch () {
@@ -38,4 +88,5 @@ void deleteAllByIdInBatch() {
38
88
void deleteAllByIdInBatchShouldConvertAnIterableToACollection () {
39
89
// disabled
40
90
}
91
+
41
92
}
0 commit comments