Skip to content

Commit ea45aba

Browse files
committed
DATAES-55 - polish test cases and remove unwanted files
1 parent 19105dc commit ea45aba

File tree

53 files changed

+369
-367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+369
-367
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.elasticsearch.core.query;
17+
18+
/**
19+
* IndexQuery Builder
20+
*
21+
* @author Rizwan Idrees
22+
* @author Mohsin Husen
23+
*/
24+
public class IndexQueryBuilder {
25+
26+
private String id;
27+
private Object object;
28+
private Long version;
29+
private String indexName;
30+
private String type;
31+
private String source;
32+
private String parentId;
33+
34+
public IndexQueryBuilder withId(String id) {
35+
this.id = id;
36+
return this;
37+
}
38+
39+
public IndexQueryBuilder withObject(Object object) {
40+
this.object = object;
41+
return this;
42+
}
43+
44+
public IndexQueryBuilder withVersion(Long version) {
45+
this.version = version;
46+
return this;
47+
}
48+
49+
public IndexQueryBuilder withIndexName(String indexName) {
50+
this.indexName = indexName;
51+
return this;
52+
}
53+
54+
public IndexQueryBuilder withType(String type) {
55+
this.type = type;
56+
return this;
57+
}
58+
59+
public IndexQueryBuilder withSource(String source) {
60+
this.source = source;
61+
return this;
62+
}
63+
64+
public IndexQueryBuilder withParentId(String parentId) {
65+
this.parentId = parentId;
66+
return this;
67+
}
68+
69+
public IndexQuery build() {
70+
IndexQuery indexQuery = new IndexQuery();
71+
indexQuery.setId(id);
72+
indexQuery.setIndexName(indexName);
73+
indexQuery.setType(type);
74+
indexQuery.setObject(object);
75+
indexQuery.setParentId(parentId);
76+
indexQuery.setSource(source);
77+
indexQuery.setVersion(version);
78+
return indexQuery;
79+
}
80+
}

src/test/java/org/springframework/data/elasticsearch/InnerObjectTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import org.junit.runner.RunWith;
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
28+
import org.springframework.data.elasticsearch.entities.Author;
29+
import org.springframework.data.elasticsearch.entities.Book;
2830
import org.springframework.data.elasticsearch.repositories.book.SampleElasticSearchBookRepository;
2931
import org.springframework.test.context.ContextConfiguration;
3032
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.springframework.data.elasticsearch.core.query.IndexQuery;
3636
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
3737
import org.springframework.data.elasticsearch.core.query.SearchQuery;
38+
import org.springframework.data.elasticsearch.entities.*;
3839
import org.springframework.test.context.ContextConfiguration;
3940
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
4041

@@ -254,7 +255,7 @@ public void shouldSearchBooksForPersonInitialLevelNestedType() {
254255
javaAuthor.setName("javaAuthor");
255256
java.setAuthor(javaAuthor);
256257

257-
Book spring= new Book();
258+
Book spring = new Book();
258259
spring.setId("2");
259260
spring.setName("spring");
260261
Author springAuthor = new Author();
@@ -299,6 +300,5 @@ public void shouldSearchBooksForPersonInitialLevelNestedType() {
299300
List<Person> persons = elasticsearchTemplate.queryForList(searchQuery, Person.class);
300301

301302
assertThat(persons.size(), is(1));
302-
303303
}
304304
}

src/test/java/org/springframework/data/elasticsearch/CarBuilder.java renamed to src/test/java/org/springframework/data/elasticsearch/builder/CarBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.elasticsearch;
16+
package org.springframework.data.elasticsearch.builder;
17+
18+
import org.springframework.data.elasticsearch.entities.Car;
1719

1820
/**
1921
* @author Artur Konczak

src/test/java/org/springframework/data/elasticsearch/SampleEntityBuilder.java renamed to src/test/java/org/springframework/data/elasticsearch/builder/SampleEntityBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.elasticsearch;
16+
package org.springframework.data.elasticsearch.builder;
1717

1818
import org.springframework.data.elasticsearch.core.query.IndexQuery;
19+
import org.springframework.data.elasticsearch.entities.SampleEntity;
1920

2021
/**
2122
* @author Rizwan Idrees

src/test/java/org/springframework/data/elasticsearch/StockPriceBuilder.java renamed to src/test/java/org/springframework/data/elasticsearch/builder/StockPriceBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.springframework.data.elasticsearch;
16+
package org.springframework.data.elasticsearch.builder;
1717

1818
import java.math.BigDecimal;
1919

2020
import org.springframework.data.elasticsearch.core.query.IndexQuery;
21+
import org.springframework.data.elasticsearch.entities.StockPrice;
2122

2223
/**
2324
* @author Artur Konczak

src/test/java/org/springframework/data/elasticsearch/core/DefaultEntityMapperTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
import org.junit.Before;
2424
import org.junit.Test;
25-
import org.springframework.data.elasticsearch.Car;
26-
import org.springframework.data.elasticsearch.CarBuilder;
25+
import org.springframework.data.elasticsearch.builder.CarBuilder;
26+
import org.springframework.data.elasticsearch.entities.Car;
2727

2828
/**
2929
* @author Artur Konczak

src/test/java/org/springframework/data/elasticsearch/core/DefaultResultMapperTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.junit.Test;
3535
import org.mockito.Mock;
3636
import org.mockito.MockitoAnnotations;
37-
import org.springframework.data.elasticsearch.Car;
37+
import org.springframework.data.elasticsearch.entities.Car;
3838

3939
/**
4040
* @author Artur Konczak

src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateParentChildTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import org.junit.Test;
2929
import org.junit.runner.RunWith;
3030
import org.springframework.beans.factory.annotation.Autowired;
31-
import org.springframework.data.elasticsearch.ParentEntity;
32-
import org.springframework.data.elasticsearch.ParentEntity.ChildEntity;
3331
import org.springframework.data.elasticsearch.core.query.IndexQuery;
3432
import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
33+
import org.springframework.data.elasticsearch.entities.ParentEntity;
34+
import org.springframework.data.elasticsearch.entities.ParentEntity.ChildEntity;
3535
import org.springframework.test.context.ContextConfiguration;
3636
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
3737

0 commit comments

Comments
 (0)