Skip to content

Remove lombok. #1735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@
<scope>test</scope>
</dependency>

<!--
we don't use lombok in Spring Data Elasticsearch anymore. But the dependency is set in the parent project, and so the
lombok compiler stuff is executed regardless of the fact that we don't need it.
On AdoptOpenJdk 16.0.0 this leads to an error, so the project does not build.
Therefore we replace lombok with a jar - that just contains an empty file - that lives in a local maven repository in
src/test/resources/local-maven-repo/
It was installed with
mvn deploy:deploy-file -DgroupId=org.projectlombok -DartifactId=lombok -Dversion=999999 -Durl=file:./src/test/resources/local-maven-repo/ -DrepositoryId=local-maven-repo -DupdateReleaseInfo=true -Dfile=path/to/empty.jar
-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>999999</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
Expand Down Expand Up @@ -435,6 +451,12 @@
<id>spring-libs-snapshot</id>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>

<repository>
<id>local-maven-repo</id>
<url>file:///${project.basedir}/src/test/resources/local-maven-repo</url>
</repository>

</repositories>

<pluginRepositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.springframework.data.elasticsearch.utils.IdGenerator.*;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -53,6 +49,7 @@
import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchRestTemplateConfiguration;
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
import org.springframework.data.elasticsearch.utils.IndexInitializer;
import org.springframework.lang.Nullable;
import org.springframework.test.context.ContextConfiguration;

/**
Expand Down Expand Up @@ -384,82 +381,238 @@ public void shouldIndexAndSearchMapAsNestedType() {
assertThat(books.getSearchHit(0).getContent().getId()).isEqualTo(book2.getId());
}

@Setter
@Getter
@Document(indexName = "test-index-book-nested-objects", replicas = 0, refreshInterval = "-1")
static class Book {

@Id private String id;
private String name;
@Field(type = FieldType.Object) private Author author;
@Field(type = FieldType.Nested) private Map<Integer, Collection<String>> buckets = new HashMap<>();
@MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"),
@Nullable @Id private String id;
@Nullable private String name;
@Nullable @Field(type = FieldType.Object) private Author author;
@Nullable @Field(type = FieldType.Nested) private Map<Integer, Collection<String>> buckets = new HashMap<>();
@Nullable @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"),
otherFields = { @InnerField(suffix = "prefix", type = FieldType.Text, analyzer = "stop",
searchAnalyzer = "standard") }) private String description;

@Nullable
public String getId() {
return id;
}

public void setId(@Nullable String id) {
this.id = id;
}

@Nullable
public String getName() {
return name;
}

public void setName(@Nullable String name) {
this.name = name;
}

@Nullable
public Author getAuthor() {
return author;
}

public void setAuthor(@Nullable Author author) {
this.author = author;
}

@Nullable
public Map<Integer, Collection<String>> getBuckets() {
return buckets;
}

public void setBuckets(@Nullable Map<Integer, Collection<String>> buckets) {
this.buckets = buckets;
}

@Nullable
public String getDescription() {
return description;
}

public void setDescription(@Nullable String description) {
this.description = description;
}
}

@Data
@Document(indexName = "test-index-person", replicas = 0, refreshInterval = "-1")
static class Person {

@Id private String id;

private String name;

@Field(type = FieldType.Nested) private List<Car> car;

@Field(type = FieldType.Nested, includeInParent = true) private List<Book> books;
@Nullable @Id private String id;
@Nullable private String name;
@Nullable @Field(type = FieldType.Nested) private List<Car> car;
@Nullable @Field(type = FieldType.Nested, includeInParent = true) private List<Book> books;

@Nullable
public String getId() {
return id;
}

public void setId(@Nullable String id) {
this.id = id;
}

@Nullable
public String getName() {
return name;
}

public void setName(@Nullable String name) {
this.name = name;
}

@Nullable
public List<Car> getCar() {
return car;
}

public void setCar(@Nullable List<Car> car) {
this.car = car;
}

@Nullable
public List<Book> getBooks() {
return books;
}

public void setBooks(@Nullable List<Book> books) {
this.books = books;
}
}

@Data
static class Car {

private String name;
private String model;
@Nullable private String name;
@Nullable private String model;

@Nullable
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Nullable
public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}
}

/**
* @author Rizwan Idrees
* @author Mohsin Husen
* @author Artur Konczak
*/
@Data
@Document(indexName = "test-index-person-multiple-level-nested", replicas = 0, refreshInterval = "-1")
static class PersonMultipleLevelNested {

@Id private String id;

private String name;

@Field(type = FieldType.Nested) private List<GirlFriend> girlFriends;

@Field(type = FieldType.Nested) private List<Car> cars;

@Field(type = FieldType.Nested, includeInParent = true) private List<Car> bestCars;
@Nullable @Id private String id;
@Nullable private String name;
@Nullable @Field(type = FieldType.Nested) private List<GirlFriend> girlFriends;
@Nullable @Field(type = FieldType.Nested) private List<Car> cars;
@Nullable @Field(type = FieldType.Nested, includeInParent = true) private List<Car> bestCars;

@Nullable
public String getId() {
return id;
}

public void setId(@Nullable String id) {
this.id = id;
}

@Nullable
public String getName() {
return name;
}

public void setName(@Nullable String name) {
this.name = name;
}

@Nullable
public List<GirlFriend> getGirlFriends() {
return girlFriends;
}

public void setGirlFriends(@Nullable List<GirlFriend> girlFriends) {
this.girlFriends = girlFriends;
}

@Nullable
public List<Car> getCars() {
return cars;
}

public void setCars(@Nullable List<Car> cars) {
this.cars = cars;
}

@Nullable
public List<Car> getBestCars() {
return bestCars;
}

public void setBestCars(@Nullable List<Car> bestCars) {
this.bestCars = bestCars;
}
}

/**
* @author Mohsin Husen
*/
@Data
static class GirlFriend {

private String name;

private String type;

@Field(type = FieldType.Nested) private List<Car> cars;
@Nullable private String name;
@Nullable private String type;
@Nullable @Field(type = FieldType.Nested) private List<Car> cars;

@Nullable
public String getName() {
return name;
}

public void setName(@Nullable String name) {
this.name = name;
}

@Nullable
public String getType() {
return type;
}

public void setType(@Nullable String type) {
this.type = type;
}

@Nullable
public List<Car> getCars() {
return cars;
}

public void setCars(@Nullable List<Car> cars) {
this.cars = cars;
}
}

/**
* @author Rizwan Idrees
* @author Mohsin Husen
*/
@Data
static class Author {

private String id;
private String name;
@Nullable private String id;
@Nullable private String name;

@Nullable
public String getId() {
return id;
}

public void setId(@Nullable String id) {
this.id = id;
}

@Nullable
public String getName() {
return name;
}

public void setName(@Nullable String name) {
this.name = name;
}
}

}
Loading