DATAES-260 added missing test

This commit is contained in:
Artur Konczak 2016-08-22 00:31:40 +01:00
parent 2718be7c07
commit 7a95cb64a8
3 changed files with 61 additions and 0 deletions

View File

@ -164,4 +164,20 @@ public class MappingBuilderTests {
assertThat(result, containsString("\"pointC\":{\"type\":\"geo_point\""));
assertThat(result, containsString("\"pointD\":{\"type\":\"geo_point\""));
}
/**
* DATAES-260 - StacOverflow when two reverse relationship.
*/
@Test
public void shouldHandleReverseRelationship() {
//given
elasticsearchTemplate.createIndex(User.class);
elasticsearchTemplate.putMapping(User.class);
elasticsearchTemplate.createIndex(Group.class);
elasticsearchTemplate.putMapping(Group.class);
//when
//then
}
}

View File

@ -0,0 +1,23 @@
package org.springframework.data.elasticsearch.entities;
import java.util.HashSet;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* Created by akonczak on 21/08/2016.
*/
@Document(indexName = "groups", type = "group")
public class Group {
@Id
String id;
@Field(type = FieldType.Nested, ignoreFields ={"groups"})
private Set<User> users = new HashSet<User>();
}

View File

@ -0,0 +1,22 @@
package org.springframework.data.elasticsearch.entities;
import java.util.HashSet;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* Created by akonczak on 21/08/2016.
*/
@Document(indexName = "users", type = "user")
public class User {
@Id
private String id;
@Field(type= FieldType.Nested,ignoreFields={"users"})
private Set<Group> groups = new HashSet<Group>();
}