mirror of
https://gitee.com/dcren/initializr.git
synced 2025-08-23 22:11:39 +08:00
Make sure deprecated dependencies endpoint works with metadata v2.2
Closes gh-1115
This commit is contained in:
parent
6075c08a0c
commit
5d8c8539ac
@ -94,6 +94,11 @@ public class ProjectMetadataController extends AbstractMetadataController {
|
||||
return serviceCapabilitiesFor(InitializrMetadataVersion.V2);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/dependencies", produces = "application/vnd.initializr.v2.2+json")
|
||||
public ResponseEntity<String> dependenciesV22(@RequestParam(required = false) String bootVersion) {
|
||||
return dependenciesFor(InitializrMetadataVersion.V2_2, bootVersion);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/dependencies", produces = { "application/vnd.initializr.v2.1+json", "application/json" })
|
||||
public ResponseEntity<String> dependenciesV21(@RequestParam(required = false) String bootVersion) {
|
||||
return dependenciesFor(InitializrMetadataVersion.V2_1, bootVersion);
|
||||
|
@ -88,10 +88,24 @@ class ProjectMetadataControllerCustomDefaultsIntegrationTests extends AbstractFu
|
||||
}
|
||||
|
||||
@Test
|
||||
void noBootVersion() throws JSONException {
|
||||
ResponseEntity<String> response = execute("/dependencies", String.class, null, "application/json");
|
||||
void dependenciesNoAcceptHeaderWithNoBootVersion() throws JSONException {
|
||||
validateDependenciesMetadata("*/*", DEFAULT_METADATA_MEDIA_TYPE);
|
||||
}
|
||||
|
||||
@Test
|
||||
void dependenciesV21WithNoBootVersion() throws JSONException {
|
||||
validateDependenciesMetadata("application/vnd.initializr.v2.1+json", DEFAULT_METADATA_MEDIA_TYPE);
|
||||
}
|
||||
|
||||
@Test
|
||||
void dependenciesV22WithNoBootVersion() throws JSONException {
|
||||
validateDependenciesMetadata("application/vnd.initializr.v2.2+json", CURRENT_METADATA_MEDIA_TYPE);
|
||||
}
|
||||
|
||||
private void validateDependenciesMetadata(String acceptHeader, MediaType expectedMediaType) throws JSONException {
|
||||
ResponseEntity<String> response = execute("/dependencies", String.class, null, acceptHeader);
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
validateContentType(response, DEFAULT_METADATA_MEDIA_TYPE);
|
||||
validateContentType(response, expectedMediaType);
|
||||
validateDependenciesOutput("2.1.4", response.getBody());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user