mirror of
				https://github.com/spring-projects/spring-data-elasticsearch.git
				synced 2025-10-30 22:28:47 +00:00 
			
		
		
		
	DATAES-55 - polish test cases and remove unwanted files
This commit is contained in:
		
							parent
							
								
									19105dcb70
								
							
						
					
					
						commit
						ea45aba8be
					
				| @ -0,0 +1,80 @@ | ||||
| /* | ||||
|  * Copyright 2014 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.core.query; | ||||
| 
 | ||||
| /** | ||||
|  * IndexQuery Builder | ||||
|  * | ||||
|  * @author Rizwan Idrees | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| public class IndexQueryBuilder { | ||||
| 
 | ||||
| 	private String id; | ||||
| 	private Object object; | ||||
| 	private Long version; | ||||
| 	private String indexName; | ||||
| 	private String type; | ||||
| 	private String source; | ||||
| 	private String parentId; | ||||
| 
 | ||||
| 	public IndexQueryBuilder withId(String id) { | ||||
| 		this.id = id; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withObject(Object object) { | ||||
| 		this.object = object; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withVersion(Long version) { | ||||
| 		this.version = version; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withIndexName(String indexName) { | ||||
| 		this.indexName = indexName; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withType(String type) { | ||||
| 		this.type = type; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withSource(String source) { | ||||
| 		this.source = source; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQueryBuilder withParentId(String parentId) { | ||||
| 		this.parentId = parentId; | ||||
| 		return this; | ||||
| 	} | ||||
| 
 | ||||
| 	public IndexQuery build() { | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(id); | ||||
| 		indexQuery.setIndexName(indexName); | ||||
| 		indexQuery.setType(type); | ||||
| 		indexQuery.setObject(object); | ||||
| 		indexQuery.setParentId(parentId); | ||||
| 		indexQuery.setSource(source); | ||||
| 		indexQuery.setVersion(version); | ||||
| 		return indexQuery; | ||||
| 	} | ||||
| } | ||||
| @ -25,6 +25,8 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.Author; | ||||
| import org.springframework.data.elasticsearch.entities.Book; | ||||
| import org.springframework.data.elasticsearch.repositories.book.SampleElasticSearchBookRepository; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
|  | ||||
| @ -35,6 +35,7 @@ import org.springframework.data.elasticsearch.core.query.GetQuery; | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | ||||
| import org.springframework.data.elasticsearch.core.query.SearchQuery; | ||||
| import org.springframework.data.elasticsearch.entities.*; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
| @ -254,7 +255,7 @@ public class NestedObjectTests { | ||||
| 		javaAuthor.setName("javaAuthor"); | ||||
| 		java.setAuthor(javaAuthor); | ||||
| 
 | ||||
| 		Book spring= new Book(); | ||||
| 		Book spring = new Book(); | ||||
| 		spring.setId("2"); | ||||
| 		spring.setName("spring"); | ||||
| 		Author springAuthor = new Author(); | ||||
| @ -299,6 +300,5 @@ public class NestedObjectTests { | ||||
| 		List<Person> persons = elasticsearchTemplate.queryForList(searchQuery, Person.class); | ||||
| 
 | ||||
| 		assertThat(persons.size(), is(1)); | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -13,7 +13,9 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.builder; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.entities.Car; | ||||
| 
 | ||||
| /** | ||||
|  * @author Artur Konczak | ||||
| @ -13,9 +13,10 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.builder; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| 
 | ||||
| /** | ||||
|  * @author Rizwan Idrees | ||||
| @ -13,11 +13,12 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.builder; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| import org.springframework.data.elasticsearch.entities.StockPrice; | ||||
| 
 | ||||
| /** | ||||
|  * @author Artur Konczak | ||||
| @ -22,8 +22,8 @@ import java.io.IOException; | ||||
| 
 | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.springframework.data.elasticsearch.Car; | ||||
| import org.springframework.data.elasticsearch.CarBuilder; | ||||
| import org.springframework.data.elasticsearch.builder.CarBuilder; | ||||
| import org.springframework.data.elasticsearch.entities.Car; | ||||
| 
 | ||||
| /** | ||||
|  * @author Artur Konczak | ||||
|  | ||||
| @ -34,7 +34,7 @@ import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.mockito.Mock; | ||||
| import org.mockito.MockitoAnnotations; | ||||
| import org.springframework.data.elasticsearch.Car; | ||||
| import org.springframework.data.elasticsearch.entities.Car; | ||||
| 
 | ||||
| /** | ||||
|  * @author Artur Konczak | ||||
|  | ||||
| @ -28,10 +28,10 @@ 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.ParentEntity; | ||||
| import org.springframework.data.elasticsearch.ParentEntity.ChildEntity; | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| import org.springframework.data.elasticsearch.core.query.NativeSearchQuery; | ||||
| import org.springframework.data.elasticsearch.entities.ParentEntity; | ||||
| import org.springframework.data.elasticsearch.entities.ParentEntity.ChildEntity; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
|  | ||||
| @ -42,10 +42,10 @@ import org.springframework.data.domain.PageRequest; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.data.domain.Sort; | ||||
| import org.springframework.data.elasticsearch.ElasticsearchException; | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.SampleEntityBuilder; | ||||
| import org.springframework.data.elasticsearch.SampleMappingEntity; | ||||
| import org.springframework.data.elasticsearch.builder.SampleEntityBuilder; | ||||
| import org.springframework.data.elasticsearch.core.query.*; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleMappingEntity; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
| @ -75,13 +75,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldReturnCountForGivenSearchQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| 		SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).build(); | ||||
| @ -95,22 +92,16 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldReturnObjectForGivenId() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 
 | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		// when | ||||
| 		GetQuery getQuery = new GetQuery(); | ||||
| 		getQuery.setId(documentId); | ||||
| 		SampleEntity sampleEntity1 = elasticsearchTemplate.queryForObject(getQuery, SampleEntity.class); | ||||
| 		// then | ||||
| 		assertNotNull("not null....", sampleEntity1); | ||||
| 		assertNotNull("entity can't be null....", sampleEntity1); | ||||
| 		assertEquals(sampleEntity, sampleEntity1); | ||||
| 	} | ||||
| 
 | ||||
| @ -120,28 +111,15 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("some message"); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("some message"); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2)); | ||||
| 
 | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -161,30 +139,19 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("some message"); | ||||
| 		sampleEntity1.setType("type1"); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId) | ||||
| 				.message("some message") | ||||
| 				.type("type1") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("some message"); | ||||
| 		sampleEntity2.setType("type2"); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2) | ||||
| 				.message("some message") | ||||
| 				.type("type2") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2)); | ||||
| 
 | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -216,14 +183,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldReturnPageForGivenSearchQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -242,28 +205,16 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("some message"); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("some message"); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2)); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 		// when | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -277,14 +228,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldDeleteDocumentForGivenId() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		// when | ||||
| @ -300,14 +247,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldDeleteEntityForGivenId() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		// when | ||||
| @ -323,14 +266,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldDeleteDocumentForGivenQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		// when | ||||
| @ -347,14 +286,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldFilterSearchResultsForGivenFilter() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| 
 | ||||
| @ -372,43 +307,26 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("abc"); | ||||
| 		sampleEntity1.setRate(10); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId) | ||||
| 				.message("abc") | ||||
| 				.rate(10) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("xyz"); | ||||
| 		sampleEntity2.setRate(5); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2) | ||||
| 				.message("xyz") | ||||
| 				.rate(5) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// third document | ||||
| 		String documentId3 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntity(); | ||||
| 		sampleEntity3.setId(documentId3); | ||||
| 		sampleEntity3.setMessage("xyz"); | ||||
| 		sampleEntity3.setRate(15); | ||||
| 		sampleEntity3.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntityBuilder(documentId3) | ||||
| 				.message("xyz") | ||||
| 				.rate(15) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery3 = new IndexQuery(); | ||||
| 		indexQuery3.setId(documentId3); | ||||
| 		indexQuery3.setObject(sampleEntity3); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 		indexQueries.add(indexQuery3); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); | ||||
| 
 | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -428,43 +346,26 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("abc"); | ||||
| 		sampleEntity1.setRate(15); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId) | ||||
| 				.message("abc") | ||||
| 				.rate(10) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("xyz"); | ||||
| 		sampleEntity2.setRate(5); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2) | ||||
| 				.message("xyz") | ||||
| 				.rate(5) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// third document | ||||
| 		String documentId3 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntity(); | ||||
| 		sampleEntity3.setId(documentId3); | ||||
| 		sampleEntity3.setMessage("xyz"); | ||||
| 		sampleEntity3.setRate(15); | ||||
| 		sampleEntity3.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntityBuilder(documentId3) | ||||
| 				.message("xyz") | ||||
| 				.rate(15) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery3 = new IndexQuery(); | ||||
| 		indexQuery3.setId(documentId3); | ||||
| 		indexQuery3.setObject(sampleEntity3); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 		indexQueries.add(indexQuery3); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); | ||||
| 
 | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -484,14 +385,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldExecuteStringQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -507,14 +404,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldReturnPageableResultsGivenStringQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -557,14 +450,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldReturnObjectMatchingGivenStringQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -589,14 +478,10 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldExecuteGivenCriteriaQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some test message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message("test message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -613,14 +498,10 @@ public class ElasticsearchTemplateTests { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		String message = "some test message"; | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage(message); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId).message(message) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -653,28 +534,17 @@ public class ElasticsearchTemplateTests { | ||||
| 				+ "we want real-time search, we want simple multi-tenancy, and we want a solution that is built for the cloud."; | ||||
| 
 | ||||
| 		String documentId1 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId1); | ||||
| 		sampleEntity1.setMessage(sampleMessage); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId1).message(sampleMessage) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId1); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery1); | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 
 | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage(sampleMessage); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery2); | ||||
| 		elasticsearchTemplate.index(getIndexQuery(new SampleEntityBuilder(documentId2).message(sampleMessage) | ||||
| 				.version(System.currentTimeMillis()).build())); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| 
 | ||||
| 		MoreLikeThisQuery moreLikeThisQuery = new MoreLikeThisQuery(); | ||||
| @ -686,7 +556,7 @@ public class ElasticsearchTemplateTests { | ||||
| 
 | ||||
| 		// then | ||||
| 		assertThat(sampleEntities.getTotalElements(), is(equalTo(1L))); | ||||
| 		assertThat(sampleEntities.getContent(), hasItem(sampleEntity1)); | ||||
| 		assertThat(sampleEntities.getContent(), hasItem(sampleEntity)); | ||||
| 	} | ||||
| 
 | ||||
| 	@Test | ||||
| @ -782,41 +652,26 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("test message"); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId) | ||||
| 				.message("test message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("test test"); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2) | ||||
| 				.message("test test") | ||||
| 				.rate(5) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 
 | ||||
| 		// second document | ||||
| 		// third document | ||||
| 		String documentId3 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntity(); | ||||
| 		sampleEntity3.setId(documentId3); | ||||
| 		sampleEntity3.setMessage("some message"); | ||||
| 		sampleEntity3.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntityBuilder(documentId3) | ||||
| 				.message("some message") | ||||
| 				.rate(15) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery3 = new IndexQuery(); | ||||
| 		indexQuery3.setId(documentId3); | ||||
| 		indexQuery3.setObject(sampleEntity3); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery3); | ||||
| 		// when | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -839,41 +694,26 @@ public class ElasticsearchTemplateTests { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		// first document | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntity(); | ||||
| 		sampleEntity1.setId(documentId); | ||||
| 		sampleEntity1.setMessage("test message"); | ||||
| 		sampleEntity1.setVersion(System.currentTimeMillis()); | ||||
| 
 | ||||
| 		IndexQuery indexQuery1 = new IndexQuery(); | ||||
| 		indexQuery1.setId(documentId); | ||||
| 		indexQuery1.setObject(sampleEntity1); | ||||
| 		indexQueries.add(indexQuery1); | ||||
| 		SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId) | ||||
| 				.message("test message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		// second document | ||||
| 		String documentId2 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntity(); | ||||
| 		sampleEntity2.setId(documentId2); | ||||
| 		sampleEntity2.setMessage("test test"); | ||||
| 		sampleEntity2.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2) | ||||
| 				.message("test test") | ||||
| 				.rate(5) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery2 = new IndexQuery(); | ||||
| 		indexQuery2.setId(documentId2); | ||||
| 		indexQuery2.setObject(sampleEntity2); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery2); | ||||
| 
 | ||||
| 		// second document | ||||
| 		// third document | ||||
| 		String documentId3 = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntity(); | ||||
| 		sampleEntity3.setId(documentId3); | ||||
| 		sampleEntity3.setMessage("some message"); | ||||
| 		sampleEntity3.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity3 = new SampleEntityBuilder(documentId3) | ||||
| 				.message("some message") | ||||
| 				.rate(15) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery3 = new IndexQuery(); | ||||
| 		indexQuery3.setId(documentId3); | ||||
| 		indexQuery3.setObject(sampleEntity3); | ||||
| 		indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); | ||||
| 
 | ||||
| 		indexQueries.add(indexQuery3); | ||||
| 		// when | ||||
| 		elasticsearchTemplate.bulkIndex(indexQueries); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -910,14 +750,11 @@ public class ElasticsearchTemplateTests { | ||||
| 		String messageBeforeUpdate = "some test message"; | ||||
| 		String messageAfterUpdate = "test message"; | ||||
| 
 | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage(messageBeforeUpdate); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId) | ||||
| 				.message(messageBeforeUpdate) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -971,14 +808,11 @@ public class ElasticsearchTemplateTests { | ||||
| 		String actualMessage = "some test message"; | ||||
| 		String highlightedMessage = "some <em>test</em> message"; | ||||
| 
 | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage(actualMessage); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId) | ||||
| 				.message(actualMessage) | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -1016,14 +850,11 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldDeleteSpecifiedTypeFromAnIndex() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId) | ||||
| 				.message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -1039,14 +870,11 @@ public class ElasticsearchTemplateTests { | ||||
| 	public void shouldDeleteDocumentBySpecifiedTypeUsingDeleteQuery() { | ||||
| 		// given | ||||
| 		String documentId = randomNumeric(5); | ||||
| 		SampleEntity sampleEntity = new SampleEntity(); | ||||
| 		sampleEntity.setId(documentId); | ||||
| 		sampleEntity.setMessage("some message"); | ||||
| 		sampleEntity.setVersion(System.currentTimeMillis()); | ||||
| 		SampleEntity sampleEntity = new SampleEntityBuilder(documentId) | ||||
| 				.message("some message") | ||||
| 				.version(System.currentTimeMillis()).build(); | ||||
| 
 | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(documentId); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		IndexQuery indexQuery = getIndexQuery(sampleEntity); | ||||
| 
 | ||||
| 		elasticsearchTemplate.index(indexQuery); | ||||
| 		elasticsearchTemplate.refresh(SampleEntity.class, true); | ||||
| @ -1341,4 +1169,19 @@ public class ElasticsearchTemplateTests { | ||||
| 		assertThat(sampleEntities, is(notNullValue())); | ||||
| 		assertThat(sampleEntities.getTotalElements(), greaterThanOrEqualTo(1L)); | ||||
| 	} | ||||
| 
 | ||||
| 	private IndexQuery getIndexQuery(SampleEntity sampleEntity) { | ||||
| 		IndexQuery indexQuery = new IndexQuery(); | ||||
| 		indexQuery.setId(sampleEntity.getId()); | ||||
| 		indexQuery.setObject(sampleEntity); | ||||
| 		return indexQuery; | ||||
| 	} | ||||
| 
 | ||||
| 	private List<IndexQuery> getIndexQueries(List<SampleEntity> sampleEntities) { | ||||
| 		List<IndexQuery> indexQueries = new ArrayList<IndexQuery>(); | ||||
| 		for (SampleEntity sampleEntity : sampleEntities) { | ||||
| 			indexQueries.add(new IndexQueryBuilder().withId(sampleEntity.getId()).withObject(sampleEntity).build()); | ||||
| 		} | ||||
| 		return indexQueries; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -28,9 +28,13 @@ import org.elasticsearch.common.xcontent.XContentBuilder; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.elasticsearch.*; | ||||
| import org.springframework.data.elasticsearch.builder.StockPriceBuilder; | ||||
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | ||||
| import org.springframework.data.elasticsearch.core.query.SearchQuery; | ||||
| import org.springframework.data.elasticsearch.entities.MinimalEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleTransientEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SimpleRecursiveEntity; | ||||
| import org.springframework.data.elasticsearch.entities.StockPrice; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
|  | ||||
| @ -21,7 +21,7 @@ import java.io.IOException; | ||||
| import org.elasticsearch.common.xcontent.XContentBuilder; | ||||
| import org.junit.Assert; | ||||
| import org.junit.Test; | ||||
| import org.springframework.data.elasticsearch.SampleDateMappingEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleDateMappingEntity; | ||||
| 
 | ||||
| /** | ||||
|  * @author Jakub Vavrik | ||||
|  | ||||
| @ -1,3 +1,18 @@ | ||||
| /* | ||||
|  * Copyright 2014 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.core.facet; | ||||
| 
 | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldIndex.*; | ||||
| @ -15,6 +30,9 @@ import org.springframework.data.elasticsearch.annotations.NestedField; | ||||
| 
 | ||||
| /** | ||||
|  * Simple type to test facets | ||||
|  * | ||||
|  * @author Artur Konczak | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| @Document(indexName = "articles", type = "article", shards = 1, replicas = 0, refreshInterval = "-1", indexStoreType = "memory") | ||||
| public class ArticleEntity { | ||||
|  | ||||
| @ -1,9 +1,27 @@ | ||||
| /* | ||||
|  * Copyright 2014 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.core.facet; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| 
 | ||||
| /** | ||||
|  * Simple type to test facets | ||||
|  * | ||||
|  * @author Artur Konczak | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| public class ArticleEntityBuilder { | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,18 @@ | ||||
| /* | ||||
|  * Copyright 2014 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.core.facet; | ||||
| 
 | ||||
| import java.text.SimpleDateFormat; | ||||
| @ -10,10 +25,12 @@ import org.springframework.data.elasticsearch.annotations.Field; | ||||
| import org.springframework.data.elasticsearch.annotations.FieldType; | ||||
| 
 | ||||
| /** | ||||
|  * User: Artur Konczak | ||||
|  * Date: 18/10/13 | ||||
|  * Time: 17:33 | ||||
|  * Simple type to test facets | ||||
|  * | ||||
|  * @author Artur Konczak | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| 
 | ||||
| @Document(indexName = "logs", type = "log", shards = 1, replicas = 0, refreshInterval = "-1", indexStoreType = "memory") | ||||
| public class LogEntity { | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,18 @@ | ||||
| /* | ||||
|  * Copyright 2014 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.core.facet; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| @ -5,10 +20,12 @@ import java.util.Date; | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| 
 | ||||
| /** | ||||
|  * User: Artur Konczak | ||||
|  * Date: 18/10/13 | ||||
|  * Time: 17:33 | ||||
|  * Simple type to test facets | ||||
|  * | ||||
|  * @author Artur Konczak | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| 
 | ||||
| public class LogEntityBuilder { | ||||
| 
 | ||||
| 	private LogEntity result; | ||||
|  | ||||
| @ -17,6 +17,11 @@ package org.springframework.data.elasticsearch.core.geo; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.core.query.IndexQuery; | ||||
| 
 | ||||
| /** | ||||
|  * @author Artur Konczak | ||||
|  * @author Mohsin Husen | ||||
|  */ | ||||
| 
 | ||||
| public class AuthorMarkerAnnotatedEntityBuilder { | ||||
| 
 | ||||
| 	private AuthorMarkerAnnotatedEntity result; | ||||
|  | ||||
| @ -24,7 +24,6 @@ import java.util.List; | ||||
| 
 | ||||
| import org.elasticsearch.common.geo.GeoHashUtils; | ||||
| import org.elasticsearch.index.query.FilterBuilders; | ||||
| import org.junit.Before; | ||||
| import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @ -49,11 +48,6 @@ public class ElasticsearchTemplateGeoTests { | ||||
| 	@Autowired | ||||
| 	private ElasticsearchTemplate elasticsearchTemplate; | ||||
| 
 | ||||
| 	@Before | ||||
| 	public void before() { | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| 	private void loadClassBaseEntities() { | ||||
| 		elasticsearchTemplate.deleteIndex(AuthorMarkerEntity.class); | ||||
| 		elasticsearchTemplate.createIndex(AuthorMarkerEntity.class); | ||||
|  | ||||
| @ -28,9 +28,9 @@ import org.junit.Test; | ||||
| import org.junit.runner.RunWith; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.SampleEntityBuilder; | ||||
| import org.springframework.data.elasticsearch.builder.SampleEntityBuilder; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
|  | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| /** | ||||
|  * @author Rizwan Idrees | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| import org.springframework.data.elasticsearch.annotations.Document; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| /** | ||||
|  * @author Rizwan Idrees | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| import org.springframework.data.annotation.Version; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| import org.springframework.data.annotation.Version; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| import org.springframework.data.elasticsearch.annotations.Document; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| 
 | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.core.style.ToStringCreator; | ||||
| import org.springframework.data.annotation.Id; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| 
 | ||||
| import java.util.List; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| 
 | ||||
| import java.util.List; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| @ -1,4 +1,4 @@ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldIndex.*; | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldType.*; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.apache.commons.lang.builder.EqualsBuilder; | ||||
| import org.apache.commons.lang.builder.HashCodeBuilder; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldIndex.*; | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldType.String; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldIndex.*; | ||||
| import static org.springframework.data.elasticsearch.annotations.FieldType.String; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import org.springframework.data.annotation.Id; | ||||
| import org.springframework.data.elasticsearch.annotations.Document; | ||||
| @ -13,7 +13,7 @@ | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch; | ||||
| package org.springframework.data.elasticsearch.entities; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| 
 | ||||
| @ -29,8 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | ||||
| import org.springframework.data.domain.Sort; | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repositories.custom.SampleCustomMethodRepository; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repositories.book; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.Book; | ||||
| import org.springframework.data.elasticsearch.entities.Book; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repositories.cdi; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.Product; | ||||
| import org.springframework.data.elasticsearch.entities.Product; | ||||
| import org.springframework.data.repository.CrudRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -23,7 +23,7 @@ import org.junit.AfterClass; | ||||
| import org.junit.Before; | ||||
| import org.junit.BeforeClass; | ||||
| import org.junit.Test; | ||||
| import org.springframework.data.elasticsearch.Product; | ||||
| import org.springframework.data.elasticsearch.entities.Product; | ||||
| 
 | ||||
| /** | ||||
|  * @author Mohsin Husen | ||||
|  | ||||
| @ -19,8 +19,8 @@ import java.util.List; | ||||
| 
 | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.annotations.Query; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repositories.doubleid; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.DoubleIDEntity; | ||||
| import org.springframework.data.elasticsearch.entities.DoubleIDEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repositories.integer; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.IntegerIDEntity; | ||||
| import org.springframework.data.elasticsearch.entities.IntegerIDEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -16,7 +16,7 @@ | ||||
| package org.springframework.data.elasticsearch.repositories.nondocument; | ||||
| 
 | ||||
| import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.data.elasticsearch.NonDocumentEntity; | ||||
| import org.springframework.data.elasticsearch.entities.NonDocumentEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repositories.sample; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -22,8 +22,8 @@ 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.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
|  | ||||
| @ -22,8 +22,8 @@ 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.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
| 
 | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repository.complex; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
|  */ | ||||
| package org.springframework.data.elasticsearch.repository.complex; | ||||
| 
 | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; | ||||
| 
 | ||||
| /** | ||||
|  | ||||
| @ -25,8 +25,8 @@ 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.entities.DoubleIDEntity; | ||||
| import org.springframework.data.elasticsearch.repositories.doubleid.DoubleIDRepository; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
|  | ||||
| @ -25,8 +25,8 @@ 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.IntegerIDEntity; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.entities.IntegerIDEntity; | ||||
| import org.springframework.data.elasticsearch.repositories.integer.IntegerIDRepository; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
|  | ||||
| @ -32,10 +32,10 @@ import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | ||||
| import org.springframework.data.domain.Sort; | ||||
| import org.springframework.data.elasticsearch.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; | ||||
| import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; | ||||
| import org.springframework.data.elasticsearch.core.query.SearchQuery; | ||||
| import org.springframework.data.elasticsearch.entities.SampleEntity; | ||||
| import org.springframework.data.elasticsearch.repositories.sample.SampleElasticsearchRepository; | ||||
| import org.springframework.test.context.ContextConfiguration; | ||||
| import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user