Example usage for org.springframework.data.rest.tests.mongodb Profile setPerson

List of usage examples for org.springframework.data.rest.tests.mongodb Profile setPerson

Introduction

In this page you can find the example usage for org.springframework.data.rest.tests.mongodb Profile setPerson.

Prototype

public Profile setPerson(Long person) 

Source Link

Usage

From source file:org.springframework.data.rest.tests.mongodb.MongoWebTests.java

@Before
public void populateProfiles() {

    mapper.setSerializationInclusion(Include.NON_NULL);

    Profile twitter = new Profile();
    twitter.setPerson(1L);
    twitter.setType("Twitter");

    Profile linkedIn = new Profile();
    linkedIn.setPerson(1L);/*from  w  w  w .ja  v a2  s  .c o m*/
    linkedIn.setType("LinkedIn");

    repository.save(Arrays.asList(twitter, linkedIn));

    Address address = new Address();
    address.street = "ETagDoesntMatchExceptionUnitTests";
    address.zipCode = "Bar";

    User thomas = new User();
    thomas.firstname = "Thomas";
    thomas.lastname = "Darimont";
    thomas.address = address;

    userRepository.save(thomas);

    User oliver = new User();
    oliver.firstname = "Oliver";
    oliver.lastname = "Gierke";
    oliver.address = address;
    oliver.colleagues = Arrays.asList(thomas);
    userRepository.save(oliver);

    thomas.colleagues = Arrays.asList(oliver);
    userRepository.save(thomas);
}