Search in sources :

Example 1 with BackendConfiguration

use of org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration in project hibernate-search by hibernate.

the class DocumentationSetupHelper method testParamsForBothAnnotationsAndProgrammatic.

public static List<DocumentationSetupHelper> testParamsForBothAnnotationsAndProgrammatic(BackendConfiguration backendConfiguration, Consumer<ProgrammaticMappingConfigurationContext> programmaticMappingContributor) {
    HibernateOrmSearchMappingConfigurer mappingConfigurer = context -> programmaticMappingContributor.accept(context.programmaticMapping());
    List<DocumentationSetupHelper> result = new ArrayList<>();
    // Annotation-based mapping
    result.add(withSingleBackend(backendConfiguration, null));
    // Programmatic mapping
    result.add(withSingleBackend(backendConfiguration, mappingConfigurer));
    return result;
}
Also used : Arrays(java.util.Arrays) SchemaManagementStrategyName(org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName) SimpleSessionFactoryBuilder(org.hibernate.search.util.impl.integrationtest.mapper.orm.SimpleSessionFactoryBuilder) SessionFactory(org.hibernate.SessionFactory) HibernateOrmMappingHandle(org.hibernate.search.util.impl.integrationtest.mapper.orm.HibernateOrmMappingHandle) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Consumer(java.util.function.Consumer) AutomaticIndexingSynchronizationStrategyNames(org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames) List(java.util.List) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) HibernateOrmMapperSettings(org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) Map(java.util.Map) BackendMappingHandle(org.hibernate.search.util.impl.integrationtest.common.stub.backend.BackendMappingHandle) MappingSetupHelper(org.hibernate.search.util.impl.integrationtest.common.rule.MappingSetupHelper) BackendSetupStrategy(org.hibernate.search.util.impl.integrationtest.common.rule.BackendSetupStrategy) BackendConfiguration(org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) ArrayList(java.util.ArrayList)

Example 2 with BackendConfiguration

use of org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration in project hibernate-search by hibernate.

the class DocumentationSetupHelper method testParamsForBothAnnotationsAndProgrammatic.

public static List<DocumentationSetupHelper> testParamsForBothAnnotationsAndProgrammatic(BackendSetupStrategy backendSetupStrategy, BackendConfiguration defaultBackendConfiguration, Set<Class<?>> additionalAnnotatedClasses, Consumer<ProgrammaticMappingConfigurationContext> programmaticMappingContributor) {
    List<DocumentationSetupHelper> result = new ArrayList<>();
    // Annotation-based mapping
    HibernateOrmSearchMappingConfigurer annotationMappingConfigurer = additionalAnnotatedClasses.isEmpty() ? null : context -> context.annotationMapping().add(additionalAnnotatedClasses);
    result.add(new DocumentationSetupHelper(backendSetupStrategy, null, annotationMappingConfigurer));
    // Programmatic mapping
    HibernateOrmSearchMappingConfigurer programmaticMappingConfigurer = context -> programmaticMappingContributor.accept(context.programmaticMapping());
    result.add(new DocumentationSetupHelper(backendSetupStrategy, false, programmaticMappingConfigurer));
    return result;
}
Also used : Arrays(java.util.Arrays) SchemaManagementStrategyName(org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName) SimpleSessionFactoryBuilder(org.hibernate.search.util.impl.integrationtest.mapper.orm.SimpleSessionFactoryBuilder) SessionFactory(org.hibernate.SessionFactory) Set(java.util.Set) HibernateOrmMappingHandle(org.hibernate.search.util.impl.integrationtest.mapper.orm.HibernateOrmMappingHandle) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Consumer(java.util.function.Consumer) AutomaticIndexingSynchronizationStrategyNames(org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames) List(java.util.List) ProgrammaticMappingConfigurationContext(org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext) HibernateOrmMapperSettings(org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) Map(java.util.Map) MappingSetupHelper(org.hibernate.search.util.impl.integrationtest.common.rule.MappingSetupHelper) BackendMappingHandle(org.hibernate.search.util.impl.integrationtest.common.stub.backend.BackendMappingHandle) BackendSetupStrategy(org.hibernate.search.util.impl.integrationtest.common.rule.BackendSetupStrategy) Collections(java.util.Collections) BackendConfiguration(org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration) HibernateOrmSearchMappingConfigurer(org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Map (java.util.Map)2 Consumer (java.util.function.Consumer)2 SessionFactory (org.hibernate.SessionFactory)2 AutomaticIndexingSynchronizationStrategyNames (org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames)2 HibernateOrmMapperSettings (org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings)2 HibernateOrmSearchMappingConfigurer (org.hibernate.search.mapper.orm.mapping.HibernateOrmSearchMappingConfigurer)2 SchemaManagementStrategyName (org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName)2 ProgrammaticMappingConfigurationContext (org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext)2 BackendConfiguration (org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration)2 BackendSetupStrategy (org.hibernate.search.util.impl.integrationtest.common.rule.BackendSetupStrategy)2 MappingSetupHelper (org.hibernate.search.util.impl.integrationtest.common.rule.MappingSetupHelper)2 BackendMappingHandle (org.hibernate.search.util.impl.integrationtest.common.stub.backend.BackendMappingHandle)2 HibernateOrmMappingHandle (org.hibernate.search.util.impl.integrationtest.mapper.orm.HibernateOrmMappingHandle)2 SimpleSessionFactoryBuilder (org.hibernate.search.util.impl.integrationtest.mapper.orm.SimpleSessionFactoryBuilder)2 Collections (java.util.Collections)1 Set (java.util.Set)1