use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class AnnotationRepositoryMetadataUnitTests method handlesRepositoryProxyAnnotationCorrectly.
@Test
public void handlesRepositoryProxyAnnotationCorrectly() {
RepositoryMetadata metadata = new AnnotationRepositoryMetadata(AnnotatedRepository.class);
assertThat(metadata.getDomainType()).isEqualTo(User.class);
assertThat(metadata.getIdType()).isEqualTo(Integer.class);
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultCrudMethodsUnitTests method getMethodsFor.
private static CrudMethods getMethodsFor(Class<?> repositoryInterface) {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(repositoryInterface);
RepositoryInformation information = new DefaultRepositoryInformation(metadata, PagingAndSortingRepository.class, RepositoryComposition.empty());
return new DefaultCrudMethods(information);
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultRepositoryInformationUnitTests method usesCorrectSaveOverload.
// DATACMNS-943
@Test
public void usesCorrectSaveOverload() throws Exception {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(DummyRepository.class);
RepositoryInformation information = new DefaultRepositoryInformation(metadata, DummyRepositoryImpl.class, RepositoryComposition.empty());
Method method = DummyRepository.class.getMethod("saveAll", Iterable.class);
assertThat(information.getTargetClassMethod(method)).isEqualTo(DummyRepositoryImpl.class.getMethod("saveAll", Iterable.class));
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultRepositoryInformationUnitTests method ignoresStaticMethod.
// DATACMNS-939
@Test
public void ignoresStaticMethod() throws SecurityException, NoSuchMethodException {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, RepositoryComposition.just(customImplementation));
Method method = FooRepository.class.getMethod("staticMethod");
assertThat(information.getQueryMethods()).doesNotContain(method);
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultRepositoryInformationUnitTests method discoversCustomlyImplementedCrudMethodWithGenericParameters.
// DATACMNS-912
@Test
public void discoversCustomlyImplementedCrudMethodWithGenericParameters() throws Exception {
GenericsSaveRepositoryImpl customImplementation = new GenericsSaveRepositoryImpl();
RepositoryMetadata metadata = new DefaultRepositoryMetadata(GenericsSaveRepository.class);
RepositoryInformation information = new DefaultRepositoryInformation(metadata, RepositoryFactorySupport.class, RepositoryComposition.just(customImplementation).withMethodLookup(MethodLookups.forRepositoryTypes(metadata)));
Method customBaseRepositoryMethod = GenericsSaveRepository.class.getMethod("save", Object.class);
assertThat(information.isCustomMethod(customBaseRepositoryMethod)).isTrue();
}
Aggregations