DATAREST-93 - Further fixes in repository mappings.

Simplified new RepositoryMappings infrastructure. Integrated EvoInflectionRelProvider to build collection resource rels. Bumped version number to 2.0 as we're going to break backwards compatibility with the next release to straighten out the rel construction and mapping.
This commit is contained in:
Oliver Gierke
2013-06-18 19:17:56 +02:00
parent 5c61632ec2
commit c5a592bd9d
26 changed files with 598 additions and 576 deletions

View File

@@ -43,7 +43,7 @@ public class RepositoryLinkBuilder extends LinkBuilderSupport<RepositoryLinkBuil
UriComponentsBuilder builder = baseUri != null ? UriComponentsBuilder.fromUri(baseUri) : ControllerLinkBuilder
.linkTo(RepositoryController.class).toUriComponentsBuilder();
return builder.path(metadata.getPath());
return builder.path(metadata.getPath().toString());
}
@Override

View File

@@ -127,7 +127,8 @@ public abstract class AbstractWebIntegrationTests {
@Override
public void match(MvcResult result) throws Exception {
String s = result.getResponse().getContentAsString();
assertThat(links.findLinkWithRel(rel, s), notNullValue());
assertThat("Expected to find link with rel " + rel + " but found none in " + s, links.findLinkWithRel(rel, s),
notNullValue());
}
};
}

View File

@@ -68,10 +68,10 @@ public class PersistentEntitySerializationTests {
String s = writer.toString();
Link fatherLink = linkDiscoverer.findLinkWithRel("people.people.father", s);
Link fatherLink = linkDiscoverer.findLinkWithRel("person.father", s);
assertThat(fatherLink.getHref(), endsWith(new UriTemplate("/{id}/father").expand(person.getId()).toString()));
Link siblingLink = linkDiscoverer.findLinkWithRel("people.people.siblings", s);
Link siblingLink = linkDiscoverer.findLinkWithRel("person.siblings", s);
assertThat(siblingLink.getHref(), endsWith(new UriTemplate("/{id}/siblings").expand(person.getId()).toString()));
}
}

View File

@@ -61,13 +61,13 @@ public class MongoWebTests extends AbstractWebIntegrationTests {
*/
@Override
protected Iterable<String> expectedRootLinkRels() {
return Arrays.asList("profile");
return Arrays.asList("profiles");
}
@Test
public void foo() throws Exception {
Link profileLink = discoverUnique("profile");
Link profileLink = discoverUnique("profiles");
follow(profileLink).andExpect(jsonPath("$.content").value(hasSize(2)));
}
}