Search in sources :

Example 6 with MappingElasticsearchConverter

use of org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter in project spring-data-elasticsearch by spring-projects.

the class CriteriaQueryMappingUnitTests method setUp.

// region setup
@BeforeEach
void setUp() {
    SimpleElasticsearchMappingContext mappingContext = new SimpleElasticsearchMappingContext();
    mappingContext.setInitialEntitySet(Collections.singleton(Person.class));
    mappingContext.afterPropertiesSet();
    mappingElasticsearchConverter = new MappingElasticsearchConverter(mappingContext, new GenericConversionService());
    mappingElasticsearchConverter.afterPropertiesSet();
}
Also used : SimpleElasticsearchMappingContext(org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext) MappingElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with MappingElasticsearchConverter

use of org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter in project spring-data-elasticsearch by spring-projects.

the class ElasticsearchStringQueryUnitTestBase method setupConverter.

protected ElasticsearchConverter setupConverter() {
    MappingElasticsearchConverter converter = new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext());
    Collection<Converter<?, ?>> converters = new ArrayList<>();
    converters.add(ElasticsearchStringQueryUnitTests.CarConverter.INSTANCE);
    CustomConversions customConversions = new ElasticsearchCustomConversions(converters);
    converter.setConversions(customConversions);
    converter.afterPropertiesSet();
    return converter;
}
Also used : SimpleElasticsearchMappingContext(org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext) CustomConversions(org.springframework.data.convert.CustomConversions) ElasticsearchCustomConversions(org.springframework.data.elasticsearch.core.convert.ElasticsearchCustomConversions) ArrayList(java.util.ArrayList) MappingElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter) Converter(org.springframework.core.convert.converter.Converter) ElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter) MappingElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter) ElasticsearchCustomConversions(org.springframework.data.elasticsearch.core.convert.ElasticsearchCustomConversions)

Aggregations

MappingElasticsearchConverter (org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter)7 SimpleElasticsearchMappingContext (org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext)6 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)3 BeforeAll (org.junit.jupiter.api.BeforeAll)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ArrayList (java.util.ArrayList)1 Bean (org.springframework.context.annotation.Bean)1 Converter (org.springframework.core.convert.converter.Converter)1 CustomConversions (org.springframework.data.convert.CustomConversions)1 ElasticsearchConverter (org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter)1 ElasticsearchCustomConversions (org.springframework.data.elasticsearch.core.convert.ElasticsearchCustomConversions)1