mirror of
https://gitee.com/dcren/initializr.git
synced 2026-09-28 07:17:40 +08:00
Make sure deprecated dependencies endpoint works with metadata v2.2
Closes gh-1115
This commit is contained in:
+5
@@ -94,6 +94,11 @@ public class ProjectMetadataController extends AbstractMetadataController {
|
|||||||
return serviceCapabilitiesFor(InitializrMetadataVersion.V2);
|
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" })
|
@RequestMapping(path = "/dependencies", produces = { "application/vnd.initializr.v2.1+json", "application/json" })
|
||||||
public ResponseEntity<String> dependenciesV21(@RequestParam(required = false) String bootVersion) {
|
public ResponseEntity<String> dependenciesV21(@RequestParam(required = false) String bootVersion) {
|
||||||
return dependenciesFor(InitializrMetadataVersion.V2_1, bootVersion);
|
return dependenciesFor(InitializrMetadataVersion.V2_1, bootVersion);
|
||||||
|
|||||||
+17
-3
@@ -88,10 +88,24 @@ class ProjectMetadataControllerCustomDefaultsIntegrationTests extends AbstractFu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void noBootVersion() throws JSONException {
|
void dependenciesNoAcceptHeaderWithNoBootVersion() throws JSONException {
|
||||||
ResponseEntity<String> response = execute("/dependencies", String.class, null, "application/json");
|
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();
|
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||||
validateContentType(response, DEFAULT_METADATA_MEDIA_TYPE);
|
validateContentType(response, expectedMediaType);
|
||||||
validateDependenciesOutput("2.1.4", response.getBody());
|
validateDependenciesOutput("2.1.4", response.getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user