Clean up : Updated Tests which was causing build failure

This commit is contained in:
Mohsin Husen 2013-05-15 18:16:46 +01:00
parent 7f1d26dac3
commit 54c897be0b
2 changed files with 22 additions and 5 deletions

View File

@ -19,7 +19,9 @@ import org.apache.commons.lang.math.RandomUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.DoubleIDEntity;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.repositories.DoubleIDRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -41,9 +43,15 @@ public class DoubleIDRepositoryTests {
@Resource
private DoubleIDRepository repository;
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
@Before
public void before() {
repository.deleteAll();
elasticsearchTemplate.deleteIndex(DoubleIDEntity.class);
elasticsearchTemplate.createIndex(DoubleIDEntity.class);
elasticsearchTemplate.refresh(DoubleIDEntity.class, true);
}
@Test

View File

@ -19,7 +19,10 @@ import org.apache.commons.lang.math.RandomUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.DoubleIDEntity;
import org.springframework.data.elasticsearch.IntegerIDEntity;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.repositories.IntegerIDRepository;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ -41,10 +44,16 @@ public class IntegerIDRepositoryTests {
@Resource
private IntegerIDRepository repository;
@Before
public void before() {
repository.deleteAll();
}
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
@Before
public void before() {
elasticsearchTemplate.deleteIndex(IntegerIDEntity.class);
elasticsearchTemplate.createIndex(IntegerIDEntity.class);
elasticsearchTemplate.refresh(IntegerIDEntity.class, true);
}
@Test
public void shouldDoBulkIndexDocument() {