Package org.springframework.data.rest.core

Examples of org.springframework.data.rest.core.Path


  @Test
  public void honorsAnnotatedsMapping() {

    CollectionResourceMapping mapping = getResourceMappingFor(AnnotatedPersonRepository.class);

    assertThat(mapping.getPath(), is(new Path("bar")));
    assertThat(mapping.getRel(), is("foo"));
    assertThat(mapping.getItemResourceRel(), is("annotatedPerson"));
    assertThat(mapping.isExported(), is(false));
  }
View Full Code Here


  @Test
  public void repositoryAnnotationTrumpsDomainTypeMapping() {

    CollectionResourceMapping mapping = getResourceMappingFor(AnnotatedAnnotatedPersonRepository.class);

    assertThat(mapping.getPath(), is(new Path("/trumpsAll")));
    assertThat(mapping.getRel(), is("foo"));
    assertThat(mapping.getItemResourceRel(), is("annotatedPerson"));
    assertThat(mapping.isExported(), is(true));
  }
View Full Code Here

  public void defaultsMappingToMethodName() throws Exception {

    Method method = PersonRepository.class.getMethod("findByLastname", String.class);
    ResourceMapping mapping = new RepositoryMethodResourceMapping(method, resourceMapping);

    assertThat(mapping.getPath(), is(new Path("findByLastname")));
  }
View Full Code Here

  public void usesConfiguredNameWithLeadingSlash() throws Exception {

    Method method = PersonRepository.class.getMethod("findByFirstname", String.class);
    ResourceMapping mapping = new RepositoryMethodResourceMapping(method, resourceMapping);

    assertThat(mapping.getPath(), is(new Path("bar")));
  }
View Full Code Here

  public void usesPropertyNameAsDefaultResourceMappingRelAndPath() {

    ResourceMapping mapping = getPropertyMappingFor(Entity.class, "first");

    assertThat(mapping, is(notNullValue()));
    assertThat(mapping.getPath(), is(new Path("first")));
    assertThat(mapping.getRel(), is("first"));
    assertThat(mapping.isExported(), is(true));
  }
View Full Code Here

  public void considersMappingAnnotationOnDomainClassProperty() {

    ResourceMapping mapping = getPropertyMappingFor(Entity.class, "second");

    assertThat(mapping, is(notNullValue()));
    assertThat(mapping.getPath(), is(new Path("secPath")));
    assertThat(mapping.getRel(), is("secRel"));
    assertThat(mapping.isExported(), is(false));
  }
View Full Code Here

  public void considersMappingAnnotationOnDomainClassPropertyMethod() {

    ResourceMapping mapping = getPropertyMappingFor(Entity.class, "third");

    assertThat(mapping, is(notNullValue()));
    assertThat(mapping.getPath(), is(new Path("thirdPath")));
    assertThat(mapping.getRel(), is("thirdRel"));
    assertThat(mapping.isExported(), is(false));
  }
View Full Code Here

      }
    });

    Link link = entityLinks.linkToCollectionResource(persistentEntity.getType()).expand();

    LinkCollectingAssociationHandler associationHandler = new LinkCollectingAssociationHandler(repositories, new Path(
        link.getHref()), new AssociationLinks(mappings));
    persistentEntity.doWithAssociations(associationHandler);

    jsonSchema.add(associationHandler.getLinks());
View Full Code Here

      }

      List<Link> links = new ArrayList<Link>();
      links.addAll(resource.getLinks());

      Path basePath = new Path(id.expand().getHref());
      LinkCollectingAssociationHandler associationHandler = new LinkCollectingAssociationHandler(entities, basePath,
          associationLinks);
      resource.getPersistentEntity().doWithAssociations(associationHandler);

      for (Link link : associationHandler.getLinks()) {
View Full Code Here

   */
  @Test
  public void createsLinkToAssociationProperty() {

    PersistentProperty<?> property = exposeProperty("property");
    List<Link> associationLinks = links.getLinksFor(property.getAssociation(), new Path("/base"));

    assertThat(associationLinks, hasSize(1));
    assertThat(associationLinks, hasItem(new Link("/base/property", "property")));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.rest.core.Path

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.