Examples of RepositoryMetadata


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

   * @see DATACMNS-483
   */
  @Test
  public void discoversDomainTypeOnNestedReturnTypeWrapper() throws Exception {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(OptionalRepository.class);

    Method method = OptionalRepository.class.getMethod("findByLastname", String.class);
    assertThat(metadata.getReturnedDomainClass(method), is(typeCompatibleWith(User.class)));
  }
View Full Code Here

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

   * @see DATACMNS-501
   */
  @Test
  public void discoversDomainAndIdTypeForIntermediateRepository() {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(IdTypeFixingRepository.class);

    assertThat(metadata.getDomainType(), is(typeCompatibleWith(Object.class)));
    assertThat(metadata.getIdType(), is(typeCompatibleWith(Long.class)));
  }
View Full Code Here

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

  @Test
  public void discoversRepositoryBaseClassMethod() throws Exception {

    Method method = FooRepository.class.getMethod("findOne", Integer.class);
    RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
    DefaultRepositoryInformation information = new DefaultRepositoryInformation(metadata, REPOSITORY, null);

    Method reference = information.getTargetClassMethod(method);
    assertEquals(REPOSITORY, reference.getDeclaringClass());
    assertThat(reference.getName(), is("findOne"));
View Full Code Here

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

  @Test
  public void discoveresNonRepositoryBaseClassMethod() throws Exception {

    Method method = FooRepository.class.getMethod("findOne", Long.class);

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

    assertThat(information.getTargetClassMethod(method), is(method));
  }
View Full Code Here

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

  }

  @Test
  public void discoversCustomlyImplementedCrudMethod() throws SecurityException, NoSuchMethodException {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(FooRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, CrudRepository.class,
        customImplementation.getClass());

    Method source = FooRepositoryCustom.class.getMethod("save", User.class);
    Method expected = customImplementation.getClass().getMethod("save", User.class);
View Full Code Here

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

  }

  @Test
  public void considersIntermediateMethodsAsFinderMethods() {

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

    assertThat(information.hasCustomMethod(), is(false));
  }
View Full Code Here

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

   * @see DATACMNS-151
   */
  @Test
  public void doesNotConsiderManuallyDefinedSaveMethodAQueryMethod() {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(CustomRepository.class);
    RepositoryInformation information = new DefaultRepositoryInformation(metadata, PagingAndSortingRepository.class,
        null);
    assertThat(information.getQueryMethods(), is(IsEmptyIterable.<Method> emptyIterable()));
  }
View Full Code Here

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

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

  }

  @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

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

   * @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
TOP
Copyright © 2018 www.massapi.com. 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.