mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Reduce visibility of the Gradle plugin's test methods
See gh-19287
This commit is contained in:
parent
a2451a4f29
commit
47b47c28a0
@ -29,7 +29,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class GettingStartedDocumentationTests {
|
class GettingStartedDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class GettingStartedDocumentationTests {
|
|||||||
// jar won't be there
|
// jar won't be there
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void typicalPluginsAppliesExceptedPlugins() {
|
void typicalPluginsAppliesExceptedPlugins() {
|
||||||
this.gradleBuild.script("src/main/gradle/getting-started/typical-plugins").build("verify");
|
this.gradleBuild.script("src/main/gradle/getting-started/typical-plugins").build("verify");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,19 +36,19 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class IntegratingWithActuatorDocumentationTests {
|
class IntegratingWithActuatorDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void basicBuildInfo() throws IOException {
|
void basicBuildInfo() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-basic").build("bootBuildInfo");
|
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-basic").build("bootBuildInfo");
|
||||||
assertThat(new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties"))
|
assertThat(new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties"))
|
||||||
.isFile();
|
.isFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void buildInfoCustomValues() throws IOException {
|
void buildInfoCustomValues() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-custom-values")
|
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-custom-values")
|
||||||
.build("bootBuildInfo");
|
.build("bootBuildInfo");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
|
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
|
||||||
@ -61,7 +61,7 @@ public class IntegratingWithActuatorDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void buildInfoAdditional() throws IOException {
|
void buildInfoAdditional() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-additional")
|
this.gradleBuild.script("src/main/gradle/integrating-with-actuator/build-info-additional")
|
||||||
.build("bootBuildInfo");
|
.build("bootBuildInfo");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
|
File file = new File(this.gradleBuild.getProjectDir(), "build/resources/main/META-INF/build-info.properties");
|
||||||
|
@ -33,29 +33,29 @@ import static org.junit.jupiter.api.Assumptions.assumingThat;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class ManagingDependenciesDocumentationTests {
|
class ManagingDependenciesDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void dependenciesExampleEvaluatesSuccessfully() {
|
void dependenciesExampleEvaluatesSuccessfully() {
|
||||||
this.gradleBuild.script("src/main/gradle/managing-dependencies/dependencies").build();
|
this.gradleBuild.script("src/main/gradle/managing-dependencies/dependencies").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void customManagedVersions() {
|
void customManagedVersions() {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/custom-version").build("slf4jVersion")
|
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/custom-version").build("slf4jVersion")
|
||||||
.getOutput()).contains("1.7.20");
|
.getOutput()).contains("1.7.20");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void dependencyManagementInIsolation() {
|
void dependencyManagementInIsolation() {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom")
|
assertThat(this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom")
|
||||||
.build("dependencyManagement").getOutput()).contains("org.springframework.boot:spring-boot-starter ");
|
.build("dependencyManagement").getOutput()).contains("org.springframework.boot:spring-boot-starter ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void dependencyManagementInIsolationWithPluginsBlock() {
|
void dependencyManagementInIsolationWithPluginsBlock() {
|
||||||
assumingThat(this.gradleBuild.getDsl() == Dsl.KOTLIN,
|
assumingThat(this.gradleBuild.getDsl() == Dsl.KOTLIN,
|
||||||
() -> assertThat(
|
() -> assertThat(
|
||||||
this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins")
|
this.gradleBuild.script("src/main/gradle/managing-dependencies/configure-bom-with-plugins")
|
||||||
|
@ -43,17 +43,17 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class PackagingDocumentationTests {
|
class PackagingDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void warContainerDependencyEvaluatesSuccessfully() {
|
void warContainerDependencyEvaluatesSuccessfully() {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/war-container-dependency").build();
|
this.gradleBuild.script("src/main/gradle/packaging/war-container-dependency").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarMainClass() throws IOException {
|
void bootJarMainClass() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-main-class").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-main-class").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -65,7 +65,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarManifestMainClass() throws IOException {
|
void bootJarManifestMainClass() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-manifest-main-class").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-manifest-main-class").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -77,7 +77,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginMainClass() throws IOException {
|
void applicationPluginMainClass() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/application-plugin-main-class").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/application-plugin-main-class").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -89,7 +89,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void springBootDslMainClass() throws IOException {
|
void springBootDslMainClass() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/spring-boot-dsl-main-class").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/spring-boot-dsl-main-class").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -101,7 +101,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootWarIncludeDevtools() throws IOException {
|
void bootWarIncludeDevtools() throws IOException {
|
||||||
jarFile(new File(this.gradleBuild.getProjectDir(), "spring-boot-devtools-1.2.3.RELEASE.jar"));
|
jarFile(new File(this.gradleBuild.getProjectDir(), "spring-boot-devtools-1.2.3.RELEASE.jar"));
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-war-include-devtools").build("bootWar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-war-include-devtools").build("bootWar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
@ -113,7 +113,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarRequiresUnpack() throws IOException {
|
void bootJarRequiresUnpack() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-requires-unpack").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-requires-unpack").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -126,7 +126,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarIncludeLaunchScript() throws IOException {
|
void bootJarIncludeLaunchScript() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-include-launch-script").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-include-launch-script").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -135,7 +135,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarLaunchScriptProperties() throws IOException {
|
void bootJarLaunchScriptProperties() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-launch-script-properties").build("bootJar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-launch-script-properties").build("bootJar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
@ -144,7 +144,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarCustomLaunchScript() throws IOException {
|
void bootJarCustomLaunchScript() throws IOException {
|
||||||
File customScriptFile = new File(this.gradleBuild.getProjectDir(), "src/custom.script");
|
File customScriptFile = new File(this.gradleBuild.getProjectDir(), "src/custom.script");
|
||||||
customScriptFile.getParentFile().mkdirs();
|
customScriptFile.getParentFile().mkdirs();
|
||||||
FileCopyUtils.copy("custom", new FileWriter(customScriptFile));
|
FileCopyUtils.copy("custom", new FileWriter(customScriptFile));
|
||||||
@ -156,7 +156,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootWarPropertiesLauncher() throws IOException {
|
void bootWarPropertiesLauncher() throws IOException {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-war-properties-launcher").build("bootWar");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-war-properties-launcher").build("bootWar");
|
||||||
File file = new File(this.gradleBuild.getProjectDir(),
|
File file = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".war");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".war");
|
||||||
@ -168,7 +168,7 @@ public class PackagingDocumentationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarAndJar() {
|
void bootJarAndJar() {
|
||||||
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-and-jar").build("assemble");
|
this.gradleBuild.script("src/main/gradle/packaging/boot-jar-and-jar").build("assemble");
|
||||||
File jar = new File(this.gradleBuild.getProjectDir(),
|
File jar = new File(this.gradleBuild.getProjectDir(),
|
||||||
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
|
||||||
|
@ -33,18 +33,18 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class PublishingDocumentationTests {
|
class PublishingDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void mavenUpload() throws IOException {
|
void mavenUpload() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven").build("deployerRepository").getOutput())
|
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven").build("deployerRepository").getOutput())
|
||||||
.contains("https://repo.example.com");
|
.contains("https://repo.example.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void mavenPublish() throws IOException {
|
void mavenPublish() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven-publish").build("publishingConfiguration")
|
assertThat(this.gradleBuild.script("src/main/gradle/publishing/maven-publish").build("publishingConfiguration")
|
||||||
.getOutput()).contains("MavenPublication").contains("https://repo.example.com");
|
.getOutput()).contains("MavenPublication").contains("https://repo.example.com");
|
||||||
}
|
}
|
||||||
|
@ -34,36 +34,36 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Jean-Baptiste Nizet
|
* @author Jean-Baptiste Nizet
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleMultiDslExtension.class)
|
@ExtendWith(GradleMultiDslExtension.class)
|
||||||
public class RunningDocumentationTests {
|
class RunningDocumentationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootRunMain() throws IOException {
|
void bootRunMain() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-main").build("configuredMainClass")
|
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-main").build("configuredMainClass")
|
||||||
.getOutput()).contains("com.example.ExampleApplication");
|
.getOutput()).contains("com.example.ExampleApplication");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginMainClassName() {
|
void applicationPluginMainClassName() {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/running/application-plugin-main-class-name")
|
assertThat(this.gradleBuild.script("src/main/gradle/running/application-plugin-main-class-name")
|
||||||
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
|
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void springBootDslMainClassName() throws IOException {
|
void springBootDslMainClassName() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/running/spring-boot-dsl-main-class-name")
|
assertThat(this.gradleBuild.script("src/main/gradle/running/spring-boot-dsl-main-class-name")
|
||||||
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
|
.build("configuredMainClass").getOutput()).contains("com.example.ExampleApplication");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootRunSourceResources() throws IOException {
|
void bootRunSourceResources() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-source-resources")
|
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-source-resources")
|
||||||
.build("configuredClasspath").getOutput()).contains(new File("src/main/resources").getPath());
|
.build("configuredClasspath").getOutput()).contains(new File("src/main/resources").getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootRunDisableOptimizedLaunch() throws IOException {
|
void bootRunDisableOptimizedLaunch() throws IOException {
|
||||||
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-disable-optimized-launch")
|
assertThat(this.gradleBuild.script("src/main/gradle/running/boot-run-disable-optimized-launch")
|
||||||
.build("optimizedLaunch").getOutput()).contains("false");
|
.build("optimizedLaunch").getOutput()).contains("false");
|
||||||
}
|
}
|
||||||
|
@ -43,42 +43,42 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class ApplicationPluginActionIntegrationTests {
|
class ApplicationPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noBootDistributionWithoutApplicationPluginApplied() {
|
void noBootDistributionWithoutApplicationPluginApplied() {
|
||||||
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot").getOutput())
|
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot").getOutput())
|
||||||
.contains("boot exists = false");
|
.contains("boot exists = false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applyingApplicationPluginCreatesBootDistribution() {
|
void applyingApplicationPluginCreatesBootDistribution() {
|
||||||
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot", "-PapplyApplicationPlugin")
|
assertThat(this.gradleBuild.build("distributionExists", "-PdistributionName=boot", "-PapplyApplicationPlugin")
|
||||||
.getOutput()).contains("boot exists = true");
|
.getOutput()).contains("boot exists = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
|
void noBootStartScriptsTaskWithoutApplicationPluginApplied() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts").getOutput())
|
||||||
.contains("bootStartScripts exists = false");
|
.contains("bootStartScripts exists = false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applyingApplicationPluginCreatesBootStartScriptsTask() {
|
void applyingApplicationPluginCreatesBootStartScriptsTask() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts", "-PapplyApplicationPlugin")
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootStartScripts", "-PapplyApplicationPlugin")
|
||||||
.getOutput()).contains("bootStartScripts exists = true");
|
.getOutput()).contains("bootStartScripts exists = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
|
void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
|
||||||
assertThat(this.gradleBuild.build("startScriptsDefaultJvmOpts", "-PapplyApplicationPlugin").getOutput())
|
assertThat(this.gradleBuild.build("startScriptsDefaultJvmOpts", "-PapplyApplicationPlugin").getOutput())
|
||||||
.contains("bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]");
|
.contains("bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void zipDistributionForJarCanBeBuilt() throws IOException {
|
void zipDistributionForJarCanBeBuilt() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
String name = this.gradleBuild.getProjectDir().getName();
|
String name = this.gradleBuild.getProjectDir().getName();
|
||||||
@ -90,7 +90,7 @@ public class ApplicationPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void tarDistributionForJarCanBeBuilt() throws IOException {
|
void tarDistributionForJarCanBeBuilt() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
String name = this.gradleBuild.getProjectDir().getName();
|
String name = this.gradleBuild.getProjectDir().getName();
|
||||||
@ -102,7 +102,7 @@ public class ApplicationPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void zipDistributionForWarCanBeBuilt() throws IOException {
|
void zipDistributionForWarCanBeBuilt() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistZip").task(":bootDistZip").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
String name = this.gradleBuild.getProjectDir().getName();
|
String name = this.gradleBuild.getProjectDir().getName();
|
||||||
@ -114,7 +114,7 @@ public class ApplicationPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void tarDistributionForWarCanBeBuilt() throws IOException {
|
void tarDistributionForWarCanBeBuilt() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
String name = this.gradleBuild.getProjectDir().getName();
|
String name = this.gradleBuild.getProjectDir().getName();
|
||||||
@ -126,7 +126,7 @@ public class ApplicationPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
|
void applicationNameCanBeUsedToCustomizeDistributionName() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
File distribution = new File(this.gradleBuild.getProjectDir(), "build/distributions/custom-boot.tar");
|
File distribution = new File(this.gradleBuild.getProjectDir(), "build/distributions/custom-boot.tar");
|
||||||
@ -138,7 +138,7 @@ public class ApplicationPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void scriptsHaveCorrectPermissions() throws IOException {
|
void scriptsHaveCorrectPermissions() throws IOException {
|
||||||
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
assertThat(this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
String name = this.gradleBuild.getProjectDir().getName();
|
String name = this.gradleBuild.getProjectDir().getName();
|
||||||
|
@ -37,24 +37,24 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class DependencyManagementPluginActionIntegrationTests {
|
class DependencyManagementPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noDependencyManagementIsAppliedByDefault() {
|
void noDependencyManagementIsAppliedByDefault() {
|
||||||
assertThat(this.gradleBuild.build("doesNotHaveDependencyManagement").task(":doesNotHaveDependencyManagement")
|
assertThat(this.gradleBuild.build("doesNotHaveDependencyManagement").task(":doesNotHaveDependencyManagement")
|
||||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bomIsImportedWhenDependencyManagementPluginIsApplied() {
|
void bomIsImportedWhenDependencyManagementPluginIsApplied() {
|
||||||
assertThat(this.gradleBuild.build("hasDependencyManagement", "-PapplyDependencyManagementPlugin")
|
assertThat(this.gradleBuild.build("hasDependencyManagement", "-PapplyDependencyManagementPlugin")
|
||||||
.task(":hasDependencyManagement").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
.task(":hasDependencyManagement").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
|
void helpfulErrorWhenVersionlessDependencyFailsToResolve() throws IOException {
|
||||||
File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example");
|
File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/com/example");
|
||||||
examplePackage.mkdirs();
|
examplePackage.mkdirs();
|
||||||
FileSystemUtils.copyRecursively(new File("src/test/java/com/example"), examplePackage);
|
FileSystemUtils.copyRecursively(new File("src/test/java/com/example"), examplePackage);
|
||||||
|
@ -37,77 +37,77 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class JavaPluginActionIntegrationTests {
|
class JavaPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noBootJarTaskWithoutJavaPluginApplied() {
|
void noBootJarTaskWithoutJavaPluginApplied() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar").getOutput())
|
||||||
.contains("bootJar exists = false");
|
.contains("bootJar exists = false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applyingJavaPluginCreatesBootJarTask() {
|
void applyingJavaPluginCreatesBootJarTask() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar", "-PapplyJavaPlugin").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootJar", "-PapplyJavaPlugin").getOutput())
|
||||||
.contains("bootJar exists = true");
|
.contains("bootJar exists = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noBootRunTaskWithoutJavaPluginApplied() {
|
void noBootRunTaskWithoutJavaPluginApplied() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun").getOutput())
|
||||||
.contains("bootRun exists = false");
|
.contains("bootRun exists = false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applyingJavaPluginCreatesBootRunTask() {
|
void applyingJavaPluginCreatesBootRunTask() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun", "-PapplyJavaPlugin").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootRun", "-PapplyJavaPlugin").getOutput())
|
||||||
.contains("bootRun exists = true");
|
.contains("bootRun exists = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void javaCompileTasksUseUtf8Encoding() {
|
void javaCompileTasksUseUtf8Encoding() {
|
||||||
assertThat(this.gradleBuild.build("javaCompileEncoding", "-PapplyJavaPlugin").getOutput())
|
assertThat(this.gradleBuild.build("javaCompileEncoding", "-PapplyJavaPlugin").getOutput())
|
||||||
.contains("compileJava = UTF-8").contains("compileTestJava = UTF-8");
|
.contains("compileJava = UTF-8").contains("compileTestJava = UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void javaCompileTasksUseParametersCompilerFlagByDefault() {
|
void javaCompileTasksUseParametersCompilerFlagByDefault() {
|
||||||
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
||||||
.contains("compileJava compiler args: [-parameters]")
|
.contains("compileJava compiler args: [-parameters]")
|
||||||
.contains("compileTestJava compiler args: [-parameters]");
|
.contains("compileTestJava compiler args: [-parameters]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void javaCompileTasksUseParametersAndAdditionalCompilerFlags() {
|
void javaCompileTasksUseParametersAndAdditionalCompilerFlags() {
|
||||||
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
||||||
.contains("compileJava compiler args: [-parameters, -Xlint:all]")
|
.contains("compileJava compiler args: [-parameters, -Xlint:all]")
|
||||||
.contains("compileTestJava compiler args: [-parameters, -Xlint:all]");
|
.contains("compileTestJava compiler args: [-parameters, -Xlint:all]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void javaCompileTasksCanOverrideDefaultParametersCompilerFlag() {
|
void javaCompileTasksCanOverrideDefaultParametersCompilerFlag() {
|
||||||
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
assertThat(this.gradleBuild.build("javaCompileTasksCompilerArgs").getOutput())
|
||||||
.contains("compileJava compiler args: [-Xlint:all]")
|
.contains("compileJava compiler args: [-Xlint:all]")
|
||||||
.contains("compileTestJava compiler args: [-Xlint:all]");
|
.contains("compileTestJava compiler args: [-Xlint:all]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void assembleRunsBootJarAndJarIsSkipped() {
|
void assembleRunsBootJarAndJarIsSkipped() {
|
||||||
BuildResult result = this.gradleBuild.build("assemble");
|
BuildResult result = this.gradleBuild.build("assemble");
|
||||||
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
|
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
|
void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
|
||||||
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyJavaPlugin");
|
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyJavaPlugin");
|
||||||
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
|
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
|
||||||
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");
|
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void jarAndBootJarCanBothBeBuilt() {
|
void jarAndBootJarCanBothBeBuilt() {
|
||||||
BuildResult result = this.gradleBuild.build("assemble");
|
BuildResult result = this.gradleBuild.build("assemble");
|
||||||
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootJar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":jar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -118,7 +118,7 @@ public class JavaPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void additionalMetadataLocationsConfiguredWhenProcessorIsPresent() throws IOException {
|
void additionalMetadataLocationsConfiguredWhenProcessorIsPresent() throws IOException {
|
||||||
createMinimalMainSource();
|
createMinimalMainSource();
|
||||||
File libs = new File(this.gradleBuild.getProjectDir(), "libs");
|
File libs = new File(this.gradleBuild.getProjectDir(), "libs");
|
||||||
libs.mkdirs();
|
libs.mkdirs();
|
||||||
@ -132,7 +132,7 @@ public class JavaPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent() throws IOException {
|
void additionalMetadataLocationsNotConfiguredWhenProcessorIsAbsent() throws IOException {
|
||||||
createMinimalMainSource();
|
createMinimalMainSource();
|
||||||
BuildResult result = this.gradleBuild.build("compileJava");
|
BuildResult result = this.gradleBuild.build("compileJava");
|
||||||
assertThat(result.task(":compileJava").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":compileJava").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
|
@ -30,30 +30,30 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class KotlinPluginActionIntegrationTests {
|
class KotlinPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noKotlinVersionPropertyWithoutKotlinPlugin() {
|
void noKotlinVersionPropertyWithoutKotlinPlugin() {
|
||||||
assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none");
|
assertThat(this.gradleBuild.build("kotlinVersion").getOutput()).contains("Kotlin version: none");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void kotlinVersionPropertyIsSet() {
|
void kotlinVersionPropertyIsSet() {
|
||||||
String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath")
|
String output = this.gradleBuild.build("kotlinVersion", "dependencies", "--configuration", "compileClasspath")
|
||||||
.getOutput();
|
.getOutput();
|
||||||
assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+");
|
assertThat(output).containsPattern("Kotlin version: [0-9]\\.[0-9]\\.[0-9]+");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void kotlinCompileTasksUseJavaParametersFlagByDefault() {
|
void kotlinCompileTasksUseJavaParametersFlagByDefault() {
|
||||||
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
|
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
|
||||||
.contains("compileKotlin java parameters: true").contains("compileTestKotlin java parameters: true");
|
.contains("compileKotlin java parameters: true").contains("compileTestKotlin java parameters: true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() {
|
void kotlinCompileTasksCanOverrideDefaultJavaParametersFlag() {
|
||||||
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
|
assertThat(this.gradleBuild.build("kotlinCompileTasksJavaParameters").getOutput())
|
||||||
.contains("compileKotlin java parameters: false").contains("compileTestKotlin java parameters: false");
|
.contains("compileKotlin java parameters: false").contains("compileTestKotlin java parameters: false");
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class MavenPluginActionIntegrationTests {
|
class MavenPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void clearsConf2ScopeMappingsOfUploadBootArchivesTask() {
|
void clearsConf2ScopeMappingsOfUploadBootArchivesTask() {
|
||||||
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0").build("conf2ScopeMappings")
|
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0").build("conf2ScopeMappings")
|
||||||
.getOutput()).contains("Conf2ScopeMappings = 0");
|
.getOutput()).contains("Conf2ScopeMappings = 0");
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class OnlyDependencyManagementIntegrationTests {
|
class OnlyDependencyManagementIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void dependencyManagementCanBeConfiguredUsingCoordinatesConstant() {
|
void dependencyManagementCanBeConfiguredUsingCoordinatesConstant() {
|
||||||
assertThat(this.gradleBuild.build("dependencyManagement").getOutput())
|
assertThat(this.gradleBuild.build("dependencyManagement").getOutput())
|
||||||
.contains("org.springframework.boot:spring-boot-starter ");
|
.contains("org.springframework.boot:spring-boot-starter ");
|
||||||
}
|
}
|
||||||
|
@ -34,31 +34,31 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class WarPluginActionIntegrationTests {
|
class WarPluginActionIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void noBootWarTaskWithoutWarPluginApplied() {
|
void noBootWarTaskWithoutWarPluginApplied() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar").getOutput())
|
||||||
.contains("bootWar exists = false");
|
.contains("bootWar exists = false");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applyingWarPluginCreatesBootWarTask() {
|
void applyingWarPluginCreatesBootWarTask() {
|
||||||
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar", "-PapplyWarPlugin").getOutput())
|
assertThat(this.gradleBuild.build("taskExists", "-PtaskName=bootWar", "-PapplyWarPlugin").getOutput())
|
||||||
.contains("bootWar exists = true");
|
.contains("bootWar exists = true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void assembleRunsBootWarAndWarIsSkipped() {
|
void assembleRunsBootWarAndWarIsSkipped() {
|
||||||
BuildResult result = this.gradleBuild.build("assemble");
|
BuildResult result = this.gradleBuild.build("assemble");
|
||||||
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
|
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SKIPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void warAndBootWarCanBothBeBuilt() {
|
void warAndBootWarCanBothBeBuilt() {
|
||||||
BuildResult result = this.gradleBuild.build("assemble");
|
BuildResult result = this.gradleBuild.build("assemble");
|
||||||
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":war").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -69,7 +69,7 @@ public class WarPluginActionIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
|
void errorMessageIsHelpfulWhenMainClassCannotBeResolved() {
|
||||||
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyWarPlugin");
|
BuildResult result = this.gradleBuild.buildAndFail("build", "-PapplyWarPlugin");
|
||||||
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
|
assertThat(result.task(":bootWar").getOutcome()).isEqualTo(TaskOutcome.FAILED);
|
||||||
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");
|
assertThat(result.getOutput()).contains("Main class name has not been configured and it could not be resolved");
|
||||||
|
@ -40,12 +40,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class BuildInfoIntegrationTests {
|
class BuildInfoIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void defaultValues() {
|
void defaultValues() {
|
||||||
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
Properties buildInfoProperties = buildInfoProperties();
|
Properties buildInfoProperties = buildInfoProperties();
|
||||||
assertThat(buildInfoProperties).containsKey("build.time");
|
assertThat(buildInfoProperties).containsKey("build.time");
|
||||||
@ -56,7 +56,7 @@ public class BuildInfoIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void basicExecution() {
|
void basicExecution() {
|
||||||
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
Properties buildInfoProperties = buildInfoProperties();
|
Properties buildInfoProperties = buildInfoProperties();
|
||||||
assertThat(buildInfoProperties).containsKey("build.time");
|
assertThat(buildInfoProperties).containsKey("build.time");
|
||||||
@ -68,13 +68,13 @@ public class BuildInfoIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void notUpToDateWhenExecutedTwiceAsTimeChanges() {
|
void notUpToDateWhenExecutedTwiceAsTimeChanges() {
|
||||||
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(this.gradleBuild.build("buildInfo").task(":buildInfo").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void upToDateWhenExecutedTwiceWithFixedTime() {
|
void upToDateWhenExecutedTwiceWithFixedTime() {
|
||||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||||
@ -82,7 +82,7 @@ public class BuildInfoIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion() {
|
void notUpToDateWhenExecutedTwiceWithFixedTimeAndChangedProjectVersion() {
|
||||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
BuildResult result = this.gradleBuild.build("buildInfo", "-PnullTime", "-PprojectVersion=0.2.0");
|
BuildResult result = this.gradleBuild.build("buildInfo", "-PnullTime", "-PprojectVersion=0.2.0");
|
||||||
@ -90,7 +90,7 @@ public class BuildInfoIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void reproducibleOutputWithFixedTime()
|
void reproducibleOutputWithFixedTime()
|
||||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||||
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
assertThat(this.gradleBuild.build("buildInfo", "-PnullTime").task(":buildInfo").getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
|
@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public abstract class AbstractBootArchiveIntegrationTests {
|
abstract class AbstractBootArchiveIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@ -49,13 +49,13 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void basicBuild() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
void basicBuild() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void reproducibleArchive()
|
void reproducibleArchive()
|
||||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException, InterruptedException {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -69,8 +69,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void upToDateWhenBuiltTwice()
|
void upToDateWhenBuiltTwice() throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
||||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
@ -78,7 +77,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void upToDateWhenBuiltTwiceWithLaunchScriptIncluded()
|
void upToDateWhenBuiltTwiceWithLaunchScriptIncluded()
|
||||||
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
throws InvalidRunnerConfigurationException, UnexpectedBuildFailure, IOException {
|
||||||
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
||||||
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -87,7 +86,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded() {
|
void notUpToDateWhenLaunchScriptWasNotIncludedAndThenIsIncluded() {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
||||||
@ -95,7 +94,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded() {
|
void notUpToDateWhenLaunchScriptWasIncludedAndThenIsNotIncluded() {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", this.taskName).task(":" + this.taskName)
|
||||||
@ -103,7 +102,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void notUpToDateWhenLaunchScriptPropertyChanges() {
|
void notUpToDateWhenLaunchScriptPropertyChanges() {
|
||||||
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=foo", this.taskName)
|
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=foo", this.taskName)
|
||||||
.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=bar", this.taskName)
|
assertThat(this.gradleBuild.build("-PincludeLaunchScript=true", "-PlaunchScriptProperty=bar", this.taskName)
|
||||||
@ -111,7 +110,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginMainClassNameIsUsed() throws IOException {
|
void applicationPluginMainClassNameIsUsed() throws IOException {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
|
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
|
||||||
@ -121,7 +120,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void springBootExtensionMainClassNameIsUsed() throws IOException {
|
void springBootExtensionMainClassNameIsUsed() throws IOException {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
|
try (JarFile jarFile = new JarFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) {
|
||||||
@ -131,7 +130,7 @@ public abstract class AbstractBootArchiveIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void duplicatesAreHandledGracefully() throws IOException {
|
void duplicatesAreHandledGracefully() throws IOException {
|
||||||
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
|
||||||
.isEqualTo(TaskOutcome.SUCCESS);
|
.isEqualTo(TaskOutcome.SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
public class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
||||||
|
|
||||||
public BootJarIntegrationTests() {
|
BootJarIntegrationTests() {
|
||||||
super("bootJar");
|
super("bootJar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@ package org.springframework.boot.gradle.tasks.bundling;
|
|||||||
*
|
*
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
public class BootWarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
class BootWarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
||||||
|
|
||||||
public BootWarIntegrationTests() {
|
BootWarIntegrationTests() {
|
||||||
super("bootWar");
|
super("bootWar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class MavenIntegrationTests {
|
class MavenIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarCanBeUploaded() throws FileNotFoundException, IOException {
|
void bootJarCanBeUploaded() throws FileNotFoundException, IOException {
|
||||||
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
|
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
|
||||||
.build("uploadBootArchives");
|
.build("uploadBootArchives");
|
||||||
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -51,7 +51,7 @@ public class MavenIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootWarCanBeUploaded() throws IOException {
|
void bootWarCanBeUploaded() throws IOException {
|
||||||
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
|
BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("6.0.0")
|
||||||
.build("uploadBootArchives");
|
.build("uploadBootArchives");
|
||||||
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":uploadBootArchives").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
|
@ -37,12 +37,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class MavenPublishingIntegrationTests {
|
class MavenPublishingIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootJarCanBePublished() throws FileNotFoundException, IOException {
|
void bootJarCanBePublished() throws FileNotFoundException, IOException {
|
||||||
BuildResult result = this.gradleBuild.build("publish");
|
BuildResult result = this.gradleBuild.build("publish");
|
||||||
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(artifactWithSuffix("jar")).isFile();
|
assertThat(artifactWithSuffix("jar")).isFile();
|
||||||
@ -51,7 +51,7 @@ public class MavenPublishingIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void bootWarCanBePublished() throws IOException {
|
void bootWarCanBePublished() throws IOException {
|
||||||
BuildResult result = this.gradleBuild.build("publish");
|
BuildResult result = this.gradleBuild.build("publish");
|
||||||
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":publish").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
assertThat(artifactWithSuffix("war")).isFile();
|
assertThat(artifactWithSuffix("war")).isFile();
|
||||||
|
@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
@ExtendWith(GradleCompatibilityExtension.class)
|
@ExtendWith(GradleCompatibilityExtension.class)
|
||||||
public class BootRunIntegrationTests {
|
class BootRunIntegrationTests {
|
||||||
|
|
||||||
GradleBuild gradleBuild;
|
GradleBuild gradleBuild;
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void basicExecution() throws IOException {
|
void basicExecution() throws IOException {
|
||||||
copyClasspathApplication();
|
copyClasspathApplication();
|
||||||
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
|
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
|
||||||
BuildResult result = this.gradleBuild.build("bootRun");
|
BuildResult result = this.gradleBuild.build("bootRun");
|
||||||
@ -52,7 +52,7 @@ public class BootRunIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void sourceResourcesCanBeUsed() throws IOException {
|
void sourceResourcesCanBeUsed() throws IOException {
|
||||||
copyClasspathApplication();
|
copyClasspathApplication();
|
||||||
BuildResult result = this.gradleBuild.build("bootRun");
|
BuildResult result = this.gradleBuild.build("bootRun");
|
||||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -62,21 +62,21 @@ public class BootRunIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void springBootExtensionMainClassNameIsUsed() throws IOException {
|
void springBootExtensionMainClassNameIsUsed() throws IOException {
|
||||||
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
||||||
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
|
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
|
||||||
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
|
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginMainClassNameIsUsed() throws IOException {
|
void applicationPluginMainClassNameIsUsed() throws IOException {
|
||||||
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
||||||
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
|
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.UP_TO_DATE);
|
||||||
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
|
assertThat(result.getOutput()).contains("Main class name = com.example.CustomMainClass");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginMainClassNameIsNotUsedWhenItIsNull() throws IOException {
|
void applicationPluginMainClassNameIsNotUsedWhenItIsNull() throws IOException {
|
||||||
copyClasspathApplication();
|
copyClasspathApplication();
|
||||||
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
BuildResult result = this.gradleBuild.build("echoMainClassName");
|
||||||
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":echoMainClassName").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -84,7 +84,7 @@ public class BootRunIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void defaultJvmArgs() throws IOException {
|
void defaultJvmArgs() throws IOException {
|
||||||
copyJvmArgsApplication();
|
copyJvmArgsApplication();
|
||||||
BuildResult result = this.gradleBuild.build("bootRun");
|
BuildResult result = this.gradleBuild.build("bootRun");
|
||||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -92,7 +92,7 @@ public class BootRunIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void optimizedLaunchDisabledJvmArgs() throws IOException {
|
void optimizedLaunchDisabledJvmArgs() throws IOException {
|
||||||
copyJvmArgsApplication();
|
copyJvmArgsApplication();
|
||||||
BuildResult result = this.gradleBuild.build("bootRun");
|
BuildResult result = this.gradleBuild.build("bootRun");
|
||||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
@ -100,7 +100,7 @@ public class BootRunIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
public void applicationPluginJvmArgumentsAreUsed() throws IOException {
|
void applicationPluginJvmArgumentsAreUsed() throws IOException {
|
||||||
copyJvmArgsApplication();
|
copyJvmArgsApplication();
|
||||||
BuildResult result = this.gradleBuild.build("bootRun");
|
BuildResult result = this.gradleBuild.build("bootRun");
|
||||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||||
|
Loading…
Reference in New Issue
Block a user