Skip to content

Commit

Permalink
DATAES-260 added missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
akonczak committed Aug 21, 2016
1 parent 2718be7 commit 7a95cb6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Expand Up @@ -164,4 +164,20 @@ public void shouldBuildMappingsForGeoPoint() throws IOException {
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

}
}
@@ -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>();
}
@@ -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>();
}

0 comments on commit 7a95cb6

Please sign in to comment.