File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
src/test/java/org/springframework/data/elasticsearch/repository/support Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change 19
19
import org .junit .Before ;
20
20
import org .junit .Test ;
21
21
import org .junit .runner .RunWith ;
22
+ import org .springframework .beans .factory .annotation .Autowired ;
22
23
import org .springframework .data .elasticsearch .DoubleIDEntity ;
24
+ import org .springframework .data .elasticsearch .core .ElasticsearchTemplate ;
23
25
import org .springframework .data .elasticsearch .repositories .DoubleIDRepository ;
24
26
import org .springframework .test .context .ContextConfiguration ;
25
27
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
@@ -41,9 +43,15 @@ public class DoubleIDRepositoryTests {
41
43
@ Resource
42
44
private DoubleIDRepository repository ;
43
45
46
+ @ Autowired
47
+ private ElasticsearchTemplate elasticsearchTemplate ;
48
+
49
+
44
50
@ Before
45
51
public void before () {
46
- repository .deleteAll ();
52
+ elasticsearchTemplate .deleteIndex (DoubleIDEntity .class );
53
+ elasticsearchTemplate .createIndex (DoubleIDEntity .class );
54
+ elasticsearchTemplate .refresh (DoubleIDEntity .class , true );
47
55
}
48
56
49
57
@ Test
Original file line number Diff line number Diff line change 19
19
import org .junit .Before ;
20
20
import org .junit .Test ;
21
21
import org .junit .runner .RunWith ;
22
+ import org .springframework .beans .factory .annotation .Autowired ;
23
+ import org .springframework .data .elasticsearch .DoubleIDEntity ;
22
24
import org .springframework .data .elasticsearch .IntegerIDEntity ;
25
+ import org .springframework .data .elasticsearch .core .ElasticsearchTemplate ;
23
26
import org .springframework .data .elasticsearch .repositories .IntegerIDRepository ;
24
27
import org .springframework .test .context .ContextConfiguration ;
25
28
import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
@@ -41,10 +44,16 @@ public class IntegerIDRepositoryTests {
41
44
@ Resource
42
45
private IntegerIDRepository repository ;
43
46
44
- @ Before
45
- public void before () {
46
- repository .deleteAll ();
47
- }
47
+ @ Autowired
48
+ private ElasticsearchTemplate elasticsearchTemplate ;
49
+
50
+
51
+ @ Before
52
+ public void before () {
53
+ elasticsearchTemplate .deleteIndex (IntegerIDEntity .class );
54
+ elasticsearchTemplate .createIndex (IntegerIDEntity .class );
55
+ elasticsearchTemplate .refresh (IntegerIDEntity .class , true );
56
+ }
48
57
49
58
@ Test
50
59
public void shouldDoBulkIndexDocument () {
You can’t perform that action at this time.
0 commit comments