mirror of
https://gitee.com/dcren/initializr.git
synced 2025-12-17 09:35:53 +08:00
Adapt test suite to more recent Spring Boot versions
See gh-763
This commit is contained in:
@@ -42,17 +42,17 @@ public class MainControllerDependenciesTests
|
||||
"application/json");
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
validateContentType(response, CURRENT_METADATA_MEDIA_TYPE);
|
||||
validateDependenciesOutput("1.1.4", response.getBody());
|
||||
validateDependenciesOutput("2.1.4", response.getBody());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filteredDependencies() throws JSONException {
|
||||
ResponseEntity<String> response = execute(
|
||||
"/dependencies?bootVersion=1.2.1.RELEASE", String.class, null,
|
||||
"/dependencies?bootVersion=2.2.1.RELEASE", String.class, null,
|
||||
"application/json");
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
validateContentType(response, CURRENT_METADATA_MEDIA_TYPE);
|
||||
validateDependenciesOutput("1.2.1", response.getBody());
|
||||
validateDependenciesOutput("2.2.1", response.getBody());
|
||||
}
|
||||
|
||||
protected void validateDependenciesOutput(String version, String actual)
|
||||
|
||||
@@ -42,7 +42,7 @@ public class MainControllerEnvIntegrationTests
|
||||
ResponseEntity<?> entity = getRestTemplate().getForEntity(createUrl("/spring"),
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
String expected = "https://repo.spring.io/lib-release/org/springframework/boot/spring-boot-cli/1.1.4.RELEASE/spring-boot-cli-1.1.4.RELEASE-bin.zip";
|
||||
String expected = "https://repo.spring.io/lib-release/org/springframework/boot/spring-boot-cli/2.1.4.RELEASE/spring-boot-cli-2.1.4.RELEASE-bin.zip";
|
||||
assertThat(entity.getHeaders().getLocation()).isEqualTo(new URI(expected));
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class MainControllerIntegrationTests
|
||||
@Test
|
||||
public void dependencyInRange() {
|
||||
Dependency biz = Dependency.create("org.acme", "biz", "1.3.5", "runtime");
|
||||
downloadTgz("/starter.tgz?style=org.acme:biz&bootVersion=1.2.1.RELEASE")
|
||||
downloadTgz("/starter.tgz?style=org.acme:biz&bootVersion=2.2.1.RELEASE")
|
||||
.isJavaProject().isMavenProject().hasStaticAndTemplatesResources(false)
|
||||
.pomAssert().hasDependenciesCount(2).hasDependency(biz);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class MainControllerIntegrationTests
|
||||
|
||||
@Test
|
||||
public void kotlinRange() {
|
||||
downloadZip("/starter.zip?style=web&language=kotlin&bootVersion=1.2.1.RELEASE")
|
||||
downloadZip("/starter.zip?style=web&language=kotlin&bootVersion=2.0.1.RELEASE")
|
||||
.isKotlinProject().isMavenProject().pomAssert().hasDependenciesCount(4)
|
||||
.hasProperty("kotlin.version", "1.1");
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class MainControllerIntegrationTests
|
||||
ResponseEntity<?> entity = getRestTemplate().getForEntity(createUrl(context),
|
||||
ResponseEntity.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
String expected = "https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.1.4.RELEASE/spring-boot-cli-1.1.4.RELEASE-bin."
|
||||
String expected = "https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.1.4.RELEASE/spring-boot-cli-2.1.4.RELEASE-bin."
|
||||
+ extension;
|
||||
assertThat(entity.getHeaders().getLocation()).isEqualTo(new URI(expected));
|
||||
}
|
||||
@@ -399,7 +399,7 @@ public class MainControllerIntegrationTests
|
||||
public void homeHasBootVersion() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("name=\"bootVersion\"");
|
||||
assertThat(body).contains("1.2.0.BUILD-SNAPSHOT\"");
|
||||
assertThat(body).contains("2.2.0.BUILD-SNAPSHOT\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -36,9 +36,9 @@ public class ProjectGenerationPostProcessorTests
|
||||
|
||||
@Test
|
||||
public void postProcessorsInvoked() {
|
||||
downloadZip("/starter.zip?bootVersion=1.2.4.RELEASE&javaVersion=1.6")
|
||||
downloadZip("/starter.zip?bootVersion=2.0.4.RELEASE&javaVersion=1.8")
|
||||
.isJavaProject().isMavenProject().pomAssert()
|
||||
.hasSpringBootParent("1.2.3.RELEASE").hasProperty("java.version", "1.7");
|
||||
.hasSpringBootParent("2.2.3.RELEASE").hasProperty("java.version", "1.7");
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -64,7 +64,7 @@ public class ProjectGenerationPostProcessorTests
|
||||
public void postProcessBeforeResolution(ProjectRequest request,
|
||||
InitializrMetadata metadata) {
|
||||
request.setJavaVersion("1.2");
|
||||
request.setBootVersion("1.2.3.RELEASE");
|
||||
request.setBootVersion("2.2.3.RELEASE");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -104,10 +104,10 @@ public class ProjectGenerationSmokeTests
|
||||
@Test
|
||||
public void createSimpleProjectWithDifferentBootVersion() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.bootVersion("1.0.2.RELEASE");
|
||||
page.bootVersion("1.5.17.RELEASE");
|
||||
page.submit();
|
||||
assertSimpleProject().isMavenProject().pomAssert()
|
||||
.hasSpringBootParent("1.0.2.RELEASE").hasDependenciesCount(2)
|
||||
.hasSpringBootParent("1.5.17.RELEASE").hasDependenciesCount(2)
|
||||
.hasSpringBootStarterRootDependency().hasSpringBootStarterTest();
|
||||
|
||||
}
|
||||
@@ -140,10 +140,10 @@ public class ProjectGenerationSmokeTests
|
||||
HomePage page = toHome();
|
||||
selectDependency(page, "Data JPA");
|
||||
selectDependency(page, "org.acme:bur");
|
||||
page.bootVersion("1.0.2.RELEASE"); // Bur isn't available anymore
|
||||
page.bootVersion("1.5.17.RELEASE"); // Bur isn't available anymore
|
||||
page.submit();
|
||||
assertSimpleProject().isMavenProject().pomAssert()
|
||||
.hasSpringBootParent("1.0.2.RELEASE").hasDependenciesCount(2)
|
||||
.hasSpringBootParent("1.5.17.RELEASE").hasDependenciesCount(2)
|
||||
.hasSpringBootStarterDependency("data-jpa").hasSpringBootStarterTest();
|
||||
}
|
||||
|
||||
@@ -282,13 +282,13 @@ public class ProjectGenerationSmokeTests
|
||||
|
||||
@Test
|
||||
public void dependencyHiddenAccordingToRange() throws Exception {
|
||||
HomePage page = toHome(); // bur: [1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)
|
||||
HomePage page = toHome(); // bur: [2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)
|
||||
page.advanced();
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isTrue();
|
||||
page.bootVersion("1.0.2.RELEASE");
|
||||
page.bootVersion("1.5.17.RELEASE");
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isFalse();
|
||||
assertThat(page.dependency("org.acme:biz").isEnabled()).isFalse();
|
||||
page.bootVersion("1.1.4.RELEASE");
|
||||
page.bootVersion("2.1.4.RELEASE");
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isTrue();
|
||||
assertThat(page.dependency("org.acme:biz").isEnabled()).isFalse();
|
||||
page.bootVersion("Latest SNAPSHOT");
|
||||
@@ -298,13 +298,13 @@ public class ProjectGenerationSmokeTests
|
||||
|
||||
@Test
|
||||
public void dependencyUncheckedWhenHidden() throws Exception {
|
||||
HomePage page = toHome(); // bur: [1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)
|
||||
HomePage page = toHome(); // bur: [2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)
|
||||
page.advanced();
|
||||
page.dependency("org.acme:bur").click();
|
||||
assertThat(page.dependency("org.acme:bur").isSelected()).isTrue();
|
||||
page.bootVersion("1.0.2.RELEASE");
|
||||
page.bootVersion("1.5.17.RELEASE");
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isFalse();
|
||||
page.bootVersion("1.1.4.RELEASE");
|
||||
page.bootVersion("2.1.4.RELEASE");
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isTrue();
|
||||
assertThat(page.dependency("org.acme:bur").isSelected()).isFalse();
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
@Test
|
||||
public void filterDependencies() {
|
||||
Dependency first = Dependency.withId("first", "org.foo", "first");
|
||||
first.setVersionRange("1.1.4.RELEASE");
|
||||
first.setVersionRange("2.1.4.RELEASE");
|
||||
Dependency second = Dependency.withId("second", "org.foo", "second");
|
||||
Dependency third = Dependency.withId("third", "org.foo", "third");
|
||||
third.setVersionRange("1.1.8.RELEASE");
|
||||
third.setVersionRange("2.1.8.RELEASE");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", first, second, third).build();
|
||||
DependencyMetadata dependencyMetadata = this.provider.get(metadata,
|
||||
Version.parse("1.1.5.RELEASE"));
|
||||
Version.parse("2.1.5.RELEASE"));
|
||||
assertThat(dependencyMetadata.getDependencies()).hasSize(2);
|
||||
assertThat(dependencyMetadata.getRepositories()).isEmpty();
|
||||
assertThat(dependencyMetadata.getBoms()).isEmpty();
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
"content": [
|
||||
{
|
||||
"default": false,
|
||||
"id": "1.2.0.BUILD-SNAPSHOT",
|
||||
"id": "2.2.0.BUILD-SNAPSHOT",
|
||||
"name": "Latest SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"default": true,
|
||||
"id": "1.1.4.RELEASE",
|
||||
"name": "1.1.4"
|
||||
"id": "2.1.4.RELEASE",
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"default": false,
|
||||
"id": "1.0.2.RELEASE",
|
||||
"name": "1.0.2"
|
||||
"id": "1.5.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
],
|
||||
"description": "spring boot version",
|
||||
@@ -40,11 +40,11 @@
|
||||
"defaultVersion": "1.2",
|
||||
"mappings": [
|
||||
{
|
||||
"versionRange": "[1.0.0.RELEASE,1.2.0.RELEASE)",
|
||||
"versionRange": "[1.5.0.RELEASE,2.0.0.M1)",
|
||||
"version": "1.0"
|
||||
},
|
||||
{
|
||||
"versionRange": "[1.2.0.RELEASE,1.5.0.RELEASE)",
|
||||
"versionRange": "[2.0.0.M1,2.1.0.M1)",
|
||||
"version": "1.1"
|
||||
}
|
||||
]
|
||||
@@ -102,14 +102,14 @@
|
||||
],
|
||||
"mappings": [
|
||||
{
|
||||
"versionRange": "[1.0.0.RELEASE,1.1.6.RELEASE)",
|
||||
"versionRange": "[2.0.0.RELEASE,2.1.6.RELEASE)",
|
||||
"repositories": [
|
||||
"my-api-repo-1"
|
||||
],
|
||||
"version": "1.0.0.RELEASE"
|
||||
},
|
||||
{
|
||||
"versionRange": "1.2.1.RELEASE",
|
||||
"versionRange": "2.2.1.RELEASE",
|
||||
"repositories": [
|
||||
"my-api-repo-2"
|
||||
],
|
||||
@@ -219,7 +219,7 @@
|
||||
"name": "Biz",
|
||||
"scope": "runtime",
|
||||
"version": "1.3.5",
|
||||
"versionRange": "1.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"starter": true,
|
||||
@@ -229,7 +229,7 @@
|
||||
"name": "Bur",
|
||||
"scope": "test",
|
||||
"version": "2.1.0",
|
||||
"versionRange": "[1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)"
|
||||
"versionRange": "[2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)"
|
||||
},
|
||||
{
|
||||
"starter": true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"bootVersion": "1.1.4.RELEASE",
|
||||
"bootVersion": "2.1.4.RELEASE",
|
||||
"repositories": {
|
||||
"my-api-repo-1": {
|
||||
"name": "repo1",
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"bootVersion": "1.2.1.RELEASE",
|
||||
"bootVersion": "2.2.1.RELEASE",
|
||||
"repositories": {
|
||||
"my-api-repo-2": {
|
||||
"name": "repo2",
|
||||
@@ -151,19 +151,19 @@
|
||||
},
|
||||
"bootVersion": {
|
||||
"type": "single-select",
|
||||
"default": "1.1.4.RELEASE",
|
||||
"default": "2.1.4.RELEASE",
|
||||
"values": [
|
||||
{
|
||||
"id": "1.2.0.BUILD-SNAPSHOT",
|
||||
"id": "2.2.0.BUILD-SNAPSHOT",
|
||||
"name": "Latest SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "1.1.4.RELEASE",
|
||||
"name": "1.1.4"
|
||||
"id": "2.1.4.RELEASE",
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.0.2.RELEASE",
|
||||
"name": "1.0.2"
|
||||
"id": "1.5.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -151,19 +151,19 @@
|
||||
},
|
||||
"bootVersion": {
|
||||
"type": "single-select",
|
||||
"default": "1.1.4.RELEASE",
|
||||
"default": "2.1.4.RELEASE",
|
||||
"values": [
|
||||
{
|
||||
"id": "1.2.0.BUILD-SNAPSHOT",
|
||||
"id": "2.2.0.BUILD-SNAPSHOT",
|
||||
"name": "Latest SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "1.1.4.RELEASE",
|
||||
"name": "1.1.4"
|
||||
"id": "2.1.4.RELEASE",
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.0.2.RELEASE",
|
||||
"name": "1.0.2"
|
||||
"id": "1.5.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -80,12 +80,12 @@
|
||||
{
|
||||
"id": "org.acme:biz",
|
||||
"name": "Biz",
|
||||
"versionRange": "1.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "org.acme:bur",
|
||||
"name": "Bur",
|
||||
"versionRange": "[1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)"
|
||||
"versionRange": "[2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)"
|
||||
},
|
||||
{
|
||||
"id": "my-api",
|
||||
@@ -189,19 +189,19 @@
|
||||
},
|
||||
"bootVersion": {
|
||||
"type": "single-select",
|
||||
"default": "1.1.4.RELEASE",
|
||||
"default": "2.1.4.RELEASE",
|
||||
"values": [
|
||||
{
|
||||
"id": "1.2.0.BUILD-SNAPSHOT",
|
||||
"id": "2.2.0.BUILD-SNAPSHOT",
|
||||
"name": "Latest SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "1.1.4.RELEASE",
|
||||
"name": "1.1.4"
|
||||
"id": "2.1.4.RELEASE",
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.0.2.RELEASE",
|
||||
"name": "1.0.2"
|
||||
"id": "1.5.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -80,12 +80,12 @@
|
||||
{
|
||||
"id": "org.acme:biz",
|
||||
"name": "Biz",
|
||||
"versionRange": "1.2.0.BUILD-SNAPSHOT"
|
||||
"versionRange": "2.2.0.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "org.acme:bur",
|
||||
"name": "Bur",
|
||||
"versionRange": "[1.1.4.RELEASE,1.2.0.BUILD-SNAPSHOT)"
|
||||
"versionRange": "[2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)"
|
||||
},
|
||||
{
|
||||
"id": "my-api",
|
||||
@@ -189,19 +189,19 @@
|
||||
},
|
||||
"bootVersion": {
|
||||
"type": "single-select",
|
||||
"default": "1.1.4.RELEASE",
|
||||
"default": "2.1.4.RELEASE",
|
||||
"values": [
|
||||
{
|
||||
"id": "1.2.0.BUILD-SNAPSHOT",
|
||||
"id": "2.2.0.BUILD-SNAPSHOT",
|
||||
"name": "Latest SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"id": "1.1.4.RELEASE",
|
||||
"name": "1.1.4"
|
||||
"id": "2.1.4.RELEASE",
|
||||
"name": "2.1.4"
|
||||
},
|
||||
{
|
||||
"id": "1.0.2.RELEASE",
|
||||
"name": "1.0.2"
|
||||
"id": "1.5.17.RELEASE",
|
||||
"name": "1.5.17"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user