List of usage examples for org.springframework.data.rest.tests.mongodb Profile Profile
Profile
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);/*from www . j av a2s . co m*/ twitter.setType("Twitter"); Profile linkedIn = new Profile(); linkedIn.setPerson(1L); 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); }
From source file:org.springframework.data.rest.tests.mongodb.MongoWebTests.java
/** * @see DATAREST-491/* w ww . j a v a2s. co m*/ */ @Test public void updatesMapPropertyCorrectly() throws Exception { Link profilesLink = client.discoverUnique("profiles"); Link profileLink = assertHasContentLinkWithRel("self", client.request(profilesLink)); Profile profile = new Profile(); profile.setMetadata(Collections.singletonMap("Key", "Value")); putAndGet(profileLink, mapper.writeValueAsString(profile), MediaType.APPLICATION_JSON); client.follow(profileLink).andExpect(jsonPath("$.metadata.Key").value("Value")); }