Search in sources :

Example 11 with SimpleElasticsearchMappingContext

use of org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext in project spring-boot by spring-projects.

the class ElasticsearchDataAutoConfigurationTests method defaultConversionsRegisterBigDecimalAsSimpleType.

@Test
void defaultConversionsRegisterBigDecimalAsSimpleType() {
    this.contextRunner.run((context) -> {
        SimpleElasticsearchMappingContext mappingContext = context.getBean(SimpleElasticsearchMappingContext.class);
        assertThat(mappingContext).extracting("simpleTypeHolder", InstanceOfAssertFactories.type(SimpleTypeHolder.class)).satisfies((simpleTypeHolder) -> assertThat(simpleTypeHolder.isSimpleType(BigDecimal.class)).isTrue());
    });
}
Also used : SimpleElasticsearchMappingContext(org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext) BigDecimal(java.math.BigDecimal) Test(org.junit.jupiter.api.Test)

Example 12 with SimpleElasticsearchMappingContext

use of org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext in project spring-data-elasticsearch by spring-projects.

the class AbstractElasticsearchTemplate method createElasticsearchConverter.

private ElasticsearchConverter createElasticsearchConverter() {
    MappingElasticsearchConverter mappingElasticsearchConverter = new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext());
    mappingElasticsearchConverter.afterPropertiesSet();
    return mappingElasticsearchConverter;
}
Also used : SimpleElasticsearchMappingContext(org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext) MappingElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter)

Example 13 with SimpleElasticsearchMappingContext

use of org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext in project spring-data-elasticsearch by spring-projects.

the class ElasticsearchPartQueryTests method setUp.

@BeforeEach
public void setUp() {
    converter = new MappingElasticsearchConverter(new SimpleElasticsearchMappingContext());
    when(operations.getElasticsearchConverter()).thenReturn(converter);
}
Also used : SimpleElasticsearchMappingContext(org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext) MappingElasticsearchConverter(org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 14 with SimpleElasticsearchMappingContext

use of org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext 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 15 with SimpleElasticsearchMappingContext

use of org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext 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

SimpleElasticsearchMappingContext (org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext)23 Test (org.junit.jupiter.api.Test)9 BeforeEach (org.junit.jupiter.api.BeforeEach)7 MappingElasticsearchConverter (org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter)6 GenericConversionService (org.springframework.core.convert.support.GenericConversionService)5 GeoJsonLineString (org.springframework.data.elasticsearch.core.geo.GeoJsonLineString)3 GeoJsonMultiLineString (org.springframework.data.elasticsearch.core.geo.GeoJsonMultiLineString)3 ArrayList (java.util.ArrayList)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 DisplayName (org.junit.jupiter.api.DisplayName)2 Document (org.springframework.data.elasticsearch.core.document.Document)2 SpringIntegrationTest (org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest)2 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Bean (org.springframework.context.annotation.Bean)1 ConversionService (org.springframework.core.convert.ConversionService)1 Converter (org.springframework.core.convert.converter.Converter)1 IsNewAwareAuditingHandler (org.springframework.data.auditing.IsNewAwareAuditingHandler)1