Package org.springframework.data.rest.core.domain.jpa

Examples of org.springframework.data.rest.core.domain.jpa.Person


  @Autowired PersonRepository repository;

  @Before
  public void populateDatabase() {
    repository.save(new Person("John", "Doe"));
  }
View Full Code Here


  @Autowired PersonRepository people;
  Person person;

  @Before
  public void setup() {
    person = people.save(new Person("Jane", "Doe"));
  }
View Full Code Here

  }

  @Test
  public void invokesFindOneWithStringIdCorrectly() {

    Person person = repository.findAll().iterator().next();
    assertThat(person, is(notNullValue()));

    Object result = invoker.invokeFindOne(person.getId().toString());
    assertThat(result, is(instanceOf(Person.class)));
  }
View Full Code Here

  @Test
  public void invokesRedeclaredSave() {

    RepositoryInvoker invoker = getInvokerFor(orderRepository, OrderRepository.class);

    Person person = personRepository.findOne(1L);
    invoker.invokeSave(new Order(person));
  }
View Full Code Here

   * @see DATAREST-216
   */
  @Test
  public void invokesRedeclaredFindOne() {

    Person person = personRepository.findOne(1L);
    Order order = orderRepository.save(new Order(person));

    RepositoryInvoker invoker = getInvokerFor(orderRepository, OrderRepository.class);
    invoker.invokeFindOne(order.getId());
  }
View Full Code Here

   * @see DATAREST-216
   */
  @Test
  public void invokesDeleteOnCrudRepository() {

    Person person = personRepository.findOne(1L);
    Order order = orderRepository.save(new Order(person));

    RepositoryInvoker invoker = getInvokerFor(orderRepository, CrudRepository.class);
    invoker.invokeDelete(order.getId());
  }
View Full Code Here

  @Autowired ApplicationContext context;

  @Test(expected = RepositoryConstraintViolationException.class)
  public void shouldValidateLastName() throws Exception {
    context.publishEvent(new BeforeSaveEvent(new Person()));
  }
View Full Code Here

   * @see DATAREST-130
   */
  @Test
  public void mergeNewValue() {

    Person incoming = new Person("Bilbo", "Baggins");
    Person existingDomainObject = new Person("Frodo", "Baggins");

    merger.merge(incoming, existingDomainObject, APPLY_NULLS);

    assertThat(existingDomainObject.getFirstName(), is(incoming.getFirstName()));
    assertThat(existingDomainObject.getLastName(), is(incoming.getLastName()));
  }
View Full Code Here

   * @see DATAREST-130
   */
  @Test
  public void mergeNullValue() {

    Person incoming = new Person(null, null);
    Person existingDomainObject = new Person("Frodo", "Baggins");

    merger.merge(incoming, existingDomainObject, APPLY_NULLS);

    assertThat(existingDomainObject.getFirstName(), is(incoming.getFirstName()));
    assertThat(existingDomainObject.getLastName(), is(incoming.getLastName()));
  }
View Full Code Here

   * @see DATAREST-327
   */
  @Test
  public void doesNotMergeEmptyCollectionsForReferences() {

    Person bilbo = new Person("Bilbo", "Baggins");

    Person frodo = new Person("Frodo", "Baggins");
    frodo.setSiblings(Arrays.asList(bilbo));

    merger.merge(new Person("Sam", null), frodo, IGNORE_NULLS);

    assertThat(frodo.getSiblings(), is(not(emptyIterable())));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.rest.core.domain.jpa.Person

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.