use of org.springframework.data.jdbc.core.convert.DataAccessStrategy in project spring-data-jdbc by spring-projects.
the class EnableJdbcRepositoriesIntegrationTests method jdbcOperationsRef.
// DATAJDBC-293
@Test
public void jdbcOperationsRef() {
NamedParameterJdbcOperations operations = (NamedParameterJdbcOperations) ReflectionUtils.getField(OPERATIONS, factoryBean);
assertThat(operations).isNotSameAs(defaultOperations).isSameAs(qualifierJdbcOperations);
DataAccessStrategy dataAccessStrategy = (DataAccessStrategy) ReflectionUtils.getField(DATA_ACCESS_STRATEGY, factoryBean);
assertThat(dataAccessStrategy).isNotSameAs(defaultDataAccessStrategy).isSameAs(qualifierDataAccessStrategy);
}
use of org.springframework.data.jdbc.core.convert.DataAccessStrategy in project spring-data-jdbc by spring-projects.
the class JdbcRepositoryFactoryBeanUnitTests method setUp.
@BeforeEach
public void setUp() {
this.mappingContext = new JdbcMappingContext();
// Setup standard configuration
factoryBean = new JdbcRepositoryFactoryBean<>(DummyEntityRepository.class);
when(beanFactory.getBean(NamedParameterJdbcOperations.class)).thenReturn(mock(NamedParameterJdbcOperations.class));
ObjectProvider<DataAccessStrategy> provider = mock(ObjectProvider.class);
when(beanFactory.getBeanProvider(DataAccessStrategy.class)).thenReturn(provider);
when(provider.getIfAvailable(any())).then((Answer<?>) invocation -> ((Supplier<?>) invocation.getArgument(0)).get());
}
Aggregations