use of org.springframework.data.repository.core.support.RepositoryFactorySupport in project spring-boot by spring-projects.
the class MetricsRepositoryMethodInvocationListenerBeanPostProcessorTests method postProcessBeforeInitializationWhenRepositoryFactoryBeanSupportAddsListener.
@Test
@SuppressWarnings("rawtypes")
void postProcessBeforeInitializationWhenRepositoryFactoryBeanSupportAddsListener() {
RepositoryFactoryBeanSupport bean = mock(RepositoryFactoryBeanSupport.class);
Object result = this.postProcessor.postProcessBeforeInitialization(bean, "name");
assertThat(result).isSameAs(bean);
ArgumentCaptor<RepositoryFactoryCustomizer> customizer = ArgumentCaptor.forClass(RepositoryFactoryCustomizer.class);
then(bean).should().addRepositoryFactoryCustomizer(customizer.capture());
RepositoryFactorySupport repositoryFactory = mock(RepositoryFactorySupport.class);
customizer.getValue().customize(repositoryFactory);
then(repositoryFactory).should().addInvocationListener(this.listener);
}
use of org.springframework.data.repository.core.support.RepositoryFactorySupport in project spring-data-mongodb by spring-projects.
the class MongoRepositoryFactoryBeanUnitTests method getListenersFromFactory.
@SuppressWarnings({ "unchecked", "rawtypes" })
private List<Object> getListenersFromFactory(MongoRepositoryFactoryBean factoryBean) {
when(operations.getConverter()).thenReturn(converter);
when(converter.getMappingContext()).thenReturn(context);
factoryBean.setLazyInit(true);
factoryBean.setMongoOperations(operations);
factoryBean.afterPropertiesSet();
RepositoryFactorySupport factory = factoryBean.createRepositoryFactory();
return (List<Object>) ReflectionTestUtils.getField(factory, "queryPostProcessors");
}
use of org.springframework.data.repository.core.support.RepositoryFactorySupport in project spring-data-commons by spring-projects.
the class CdiRepositoryBean method create.
/**
* Creates the actual component instance given a {@link RepositoryFactorySupport repository factory supplier} and the
* repository {@link Class type}. This method is an utility for to create a repository. This method will obtain a
* {@link RepositoryFactorySupport repository factory} and configure it with {@link CdiRepositoryConfiguration}.
*
* @param factorySupplier must not be {@literal null}.
* @param repositoryType must not be {@literal null}.
* @return
* @since 2.1
*/
protected T create(Supplier<? extends RepositoryFactorySupport> factorySupplier, Class<T> repositoryType) {
CdiRepositoryConfiguration configuration = lookupConfiguration(beanManager, qualifiers);
RepositoryFragments repositoryFragments = getRepositoryFragments(repositoryType, configuration);
RepositoryFactorySupport factory = factorySupplier.get();
applyConfiguration(factory, configuration);
return create(factory, repositoryType, repositoryFragments);
}
use of org.springframework.data.repository.core.support.RepositoryFactorySupport in project spring-cloud-gcp by spring-cloud.
the class SpannerRepositoryFactoryBeanTests method createRepositoryFactoryTest.
@Test
public void createRepositoryFactoryTest() {
RepositoryFactorySupport factory = this.spannerRepositoryFactoryBean.createRepositoryFactory();
assertThat(factory).isInstanceOf(SpannerRepositoryFactory.class);
}
use of org.springframework.data.repository.core.support.RepositoryFactorySupport in project spring-cloud-gcp by spring-cloud.
the class DatastoreRepositoryFactoryBeanTests method createRepositoryFactoryTest.
@Test
public void createRepositoryFactoryTest() {
RepositoryFactorySupport factory = this.datastoreRepositoryFactoryBean.createRepositoryFactory();
assertThat(factory.getClass()).isEqualTo(DatastoreRepositoryFactory.class);
}
Aggregations