Skip to content

Commit 54c897b

Browse files
committed
Clean up : Updated Tests which was causing build failure
1 parent 7f1d26d commit 54c897b

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/test/java/org/springframework/data/elasticsearch/repository/support/DoubleIDRepositoryTests.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import org.junit.Before;
2020
import org.junit.Test;
2121
import org.junit.runner.RunWith;
22+
import org.springframework.beans.factory.annotation.Autowired;
2223
import org.springframework.data.elasticsearch.DoubleIDEntity;
24+
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
2325
import org.springframework.data.elasticsearch.repositories.DoubleIDRepository;
2426
import org.springframework.test.context.ContextConfiguration;
2527
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -41,9 +43,15 @@ public class DoubleIDRepositoryTests {
4143
@Resource
4244
private DoubleIDRepository repository;
4345

46+
@Autowired
47+
private ElasticsearchTemplate elasticsearchTemplate;
48+
49+
4450
@Before
4551
public void before() {
46-
repository.deleteAll();
52+
elasticsearchTemplate.deleteIndex(DoubleIDEntity.class);
53+
elasticsearchTemplate.createIndex(DoubleIDEntity.class);
54+
elasticsearchTemplate.refresh(DoubleIDEntity.class, true);
4755
}
4856

4957
@Test

src/test/java/org/springframework/data/elasticsearch/repository/support/IntegerIDRepositoryTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
import org.junit.Before;
2020
import org.junit.Test;
2121
import org.junit.runner.RunWith;
22+
import org.springframework.beans.factory.annotation.Autowired;
23+
import org.springframework.data.elasticsearch.DoubleIDEntity;
2224
import org.springframework.data.elasticsearch.IntegerIDEntity;
25+
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
2326
import org.springframework.data.elasticsearch.repositories.IntegerIDRepository;
2427
import org.springframework.test.context.ContextConfiguration;
2528
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -41,10 +44,16 @@ public class IntegerIDRepositoryTests {
4144
@Resource
4245
private IntegerIDRepository repository;
4346

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+
}
4857

4958
@Test
5059
public void shouldDoBulkIndexDocument() {

0 commit comments

Comments
 (0)