Package org.springframework.data.repository.core

Examples of org.springframework.data.repository.core.RepositoryMetadata


   * @see DATACMNS-151
   */
  @Test
  public void doesNotConsiderRedeclaredSaveMethodAQueryMethod() throws Exception {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    Method saveMethod = BaseRepository.class.getMethod("save", Object.class);
    Method deleteMethod = BaseRepository.class.getMethod("delete", Object.class);

View Full Code Here


  }

  @Test
  public void onlyReturnsMostConcreteQueryMethod() throws Exception {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    Method intermediateMethod = BaseRepository.class.getMethod("genericMethodToOverride", String.class);
    Method concreteMethod = ConcreteRepository.class.getMethod("genericMethodToOverride", String.class);
View Full Code Here

   * @see DATACMNS-193
   */
  @Test
  public void detectsQueryMethodCorrectly() {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    Method queryMethod = getMethodFrom(ConcreteRepository.class, "findBySomethingDifferent");

    assertThat(information.getQueryMethods(), hasItem(queryMethod));
View Full Code Here

   * @see DATACMNS-364
   */
  @Test
  public void ignoresCrudMethodsAnnotatedWithQuery() throws Exception {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(ConcreteRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    Method method = BaseRepository.class.getMethod("findOne", Serializable.class);

    assertThat(information.getQueryMethods(), hasItem(method));
View Full Code Here

   * @see DATACMNS-385
   */
  @Test
  public void findsTargetSaveForIterableIfEntityImplementsIterable() throws Exception {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(BossRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    Method method = BossRepository.class.getMethod("save", Iterable.class);
    Method reference = CrudRepository.class.getMethod("save", Iterable.class);

View Full Code Here

   * @see DATACMNS-441
   */
  @Test
  public void getQueryShouldNotReturnAnyBridgeMethods() {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(CustomDefaultRepositoryMethodsRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class, null);

    for (Method method : information.getQueryMethods()) {
      assertFalse(method.isBridge());
    }
View Full Code Here

public class AnnotationRepositoryMetadataUnitTests {

  @Test
  public void handlesRepositoryProxyAnnotationCorrectly() {

    RepositoryMetadata metadata = new AnnotationRepositoryMetadata(AnnotatedRepository.class);
    assertEquals(User.class, metadata.getDomainType());
    assertEquals(Integer.class, metadata.getIdType());
  }
View Full Code Here

   * @see DATACMNS-98
   */
  @Test
  public void discoversSimpleReturnTypeCorrectly() throws Exception {

    RepositoryMetadata metadata = new DummyRepositoryMetadata(UserRepository.class);
    Method method = UserRepository.class.getMethod("findSingle");
    assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
  }
View Full Code Here

  /**
   * @see DATACMNS-98
   */
  @Test
  public void resolvesTypeParameterReturnType() throws Exception {
    RepositoryMetadata metadata = new DummyRepositoryMetadata(ConcreteRepository.class);
    Method method = ConcreteRepository.class.getMethod("intermediateMethod");
    assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
  }
View Full Code Here

   * @see DATACMNS-98
   */
  @Test
  public void determinesReturnTypeFromPageable() throws Exception {

    RepositoryMetadata metadata = new DummyRepositoryMetadata(ExtendingRepository.class);
    Method method = ExtendingRepository.class.getMethod("findByFirstname", Pageable.class, String.class);
    assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.repository.core.RepositoryMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.