Search in sources :

Example 26 with RepositoryInformation

use of org.springframework.data.repository.core.RepositoryInformation in project spring-cloud-gcp by spring-cloud.

the class SpannerRepositoryFactoryTests method getTargetRepositoryTest.

@Test
public void getTargetRepositoryTest() {
    RepositoryInformation repoInfo = mock(RepositoryInformation.class);
    // @formatter:off
    Mockito.<Class<?>>when(repoInfo.getRepositoryBaseClass()).thenReturn(SimpleSpannerRepository.class);
    Mockito.<Class<?>>when(repoInfo.getDomainType()).thenReturn(TestEntity.class);
    // @formatter:on
    Object repo = this.spannerRepositoryFactory.getTargetRepository(repoInfo);
    assertThat(repo).isInstanceOf(SimpleSpannerRepository.class);
}
Also used : RepositoryInformation(org.springframework.data.repository.core.RepositoryInformation) Test(org.junit.Test)

Aggregations

RepositoryInformation (org.springframework.data.repository.core.RepositoryInformation)26 Test (org.junit.Test)22 RepositoryMetadata (org.springframework.data.repository.core.RepositoryMetadata)17 Method (java.lang.reflect.Method)13 ProxyFactory (org.springframework.aop.framework.ProxyFactory)3 HashSet (java.util.HashSet)1 Advice (org.aopalliance.aop.Advice)1 Before (org.junit.Before)1 DefaultMethodInvokingMethodInterceptor (org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor)1 ProjectionFactory (org.springframework.data.projection.ProjectionFactory)1 SpelAwareProxyProjectionFactory (org.springframework.data.projection.SpelAwareProxyProjectionFactory)1 EntityInformation (org.springframework.data.repository.core.EntityInformation)1 EventPublishingMethodInterceptor (org.springframework.data.repository.core.support.EventPublishingRepositoryProxyPostProcessor.EventPublishingMethodInterceptor)1 RepositoryFactoryInformation (org.springframework.data.repository.core.support.RepositoryFactoryInformation)1 QueryByExampleExecutor (org.springframework.data.repository.query.QueryByExampleExecutor)1