diff --git a/src/main/java/org/springframework/data/elasticsearch/core/DefaultEntityMapper.java b/src/main/java/org/springframework/data/elasticsearch/core/DefaultEntityMapper.java index 8460919d3..e5ef3d13e 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/DefaultEntityMapper.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/DefaultEntityMapper.java @@ -33,7 +33,7 @@ public class DefaultEntityMapper implements EntityMapper { public DefaultEntityMapper() { objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); } @Override diff --git a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java index 6ef858251..a13b997c0 100755 --- a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java @@ -19,7 +19,7 @@ import static org.apache.commons.collections.CollectionUtils.isNotEmpty; import static org.apache.commons.lang.StringUtils.*; import static org.elasticsearch.action.search.SearchType.*; import static org.elasticsearch.client.Requests.*; -import static org.elasticsearch.cluster.metadata.AliasAction.Type.ADD; +import static org.elasticsearch.cluster.metadata.AliasAction.Type.*; import static org.elasticsearch.common.collect.Sets.*; import static org.elasticsearch.index.VersionType.*; import static org.springframework.data.elasticsearch.core.MappingBuilder.*; @@ -32,7 +32,6 @@ import java.util.*; import org.apache.commons.collections.CollectionUtils; import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.mapping.delete.DeleteMappingRequest; @@ -345,7 +344,6 @@ public class ElasticsearchTemplate implements ElasticsearchOperations { return updateRequestBuilder.execute().actionGet(); } - @Override public void bulkIndex(List queries) { BulkRequestBuilder bulkRequest = client.prepareBulk(); @@ -563,11 +561,11 @@ public class ElasticsearchTemplate implements ElasticsearchOperations { } private boolean createIndexWithSettings(Class clazz) { - if(clazz.isAnnotationPresent(Setting.class)) { + if (clazz.isAnnotationPresent(Setting.class)) { String settingPath = clazz.getAnnotation(Setting.class).settingPath(); - if(isNotBlank(settingPath)) { + if (isNotBlank(settingPath)) { String settings = readFileFromClasspath(settingPath); - if(isNotBlank(settings)) { + if (isNotBlank(settings)) { return createIndex(getPersistentEntityFor(clazz).getIndexName(), settings); } } else { @@ -577,7 +575,6 @@ public class ElasticsearchTemplate implements ElasticsearchOperations { return createIndex(getPersistentEntityFor(clazz).getIndexName(), getDefaultSettings(getPersistentEntityFor(clazz))); } - @Override public boolean createIndex(String indexName, Object settings) { CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(indexName); diff --git a/src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntity.java b/src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntity.java index b549c9be8..01670206a 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntity.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntity.java @@ -68,7 +68,7 @@ public class SimpleElasticsearchPersistentEntity extends BasicPersistentEntit this.refreshInterval = typeInformation.getType().getAnnotation(Document.class).refreshInterval(); this.indexStoreType = typeInformation.getType().getAnnotation(Document.class).indexStoreType(); } - if(clazz.isAnnotationPresent(Setting.class)) { + if (clazz.isAnnotationPresent(Setting.class)) { this.settingPath = typeInformation.getType().getAnnotation(Setting.class).settingPath(); } } diff --git a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java index 9ab4da6d1..8ad82c9b4 100755 --- a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-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. @@ -33,11 +33,11 @@ import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.highlight.HighlightBuilder; import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.sort.SortOrder; -import org.junit.*; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.annotation.Id; -import org.springframework.data.annotation.Version; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -75,25 +75,11 @@ public class ElasticsearchTemplateTests { public void before() { elasticsearchTemplate.deleteIndex(SampleEntity.class); elasticsearchTemplate.createIndex(SampleEntity.class); - elasticsearchTemplate.deleteIndex(INDEX_1_NAME); - elasticsearchTemplate.deleteIndex(INDEX_2_NAME); - elasticsearchTemplate.refresh(SampleEntity.class, true); + elasticsearchTemplate.deleteIndex(INDEX_1_NAME); + elasticsearchTemplate.deleteIndex(INDEX_2_NAME); + elasticsearchTemplate.refresh(SampleEntity.class, true); } - - // @After - /** // doing a cleanup to ensure that no indexes are left behind after the test run */ - /** - public void after() { - - // it is safe to call deleteIndex as it checks for index existance before deleting it - elasticsearchTemplate.deleteIndex(INDEX_NAME); - elasticsearchTemplate.deleteIndex(INDEX_1_NAME); - elasticsearchTemplate.deleteIndex(INDEX_2_NAME); - - }**/ - - @Test public void shouldReturnCountForGivenSearchQuery() { // given @@ -734,7 +720,7 @@ public class ElasticsearchTemplateTests { .rate(15) .version(System.currentTimeMillis()).build(); - List indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); + List indexQueries = getIndexQueries(Arrays.asList(sampleEntity1, sampleEntity2, sampleEntity3)); // when elasticsearchTemplate.bulkIndex(indexQueries); @@ -1047,7 +1033,6 @@ public class ElasticsearchTemplateTests { } - @Test public void shouldIndexDocumentForSpecifiedSource() { @@ -1527,81 +1512,79 @@ public class ElasticsearchTemplateTests { } - @Test - public void shouldTestResultsAcrossMultipleIndices() { - // given - String documentId1 = randomNumeric(5); - SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId1).message("some message") - .version(System.currentTimeMillis()).build(); + @Test + public void shouldTestResultsAcrossMultipleIndices() { + // given + String documentId1 = randomNumeric(5); + SampleEntity sampleEntity1 = new SampleEntityBuilder(documentId1).message("some message") + .version(System.currentTimeMillis()).build(); - IndexQuery indexQuery1 = new IndexQueryBuilder().withId(sampleEntity1.getId()) - .withIndexName("test-index-1") - .withObject(sampleEntity1) - .build(); + IndexQuery indexQuery1 = new IndexQueryBuilder().withId(sampleEntity1.getId()) + .withIndexName("test-index-1") + .withObject(sampleEntity1) + .build(); - String documentId2 = randomNumeric(5); - SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2).message("some test message") - .version(System.currentTimeMillis()).build(); + String documentId2 = randomNumeric(5); + SampleEntity sampleEntity2 = new SampleEntityBuilder(documentId2).message("some test message") + .version(System.currentTimeMillis()).build(); - IndexQuery indexQuery2 = new IndexQueryBuilder().withId(sampleEntity2.getId()) - .withIndexName("test-index-2") - .withObject(sampleEntity2) - .build(); + IndexQuery indexQuery2 = new IndexQueryBuilder().withId(sampleEntity2.getId()) + .withIndexName("test-index-2") + .withObject(sampleEntity2) + .build(); - elasticsearchTemplate.bulkIndex(Arrays.asList(indexQuery1, indexQuery2)); - elasticsearchTemplate.refresh("test-index-1", true); - elasticsearchTemplate.refresh("test-index-2", true); + elasticsearchTemplate.bulkIndex(Arrays.asList(indexQuery1, indexQuery2)); + elasticsearchTemplate.refresh("test-index-1", true); + elasticsearchTemplate.refresh("test-index-2", true); - SearchQuery searchQuery = new NativeSearchQueryBuilder() - .withQuery(matchAllQuery()) - .withIndices("test-index-1", "test-index-2") - .build(); - // when - List sampleEntities = elasticsearchTemplate.queryForList(searchQuery, SampleEntity.class); + SearchQuery searchQuery = new NativeSearchQueryBuilder() + .withQuery(matchAllQuery()) + .withIndices("test-index-1", "test-index-2") + .build(); + // when + List sampleEntities = elasticsearchTemplate.queryForList(searchQuery, SampleEntity.class); - // then - assertThat(sampleEntities.size(), is(equalTo(2))); - } + // then + assertThat(sampleEntities.size(), is(equalTo(2))); + } - @Test - /** - * This is basically a demonstration to show composing entities out of heterogeneous indexes. - */ - public void shouldComposeObjectsReturnedFromHeterogeneousIndexes() { + @Test + /** + * This is basically a demonstration to show composing entities out of heterogeneous indexes. + */ + public void shouldComposeObjectsReturnedFromHeterogeneousIndexes() { - // Given + // Given - HetroEntity1 entity1 = new HetroEntity1(randomNumeric(3), "aFirstName"); - HetroEntity2 entity2 = new HetroEntity2(randomNumeric(4), "aLastName"); + HetroEntity1 entity1 = new HetroEntity1(randomNumeric(3), "aFirstName"); + HetroEntity2 entity2 = new HetroEntity2(randomNumeric(4), "aLastName"); - IndexQuery idxQuery1 = new IndexQueryBuilder().withIndexName(INDEX_1_NAME).withId(entity1.getId()).withObject(entity1).build(); - IndexQuery idxQuery2 = new IndexQueryBuilder().withIndexName(INDEX_2_NAME).withId(entity2.getId()).withObject(entity2).build(); + IndexQuery idxQuery1 = new IndexQueryBuilder().withIndexName(INDEX_1_NAME).withId(entity1.getId()).withObject(entity1).build(); + IndexQuery idxQuery2 = new IndexQueryBuilder().withIndexName(INDEX_2_NAME).withId(entity2.getId()).withObject(entity2).build(); + elasticsearchTemplate.bulkIndex(Arrays.asList(idxQuery1, idxQuery2)); + elasticsearchTemplate.refresh(INDEX_1_NAME, true); + elasticsearchTemplate.refresh(INDEX_2_NAME, true); - elasticsearchTemplate.bulkIndex(Arrays.asList(idxQuery1, idxQuery2)); - elasticsearchTemplate.refresh(INDEX_1_NAME, true); - elasticsearchTemplate.refresh(INDEX_2_NAME, true); + // When - // When + SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withTypes("hetro").withIndices(INDEX_1_NAME, INDEX_2_NAME).build(); + Page page = elasticsearchTemplate.queryForPage(searchQuery, ResultAggregator.class, new SearchResultMapper() { + @Override + public FacetedPage mapResults(SearchResponse response, Class clazz, Pageable pageable) { + List values = new ArrayList(); + for (SearchHit searchHit : response.getHits()) { + String id = String.valueOf(searchHit.getSource().get("id")); + String firstName = StringUtils.isNotEmpty((String) searchHit.getSource().get("firstName")) ? (String) searchHit.getSource().get("firstName") : ""; + String lastName = StringUtils.isNotEmpty((String) searchHit.getSource().get("lastName")) ? (String) searchHit.getSource().get("lastName") : ""; + values.add(new ResultAggregator(id, firstName, lastName)); + } + return new FacetedPageImpl((List) values); + } + }); - SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withTypes("hetro").withIndices(INDEX_1_NAME, INDEX_2_NAME).build(); - Page page = elasticsearchTemplate.queryForPage(searchQuery, ResultAggregator.class, new SearchResultMapper() { - @Override - public FacetedPage mapResults(SearchResponse response, Class clazz, Pageable pageable) { - List values = new ArrayList(); - for (SearchHit searchHit : response.getHits()) { - String id = String.valueOf(searchHit.getSource().get("id")); - String firstName = StringUtils.isNotEmpty((String)searchHit.getSource().get("firstName"))?(String)searchHit.getSource().get("firstName"):""; - String lastName = StringUtils.isNotEmpty((String)searchHit.getSource().get("lastName"))?(String)searchHit.getSource().get("lastName"):""; - values.add(new ResultAggregator(id, firstName, lastName)); - } - return new FacetedPageImpl((List) values); - } - }); - - assertThat(page.getTotalElements(), is(2l)); - - } + assertThat(page.getTotalElements(), is(2l)); + } private IndexQuery getIndexQuery(SampleEntity sampleEntity) { @@ -1616,22 +1599,17 @@ public class ElasticsearchTemplateTests { return indexQueries; } - @Document(indexName = INDEX_2_NAME, replicas = 0, shards = 1) - class ResultAggregator { - - private String id; - private String firstName; - private String lastName; - - ResultAggregator(String id, String firstName, String lastName) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - } - - } - - + @Document(indexName = INDEX_2_NAME, replicas = 0, shards = 1) + class ResultAggregator { + private String id; + private String firstName; + private String lastName; + ResultAggregator(String id, String firstName, String lastName) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + } } diff --git a/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java b/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java index e107b7c0a..2d988542d 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java @@ -187,7 +187,9 @@ public class ElasticsearchTemplateGeoTests { CriteriaQuery geoLocationCriteriaQuery3 = new CriteriaQuery( new Criteria("location").boundedBy( new GeoBox(new GeoPoint(53.5171d, 0), - new GeoPoint(49.5171d, 0.2062d)))); + new GeoPoint(49.5171d, 0.2062d)) + ) + ); //when List geoAuthorsForGeoCriteria3 = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery3, AuthorMarkerEntity.class); @@ -217,7 +219,8 @@ public class ElasticsearchTemplateGeoTests { CriteriaQuery geoLocationCriteriaQuery3 = new CriteriaQuery( new Criteria("location").boundedBy( new GeoPoint(53.5171d, 0), - new GeoPoint(49.5171d, 0.2062d))); + new GeoPoint(49.5171d, 0.2062d)) + ); //when List geoAuthorsForGeoCriteria3 = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery3, AuthorMarkerEntity.class); diff --git a/src/test/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntityTests.java b/src/test/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntityTests.java index f0206d885..bd891aba2 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntityTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/mapping/SimpleElasticsearchPersistentEntityTests.java @@ -38,7 +38,8 @@ public class SimpleElasticsearchPersistentEntityTests { SimpleElasticsearchPersistentProperty persistentProperty = new SimpleElasticsearchPersistentProperty( EntityWithWrongVersionType.class.getDeclaredField("version"), new PropertyDescriptor("version", EntityWithWrongVersionType.class), new SimpleElasticsearchPersistentEntity( - typeInformation), new SimpleTypeHolder()); + typeInformation), new SimpleTypeHolder() + ); // when new SimpleElasticsearchPersistentEntity(typeInformation).addPersistentProperty(persistentProperty); @@ -53,13 +54,15 @@ public class SimpleElasticsearchPersistentEntityTests { EntityWithMultipleVersionField.class.getDeclaredField("version1"), new PropertyDescriptor("version1", EntityWithMultipleVersionField.class), new SimpleElasticsearchPersistentEntity(typeInformation), - new SimpleTypeHolder()); + new SimpleTypeHolder() + ); SimpleElasticsearchPersistentProperty persistentProperty2 = new SimpleElasticsearchPersistentProperty( EntityWithMultipleVersionField.class.getDeclaredField("version2"), new PropertyDescriptor("version2", EntityWithMultipleVersionField.class), new SimpleElasticsearchPersistentEntity(typeInformation), - new SimpleTypeHolder()); + new SimpleTypeHolder() + ); SimpleElasticsearchPersistentEntity simpleElasticsearchPersistentEntity = new SimpleElasticsearchPersistentEntity( typeInformation); diff --git a/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity1.java b/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity1.java index 41bad2d43..ea16d0722 100644 --- a/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity1.java +++ b/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity1.java @@ -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.entities; import org.apache.commons.lang.builder.EqualsBuilder; @@ -7,62 +22,62 @@ import org.springframework.data.annotation.Version; import org.springframework.data.elasticsearch.annotations.Document; /** - * @author abdul. + * @author Abdul Waheed + * @author Mohsin Husen */ -@Document(indexName = "test-index-1", type = "hetro", replicas = 0, shards = 1) +@Document(indexName = "test-index-1", type = "hetro", replicas = 0, shards = 1) public class HetroEntity1 { - @Id - private String id; - private String firstName; - @Version - private Long version; + @Id + private String id; + private String firstName; + @Version + private Long version; - public HetroEntity1(String id, String firstName) { - this.id = id; - this.firstName = firstName; - this.version = System.currentTimeMillis(); - } + public HetroEntity1(String id, String firstName) { + this.id = id; + this.firstName = firstName; + this.version = System.currentTimeMillis(); + } - public String getId() { - return id; - } + public String getId() { + return id; + } - public void setId(String id) { - this.id = id; - } + public void setId(String id) { + this.id = id; + } - public String getFirstName() { - return firstName; - } + public String getFirstName() { + return firstName; + } - public void setFirstName(String firstName) { - this.firstName = firstName; - } + public void setFirstName(String firstName) { + this.firstName = firstName; + } - public Long getVersion() { - return version; - } + public Long getVersion() { + return version; + } - public void setVersion(Long version) { - this.version = version; - } + public void setVersion(Long version) { + this.version = version; + } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof SampleEntity)) { - return false; - } - if (this == obj) { - return true; - } - HetroEntity1 rhs = (HetroEntity1) obj; - return new EqualsBuilder().append(this.id, rhs.id).append(this.firstName, rhs.firstName).append(this.version, rhs.version).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(id).append(firstName).append(version).toHashCode(); - } + @Override + public boolean equals(Object obj) { + if (!(obj instanceof SampleEntity)) { + return false; + } + if (this == obj) { + return true; + } + HetroEntity1 rhs = (HetroEntity1) obj; + return new EqualsBuilder().append(this.id, rhs.id).append(this.firstName, rhs.firstName).append(this.version, rhs.version).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).append(firstName).append(version).toHashCode(); + } } diff --git a/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity2.java b/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity2.java index 70218ec51..9b4eea1ba 100644 --- a/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity2.java +++ b/src/test/java/org/springframework/data/elasticsearch/entities/HetroEntity2.java @@ -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.entities; import org.apache.commons.lang.builder.EqualsBuilder; @@ -7,62 +22,62 @@ import org.springframework.data.annotation.Version; import org.springframework.data.elasticsearch.annotations.Document; /** - * @author abdul. + * @author Abdul Waheed + * @author Mohsin Husen */ -@Document(indexName = "test-index-2", type = "hetro", replicas = 0, shards = 1) +@Document(indexName = "test-index-2", type = "hetro", replicas = 0, shards = 1) public class HetroEntity2 { - @Id - private String id; - private String lastName; - @Version - private Long version; + @Id + private String id; + private String lastName; + @Version + private Long version; - public HetroEntity2(String id, String lastName) { - this.id = id; - this.lastName = lastName; - this.version = System.currentTimeMillis(); - } + public HetroEntity2(String id, String lastName) { + this.id = id; + this.lastName = lastName; + this.version = System.currentTimeMillis(); + } - public void setId(String id) { - this.id = id; - } + public String getId() { + return id; + } - public void setLastName(String lastName) { - this.lastName = lastName; - } + public void setId(String id) { + this.id = id; + } - public void setVersion(Long version) { - this.version = version; - } + public String getLastName() { + return lastName; + } - public String getId() { - return id; - } + public void setLastName(String lastName) { + this.lastName = lastName; + } - public String getLastName() { - return lastName; - } + public Long getVersion() { + return version; + } - public Long getVersion() { - return version; - } + public void setVersion(Long version) { + this.version = version; + } - @Override - public boolean equals(Object obj) { - if (!(obj instanceof SampleEntity)) { - return false; - } - if (this == obj) { - return true; - } - HetroEntity2 rhs = (HetroEntity2) obj; - return new EqualsBuilder().append(this.id, rhs.id).append(this.lastName, rhs.lastName).append(this.version, rhs.version).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(id).append(lastName).append(version).toHashCode(); - } + @Override + public boolean equals(Object obj) { + if (!(obj instanceof SampleEntity)) { + return false; + } + if (this == obj) { + return true; + } + HetroEntity2 rhs = (HetroEntity2) obj; + return new EqualsBuilder().append(this.id, rhs.id).append(this.lastName, rhs.lastName).append(this.version, rhs.version).isEquals(); + } + @Override + public int hashCode() { + return new HashCodeBuilder().append(id).append(lastName).append(version).toHashCode(); + } } diff --git a/src/test/java/org/springframework/data/elasticsearch/repositories/setting/SettingEntityRepository.java b/src/test/java/org/springframework/data/elasticsearch/repositories/setting/SettingEntityRepository.java index 91a88378e..ba299b97d 100644 --- a/src/test/java/org/springframework/data/elasticsearch/repositories/setting/SettingEntityRepository.java +++ b/src/test/java/org/springframework/data/elasticsearch/repositories/setting/SettingEntityRepository.java @@ -23,6 +23,6 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchCrudReposi * * @author Mohsin Husen */ -public interface SettingEntityRepository extends ElasticsearchCrudRepository{ +public interface SettingEntityRepository extends ElasticsearchCrudRepository { } diff --git a/src/test/resources/dynamic-settings-test.xml b/src/test/resources/dynamic-settings-test.xml index 6b1212a52..a22b84cab 100644 --- a/src/test/resources/dynamic-settings-test.xml +++ b/src/test/resources/dynamic-settings-test.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> - + diff --git a/src/test/resources/infrastructure.xml b/src/test/resources/infrastructure.xml index c02c5973e..3285a3dc1 100644 --- a/src/test/resources/infrastructure.xml +++ b/src/test/resources/infrastructure.xml @@ -7,6 +7,6 @@ - + \ No newline at end of file diff --git a/src/test/resources/settings/test-settings.json b/src/test/resources/settings/test-settings.json index 893b0a7a1..0f6d53695 100644 --- a/src/test/resources/settings/test-settings.json +++ b/src/test/resources/settings/test-settings.json @@ -1,14 +1,14 @@ { - "index": { - "number_of_shards" : "1", - "number_of_replicas" : "0", - "analysis" :{ - "analyzer": { - "emailAnalyzer": { - "type" : "custom", - "tokenizer" : "uax_url_email" - } + "index": { + "number_of_shards": "1", + "number_of_replicas": "0", + "analysis": { + "analyzer": { + "emailAnalyzer": { + "type": "custom", + "tokenizer": "uax_url_email" } } } + } }