DATAREST-1076 - Expose constructor that takes RelProvider of RepositoryResourceMappings.

We now expose the constructor that takes a RelProvider in RepositoryResourceMappings so that clients can tweak the default relation names. Changed the order of constructor parameters of (previously) non-public constructors for consistency.

The RelProvider to be used with the mappings can now be configured via RepositoryRestConfiguration and defaults to the EvoInflector based one.
This commit is contained in:
Oliver Gierke
2017-05-17 07:29:46 +02:00
parent 2c927af0b5
commit e4f34aaa67
6 changed files with 29 additions and 13 deletions

View File

@@ -131,4 +131,9 @@ public class RepositoryRestConfigurationUnitTests {
CorsConfiguration corsConfiguration = corsConfigurations.get("/hello");
assertThat(corsConfiguration.getMaxAge()).isEqualTo(1234L);
}
@Test // DATAREST-1076
public void rejectsNullRelProvider() {
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> configuration.setRelProvider(null));
}
}

View File

@@ -64,7 +64,7 @@ public class RepositoryResourceMappingsIntegrationTests {
Repositories repositories = new Repositories(factory);
this.mappings = new RepositoryResourceMappings(repositories, new PersistentEntities(Arrays.asList(mappingContext)),
new EvoInflectorRelProvider(), RepositoryDetectionStrategies.DEFAULT);
RepositoryDetectionStrategies.DEFAULT, new EvoInflectorRelProvider());
}
@Test