Package org.springframework.hateoas

Examples of org.springframework.hateoas.ResourceSupport


  @Test
  public void rendersCorrectSearchLinksForPersons() throws Exception {

    RootResourceInformation request = getResourceInformation(Person.class);
    ResourceSupport resource = controller.listSearches(request);

    ResourceTester tester = ResourceTester.of(resource);
    tester.assertNumberOfLinks(4);
    tester.assertHasLinkEndingWith("findFirstPersonByFirstName", "findFirstPersonByFirstName{?firstName}");
    tester.assertHasLinkEndingWith("firstname", "firstname{?firstName,page,size,sort}");
View Full Code Here


          return resource;
        }
      }
    };

    ResourceSupport responseResource = doWithReferencedProperty(repoRequest, id, property, handler, HttpMethod.GET);
    return ControllerUtils.toResponseEntity(HttpStatus.OK, headers, responseResource);
  }
View Full Code Here

        }
        throw new ResourceNotFoundException();
      }
    };

    ResourceSupport responseResource = doWithReferencedProperty(repoRequest, id, property, handler, HttpMethod.GET);
    return ControllerUtils.toResponseEntity(HttpStatus.OK, headers, responseResource);
  }
View Full Code Here

    ResourceMetadata repoMapping = repoRequest.getResourceMetadata();
    PersistentProperty<?> persistentProp = repoRequest.getPersistentEntity().getPersistentProperty(property);
    ResourceMapping propertyMapping = repoMapping.getMappingFor(persistentProp);

    ResourceSupport resource = response.getBody();

    List<Link> links = new ArrayList<Link>();

    ControllerLinkBuilder linkBuilder = linkTo(methodOn(RepositoryPropertyReferenceController.class)
        .followPropertyReference(repoRequest, id, property, assembler));
View Full Code Here

      }

      ReflectionUtils.setField(CONTENT_FIELD, resources, result);
    }

    ResourceSupport result = (ResourceSupport) invokeProcessorsFor(value, targetType);
    delegate.handleReturnValue(rewrapResult(result, returnValue), returnType, mavContainer, webRequest);
  }
View Full Code Here

    if (queryMethodLinks.isEmpty()) {
      throw new ResourceNotFoundException();
    }

    ResourceSupport result = new ResourceSupport();
    result.add(queryMethodLinks);

    return result;
  }
View Full Code Here

   * @see #29
   */
  @Test
  public void rendersSingleLinkAsObject() throws Exception {

    ResourceSupport resourceSupport = new ResourceSupport();
    resourceSupport.add(new Link("localhost"));

    assertThat(write(resourceSupport), is(SINGLE_LINK_REFERENCE));
  }
View Full Code Here

    assertThat(write(resourceSupport), is(SINGLE_LINK_REFERENCE));
  }

  @Test
  public void deserializeSingleLink() throws Exception {
    ResourceSupport expected = new ResourceSupport();
    expected.add(new Link("localhost"));
    assertThat(read(SINGLE_LINK_REFERENCE, ResourceSupport.class), is(expected));
  }
View Full Code Here

   * @see #29
   */
  @Test
  public void rendersMultipleLinkAsArray() throws Exception {

    ResourceSupport resourceSupport = new ResourceSupport();
    resourceSupport.add(new Link("localhost"));
    resourceSupport.add(new Link("localhost2"));

    assertThat(write(resourceSupport), is(LIST_LINK_REFERENCE));
  }
View Full Code Here

  }

  @Test
  public void deserializeMultipleLinks() throws Exception {

    ResourceSupport expected = new ResourceSupport();
    expected.add(new Link("localhost"));
    expected.add(new Link("localhost2"));

    assertThat(read(LIST_LINK_REFERENCE, ResourceSupport.class), is(expected));
  }
View Full Code Here

TOP

Related Classes of org.springframework.hateoas.ResourceSupport

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.