use of org.springframework.data.elasticsearch.core.routing.DefaultRoutingResolver in project spring-data-elasticsearch by spring-projects.
the class EntityOperationsTest method shouldReturnRoutingFromRoutingWhenJoinFieldIsSet.
// #1218
@Test
@DisplayName("should return routing from routing when JoinField is set")
void shouldReturnRoutingFromRoutingWhenJoinFieldIsSet() {
EntityWithRoutingAndJoinField entity = new EntityWithRoutingAndJoinField();
entity.setId("42");
entity.setRouting("theRoute");
entity.setJoinField(new JoinField<>("foo", "foo-routing"));
EntityOperations.AdaptibleEntity<EntityWithRoutingAndJoinField> adaptibleEntity = entityOperations.forEntity(entity, conversionService, new DefaultRoutingResolver(mappingContext));
String routing = adaptibleEntity.getRouting();
assertThat(routing).isEqualTo("theRoute");
}
use of org.springframework.data.elasticsearch.core.routing.DefaultRoutingResolver in project spring-data-elasticsearch by spring-projects.
the class EntityOperationsTest method shouldReturnRoutingFromDefaultRoutingAccessor.
// #1218
@Test
@DisplayName("should return routing from DefaultRoutingAccessor")
void shouldReturnRoutingFromDefaultRoutingAccessor() {
EntityWithRouting entity = new EntityWithRouting();
entity.setId("42");
entity.setRouting("theRoute");
EntityOperations.AdaptibleEntity<EntityWithRouting> adaptibleEntity = entityOperations.forEntity(entity, conversionService, new DefaultRoutingResolver(mappingContext));
String routing = adaptibleEntity.getRouting();
assertThat(routing).isEqualTo("theRoute");
}
use of org.springframework.data.elasticsearch.core.routing.DefaultRoutingResolver in project spring-data-elasticsearch by spring-projects.
the class EntityOperationsTest method shouldReturnRoutingFromJoinFieldWhenRoutingValueIsNull.
// #1218
@Test
@DisplayName("should return routing from JoinField when routing value is null")
void shouldReturnRoutingFromJoinFieldWhenRoutingValueIsNull() {
EntityWithRoutingAndJoinField entity = new EntityWithRoutingAndJoinField();
entity.setId("42");
entity.setJoinField(new JoinField<>("foo", "foo-routing"));
EntityOperations.AdaptibleEntity<EntityWithRoutingAndJoinField> adaptibleEntity = entityOperations.forEntity(entity, conversionService, new DefaultRoutingResolver(mappingContext));
String routing = adaptibleEntity.getRouting();
assertThat(routing).isEqualTo("foo-routing");
}
Aggregations