diff --git a/spring-boot-integration-tests/pom.xml b/spring-boot-integration-tests/pom.xml index 6b62d0d12f..dc50053137 100644 --- a/spring-boot-integration-tests/pom.xml +++ b/spring-boot-integration-tests/pom.xml @@ -23,7 +23,6 @@ spring-boot-devtools-tests spring-boot-integration-tests-embedded-servlet-container - spring-boot-gradle-tests spring-boot-launch-script-tests spring-boot-security-tests diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/pom.xml b/spring-boot-integration-tests/spring-boot-gradle-tests/pom.xml deleted file mode 100644 index 7f465d6f39..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-integration-tests - 2.0.0.BUILD-SNAPSHOT - - spring-boot-gradle-tests - jar - Spring Boot Gradle Integration Tests - Spring Boot Gradle Integration Tests - http://projects.spring.io/spring-boot/ - - Pivotal Software, Inc. - http://www.spring.io - - - ${basedir}/../.. - - - - org.gradle - gradle-tooling-api - ${gradle.version} - test - - - org.springframework.boot - spring-boot - test - - - org.apache.maven - maven-model-builder - 3.2.1 - test - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-effective-pom - generate-test-resources - - copy - - - - - org.springframework.boot - spring-boot-dependencies - ${project.version} - effective-pom - true - ${project.build.directory} - dependencies-pom.xml - - - - - - - - - - - gradle - http://repo.gradle.org/gradle/libs-releases-local - - true - - - false - - - - diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/BootRunResourceTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/BootRunResourceTests.java deleted file mode 100644 index 68c701f4af..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/BootRunResourceTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.IOException; - -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.Test; - -import org.springframework.boot.test.rule.OutputCapture; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Integration tests for bootRun's resource handling - * - * @author Andy Wilkinson - */ -public class BootRunResourceTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @Rule - public OutputCapture output = new OutputCapture(); - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("boot-run-resources"); - } - - @Test - public void resourcesDirectlyFromSource() { - project.newBuild().forTasks("clean", "bootRun") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=true") - .setStandardOutput(System.out).run(); - - assertThat(this.output.toString()).contains("src/main/resources/test.txt"); - } - - @Test - public void resourcesFromBuildOutput() { - project.newBuild().forTasks("clean", "bootRun") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PaddResources=false") - .setStandardOutput(System.out).run(); - assertThat(this.output.toString()).contains("build/resources/main/test.txt"); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ClassifierTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ClassifierTests.java deleted file mode 100644 index 37a52642b5..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ClassifierTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.util.jar.JarFile; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for using the Gradle plugin's support for installing artifacts - * - * @author Dave Syer - */ -public class ClassifierTests { - - private ProjectConnection project; - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - @Test - public void classifierInBootTask() throws Exception { - this.project = new ProjectCreator().createProject("classifier"); - this.project.newBuild().forTasks("build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - checkFilesExist("classifier"); - } - - @Test - public void classifierInBootExtension() throws Exception { - this.project = new ProjectCreator().createProject("classifier-extension"); - this.project.newBuild().forTasks("build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info") - .run(); - } - - private void checkFilesExist(String name) throws Exception { - JarFile jar = new JarFile("target/" + name + "/build/libs/" + name + ".jar"); - assertThat(jar.getManifest()).isNotNull(); - jar.close(); - jar = new JarFile("target/" + name + "/build/libs/" + name + "-exec.jar"); - assertThat(jar.getManifest()).isNotNull(); - jar.close(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java deleted file mode 100644 index 15da226fb5..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FlatdirTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2012-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Before; -import org.junit.Test; - -import org.springframework.util.FileCopyUtils; -import org.springframework.util.FileSystemUtils; - -/** - * Tests for using the Gradle plugin's support for flat directory repos - * - * @author Dave Syer - */ -public class FlatdirTests { - - private ProjectConnection project; - - private File libs = new File("target/flatdir/lib"); - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - @Before - public void init() { - if (this.libs.exists()) { - FileSystemUtils.deleteRecursively(this.libs); - } - } - - @Test - public void flatdir() throws Exception { - this.project = new ProjectCreator().createProject("flatdir"); - if (!this.libs.exists()) { - this.libs.mkdirs(); - } - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), - new File(this.libs, "foo-1.0.0.jar")); - this.project.newBuild().forTasks("build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java deleted file mode 100644 index c90f1fc40d..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/FullyExecutableJarTests.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Integration tests for creating a fully executable jar with Gradle. - * - * @author Andy Wilkinson - */ -public class FullyExecutableJarTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("executable-jar"); - } - - @Test - public void jarIsNotExecutableByDefault() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isFalse(); - } - - @Test - public void madeExecutableViaExtension() throws IOException { - project.newBuild().forTasks("clean", "build").withArguments( - "-PbootVersion=" + BOOT_VERSION, "-PextensionExecutable=true").run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - } - - @Test - public void madeExecutableViaTask() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PtaskExecutable=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - } - - @Test - public void taskTakesPrecedenceForMakingJarExecutable() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, - "-PextensionExecutable=false", "-PtaskExecutable=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - } - - @Test - public void scriptPropertiesFromTask() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PtaskProperties=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - assertThat(containsLine("# Provides:.*__task__", executableJar)).isTrue(); - } - - @Test - public void scriptPropertiesFromExtension() throws IOException { - project.newBuild().forTasks("clean", "build").withArguments( - "-PbootVersion=" + BOOT_VERSION, "-PextensionProperties=true").run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - assertThat(containsLine("# Provides:.*__extension__", executableJar)).isTrue(); - } - - @Test - public void taskTakesPrecedenceForScriptProperties() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, - "-PextensionProperties=true", "-PtaskProperties=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(isFullyExecutable(executableJar)).isTrue(); - assertThat(containsLine("# Provides:.*__task__", executableJar)).isTrue(); - } - - @Test - public void customScriptFromTask() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PtaskScript=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(containsLine("Custom task script", executableJar)).isTrue(); - } - - @Test - public void customScriptFromExtension() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PextensionScript=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(containsLine("Custom extension script", executableJar)).isTrue(); - } - - @Test - public void taskTakesPrecedenceForCustomScript() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PextensionScript=true", - "-PtaskScript=true") - .run(); - File buildLibs = new File("target/executable-jar/build/libs"); - File executableJar = new File(buildLibs, "executable-jar.jar"); - assertThat(containsLine("Custom task script", executableJar)).isTrue(); - } - - private boolean isFullyExecutable(File file) throws IOException { - return containsLine("#!/bin/bash", file); - } - - private boolean containsLine(String toMatch, File file) throws IOException { - Pattern pattern = Pattern.compile(toMatch); - for (String line : readLines(file)) { - if (pattern.matcher(line).matches()) { - return true; - } - } - return false; - } - - private List readLines(File file) throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(file)); - List lines = new ArrayList<>(); - try { - String line = reader.readLine(); - while (line != null && lines.size() < 50) { - lines.add(line); - line = reader.readLine(); - } - } - finally { - reader.close(); - } - return lines; - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java deleted file mode 100644 index 344edb7922..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Test; - -/** - * Tests for using the Gradle plugin's support for installing artifacts - * - * @author Dave Syer - */ -public class InstallTests { - - private ProjectConnection project; - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - @Test - public void cleanInstall() throws Exception { - this.project = new ProjectCreator().createProject("installer"); - this.project.newBuild().forTasks("install") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - } - - @Test - public void cleanInstallDist() throws Exception { - this.project = new ProjectCreator().createProject("install-app"); - this.project.newBuild().forTasks("installDist") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MainClassTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MainClassTests.java deleted file mode 100644 index 2921466c1b..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MainClassTests.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.IOException; - -import org.gradle.tooling.BuildException; -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for configuring a project's main class. - * - * @author Dave Syer - * @author Andy Wilkinson - */ -public class MainClassTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("main-class"); - } - - @Test - public void mainFromBootRun() { - project.newBuild().forTasks("build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-PbootRunMain=true") - .run(); - } - - @Test - public void nonJavaExecRunTaskIsIgnored() { - try { - project.newBuild().forTasks("build").withArguments( - "-PbootVersion=" + BOOT_VERSION, "-PnonJavaExecRun=true").run(); - } - catch (BuildException ex) { - Throwable rootCause = getRootCause(ex); - assertThat(rootCause.getMessage()).isEqualTo("Unable to find main class"); - } - } - - private Throwable getRootCause(Throwable ex) { - Throwable candidate = ex; - while (candidate.getCause() != null) { - candidate = candidate.getCause(); - } - return candidate; - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MixedVersionRepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MixedVersionRepackagingTests.java deleted file mode 100644 index f4d0832f50..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MixedVersionRepackagingTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; -import java.io.IOException; -import java.util.jar.JarFile; - -import org.assertj.core.api.Condition; -import org.assertj.core.description.TextDescription; -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.not; - -/** - * Integration tests for Gradle repackaging with two different versions of the same - * dependency. - * - * @author Andy Wilkinson - */ -public class MixedVersionRepackagingTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("mixed-version-repackaging"); - } - - @Test - public void singleVersionIsIncludedInJar() throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true", - "-PexcludeDevtools=false") - .run(); - File buildLibs = new File("target/mixed-version-repackaging/build/libs"); - File repackageFile = new File(buildLibs, "mixed-version-repackaging.jar"); - assertThat(repackageFile.exists()).isTrue(); - assertThat(new JarFile(repackageFile)) - .has(entryNamed("BOOT-INF/lib/guava-18.0.jar")); - assertThat(new JarFile(repackageFile)) - .has(not(entryNamed("BOOT-INF/lib/guava-16.0.jar"))); - } - - private Condition entryNamed(String name) { - return new JarFileEntryCondition(name); - } - - private final class JarFileEntryCondition extends Condition { - - private final String entryName; - - private JarFileEntryCondition(String entryName) { - super(new TextDescription("entry named '%s'", entryName)); - this.entryName = entryName; - } - - @Override - public boolean matches(JarFile jarFile) { - return jarFile.getEntry(this.entryName) != null; - } - - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java deleted file mode 100644 index b8296184e3..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; -import java.util.jar.JarFile; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Integration tests for Gradle repackaging with a multi-project build. - * - * @author Andy Wilkinson - */ -public class MultiProjectRepackagingTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - @Test - public void repackageWithTransitiveFileDependency() throws Exception { - ProjectConnection project = new ProjectCreator() - .createProject("multi-project-transitive-file-dependency"); - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - File buildLibs = new File( - "target/multi-project-transitive-file-dependency/main/build/libs"); - JarFile jarFile = new JarFile(new File(buildLibs, "main.jar")); - assertThat(jarFile.getEntry("BOOT-INF/lib/commons-logging-1.1.3.jar")) - .isNotNull(); - assertThat(jarFile.getEntry("BOOT-INF/lib/foo.jar")).isNotNull(); - jarFile.close(); - } - - @Test - public void repackageWithCommonFileDependency() throws Exception { - ProjectConnection project = new ProjectCreator() - .createProject("multi-project-common-file-dependency"); - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - File buildLibs = new File( - "target/multi-project-common-file-dependency/build/libs"); - JarFile jarFile = new JarFile( - new File(buildLibs, "multi-project-common-file-dependency.jar")); - assertThat(jarFile.getEntry("BOOT-INF/lib/foo.jar")).isNotNull(); - jarFile.close(); - } - - @Test - public void repackageWithRuntimeProjectDependency() throws Exception { - ProjectConnection project = new ProjectCreator() - .createProject("multi-project-runtime-project-dependency"); - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - File buildLibs = new File( - "target/multi-project-runtime-project-dependency/projectA/build/libs"); - JarFile jarFile = new JarFile(new File(buildLibs, "projectA.jar")); - assertThat(jarFile.getEntry("BOOT-INF/lib/projectB.jar")).isNotNull(); - jarFile.close(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/NoJarTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/NoJarTests.java deleted file mode 100644 index d3051eda25..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/NoJarTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for using the Gradle plugin's support for flat directory repos - * - * @author Dave Syer - */ -public class NoJarTests { - - private ProjectConnection project; - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - @Test - public void nojar() throws Exception { - this.project = new ProjectCreator().createProject("nojar"); - this.project.newBuild().forTasks("build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - assertThat(new File("target/nojar/build/libs")).doesNotExist(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ProjectCreator.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ProjectCreator.java deleted file mode 100644 index 8e08921d37..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/ProjectCreator.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; -import java.io.IOException; - -import org.gradle.tooling.GradleConnector; -import org.gradle.tooling.ProjectConnection; -import org.gradle.tooling.internal.consumer.DefaultGradleConnector; - -import org.springframework.util.FileCopyUtils; -import org.springframework.util.FileSystemUtils; - -/** - * @author Andy Wilkinson - */ -public class ProjectCreator { - - private String gradleVersion; - - public ProjectCreator() { - this("3.4"); - } - - public ProjectCreator(String gradleVersion) { - this.gradleVersion = gradleVersion; - } - - public ProjectConnection createProject(String name) throws IOException { - File projectDirectory = new File("target/" + name); - projectDirectory.mkdirs(); - - File gradleScript = new File(projectDirectory, "build.gradle"); - - if (new File("src/test/resources", name).isDirectory()) { - FileSystemUtils.copyRecursively(new File("src/test/resources", name), - projectDirectory); - } - else { - FileCopyUtils.copy(new File("src/test/resources/" + name + ".gradle"), - gradleScript); - } - - GradleConnector gradleConnector = GradleConnector.newConnector(); - gradleConnector.useGradleVersion(this.gradleVersion); - - ((DefaultGradleConnector) gradleConnector).embedded(true); - return gradleConnector.forProjectDirectory(projectDirectory).connect(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java deleted file mode 100644 index fd4b7e1e54..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/RepackagingTests.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; -import java.io.IOException; -import java.util.jar.JarFile; - -import org.gradle.tooling.BuildLauncher; -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; - -import org.springframework.util.FileCopyUtils; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Integration tests for gradle repackaging. - * - * @author Andy Wilkinson - */ -public class RepackagingTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("repackage"); - } - - @Test - public void repackagingEnabled() throws IOException { - createBuildForTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); - File buildLibs = new File("target/repackage/build/libs"); - File repackageFile = new File(buildLibs, "repackage.jar"); - assertThat(repackageFile.exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - } - - @Test - public void repackagingDisabled() { - createBuildForTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=false") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - } - - @Test - public void repackagingDisabledWithCustomRepackagedJar() { - createBuildForTasks("clean", "build", "customRepackagedJar") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=false") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(new File(buildLibs, "custom.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue(); - } - - @Test - public void repackagingDisabledWithCustomRepackagedJarUsingStringJarTaskReference() { - project.newBuild() - .forTasks("clean", "build", "customRepackagedJarWithStringReference") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=false") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isFalse(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(new File(buildLibs, "custom.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue(); - } - - @Test - public void repackagingEnabledWithCustomRepackagedJar() { - createBuildForTasks("clean", "build", "customRepackagedJar") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(new File(buildLibs, "custom.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue(); - } - - @Test - public void repackagingEnableWithCustomRepackagedJarUsingStringJarTaskReference() { - project.newBuild() - .forTasks("clean", "build", "customRepackagedJarWithStringReference") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "repackage.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(new File(buildLibs, "custom.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue(); - } - - @Test - public void repackageWithFileDependency() throws Exception { - FileCopyUtils.copy(new File("src/test/resources/foo.jar"), - new File("target/repackage/foo.jar")); - createBuildForTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); - File buildLibs = new File("target/repackage/build/libs"); - JarFile jarFile = new JarFile(new File(buildLibs, "repackage.jar")); - assertThat(jarFile.getEntry("BOOT-INF/lib/foo.jar")).isNotNull(); - jarFile.close(); - } - - @Test - public void devtoolsIsExcludedByDefault() throws IOException { - createBuildForTasks("clean", "bootRepackage") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); - File buildLibs = new File("target/repackage/build/libs"); - File repackageFile = new File(buildLibs, "repackage.jar"); - assertThat(repackageFile.exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(isDevToolsJarIncluded(repackageFile)).isFalse(); - } - - @Test - public void devtoolsCanBeIncludedUsingTheExtension() throws IOException { - createBuildForTasks("clean", "bootRepackage") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true", - "-PexcludeDevtoolsOnExtension=false") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - File repackageFile = new File(buildLibs, "repackage.jar"); - assertThat(repackageFile.exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(isDevToolsJarIncluded(repackageFile)).isTrue(); - } - - @Test - public void devtoolsCanBeIncludedUsingBootRepackage() throws IOException { - createBuildForTasks("clean", "bootRepackage") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true", - "-PexcludeDevtoolsOnBootRepackage=false") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - File repackageFile = new File(buildLibs, "repackage.jar"); - assertThat(repackageFile.exists()).isTrue(); - assertThat(new File(buildLibs, "repackage.jar.original").exists()).isTrue(); - assertThat(new File(buildLibs, "repackage-sources.jar.original").exists()) - .isFalse(); - assertThat(isDevToolsJarIncluded(repackageFile)).isTrue(); - } - - @Test - public void customRepackagingTaskWithOwnMainClassNameAnNoGlobalMainClassName() { - createBuildForTasks("clean", "customRepackagedJarWithOwnMainClass") - .withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true", - "-PnoMainClass=true") - .run(); - File buildLibs = new File("target/repackage/build/libs"); - assertThat(new File(buildLibs, "custom.jar").exists()).isTrue(); - assertThat(new File(buildLibs, "custom.jar.original").exists()).isTrue(); - } - - private BuildLauncher createBuildForTasks(String... taskNames) { - return project.newBuild().setStandardError(System.err) - .setStandardOutput(System.out).forTasks(taskNames); - } - - private boolean isDevToolsJarIncluded(File repackageFile) throws IOException { - JarFile jarFile = new JarFile(repackageFile); - try { - String name = "BOOT-INF/lib/spring-boot-devtools-" + BOOT_VERSION + ".jar"; - return jarFile.getEntry(name) != null; - } - finally { - jarFile.close(); - } - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java deleted file mode 100644 index da131ea2be..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.gradle.tooling.ProjectConnection; -import org.junit.Test; - -import static org.junit.Assert.fail; - -/** - * Integration tests for the Gradle plugin's Spring Loaded support - * - * @author Andy Wilkinson - */ -public class SpringLoadedTests { - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static final String SPRING_LOADED_VERSION = Versions.getSpringLoadedVersion(); - - @Test - public void defaultJvmArgsArePreservedWhenLoadedAgentIsConfigured() - throws IOException { - ProjectConnection project = new ProjectCreator() - .createProject("spring-loaded-jvm-args"); - project.newBuild().forTasks("bootRun") - .withArguments("-PbootVersion=" + BOOT_VERSION, - "-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace") - .run(); - - List output = getOutput(); - assertOutputContains("-DSOME_ARG=someValue", output); - assertOutputContains("-Xverify:none", output); - assertOutputMatches("-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", - output); - } - - private List getOutput() throws IOException { - BufferedReader reader = new BufferedReader(new FileReader( - new File("target/spring-loaded-jvm-args/build/output.txt"))); - try { - List lines = new ArrayList<>(); - - String line; - - while ((line = reader.readLine()) != null) { - lines.add(line); - } - return lines; - } - finally { - reader.close(); - } - } - - private void assertOutputContains(String requiredOutput, List actualOutput) { - for (String line : actualOutput) { - if (line.equals(requiredOutput)) { - return; - } - } - fail("Required output '" + requiredOutput + "' not found in " + actualOutput); - } - - private void assertOutputMatches(String requiredPattern, List actualOutput) { - for (String line : actualOutput) { - if (line.matches(requiredPattern)) { - return; - } - } - fail("Required pattern '" + requiredPattern + "' not matched in " + actualOutput); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java deleted file mode 100644 index 63431bd942..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/Versions.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.FileReader; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathFactory; - -import org.xml.sax.InputSource; - -/** - * @author Andy Wilkinson - */ -public final class Versions { - - private Versions() { - } - - public static String getBootVersion() { - return evaluateExpression( - "/*[local-name()='project']/*[local-name()='version']" + "/text()"); - } - - public static String getSpringLoadedVersion() { - return evaluateExpression( - "/*[local-name()='project']/*[local-name()='properties']" - + "/*[local-name()='spring-loaded.version']/text()"); - } - - public static String getSpringVersion() { - return evaluateExpression( - "/*[local-name()='project']/*[local-name()='properties']" - + "/*[local-name()='spring.version']/text()"); - } - - private static String evaluateExpression(String expression) { - try { - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xpath = xPathFactory.newXPath(); - XPathExpression expr = xpath.compile(expression); - String version = expr.evaluate( - new InputSource(new FileReader("target/dependencies-pom.xml"))); - return version; - } - catch (Exception ex) { - throw new IllegalStateException("Failed to evaluate expression", ex); - } - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java deleted file mode 100644 index 3c5b41c429..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/WarPackagingTests.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for war packaging with Gradle to ensure that only the Servlet container and its - * dependencies are packaged in WEB-INF/lib-provided - * - * @author Andy Wilkinson - */ -public class WarPackagingTests { - - private static final String WEB_INF_LIB_PROVIDED_PREFIX = "WEB-INF/lib-provided/"; - - private static final String WEB_INF_LIB_PREFIX = "WEB-INF/lib/"; - - private static final Set TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet<>( - Arrays.asList("spring-boot-starter-tomcat-", "tomcat-embed-core-", - "tomcat-embed-el-", "tomcat-embed-websocket-")); - - private static final Set JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED = new HashSet<>( - Arrays.asList("spring-boot-starter-jetty-", "jetty-continuation", - "jetty-util-", "javax.servlet-", "jetty-client", "jetty-io-", - "jetty-http-", "jetty-server-", "jetty-security-", "jetty-servlet-", - "jetty-servlets", "jetty-webapp-", "websocket-api", - "javax.annotation-api", "jetty-plus", "javax-websocket-server-impl-", - "apache-el", "asm-", "javax.websocket-api-", "asm-tree-", - "asm-commons-", "websocket-common-", "jetty-annotations-", - "javax-websocket-client-impl-", "websocket-client-", - "websocket-server-", "jetty-xml-", "websocket-servlet-")); - - private static final String BOOT_VERSION = Versions.getBootVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("war-packaging"); - } - - @Test - public void onlyTomcatIsPackagedInWebInfLibProvided() throws IOException { - checkWebInfEntriesForWebServer("tomcat", - TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED); - } - - @Test - public void onlyJettyIsPackagedInWebInfLibProvided() throws IOException { - checkWebInfEntriesForWebServer("jetty", - JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED); - } - - private void checkWebInfEntriesForWebServer(String webServer, - Set expectedLibProvidedEntries) throws IOException { - project.newBuild().forTasks("clean", "build") - .withArguments("-PbootVersion=" + BOOT_VERSION, - "-PservletContainer=" + webServer) - .run(); - - JarFile war = new JarFile("target/war-packaging/build/libs/war-packaging.war"); - - checkWebInfLibProvidedEntries(war, expectedLibProvidedEntries); - - checkWebInfLibEntries(war, expectedLibProvidedEntries); - - try { - war.close(); - } - catch (IOException ex) { - // Ignore - } - } - - private void checkWebInfLibProvidedEntries(JarFile war, Set expectedEntries) - throws IOException { - Set entries = getWebInfLibProvidedEntries(war); - assertThat(entries).hasSameSizeAs(expectedEntries); - List unexpectedLibProvidedEntries = new ArrayList<>(); - for (String entry : entries) { - if (!isExpectedInWebInfLibProvided(entry, expectedEntries)) { - unexpectedLibProvidedEntries.add(entry); - } - } - assertThat(unexpectedLibProvidedEntries.isEmpty()); - } - - private void checkWebInfLibEntries(JarFile war, Set entriesOnlyInLibProvided) - throws IOException { - Set entries = getWebInfLibEntries(war); - List unexpectedLibEntries = new ArrayList<>(); - for (String entry : entries) { - if (!isExpectedInWebInfLib(entry, entriesOnlyInLibProvided)) { - unexpectedLibEntries.add(entry); - } - } - assertThat(unexpectedLibEntries.isEmpty()); - } - - private Set getWebInfLibProvidedEntries(JarFile war) throws IOException { - Set webInfLibProvidedEntries = new HashSet<>(); - Enumeration entries = war.entries(); - while (entries.hasMoreElements()) { - String name = entries.nextElement().getName(); - if (isWebInfLibProvidedEntry(name)) { - webInfLibProvidedEntries.add(name); - } - } - return webInfLibProvidedEntries; - } - - private Set getWebInfLibEntries(JarFile war) throws IOException { - Set webInfLibEntries = new HashSet<>(); - Enumeration entries = war.entries(); - while (entries.hasMoreElements()) { - String name = entries.nextElement().getName(); - if (isWebInfLibEntry(name)) { - webInfLibEntries.add(name); - } - } - return webInfLibEntries; - } - - private boolean isWebInfLibProvidedEntry(String name) { - return name.startsWith(WEB_INF_LIB_PROVIDED_PREFIX) - && !name.equals(WEB_INF_LIB_PROVIDED_PREFIX); - } - - private boolean isWebInfLibEntry(String name) { - return name.startsWith(WEB_INF_LIB_PREFIX) && !name.equals(WEB_INF_LIB_PREFIX); - } - - private boolean isExpectedInWebInfLibProvided(String name, - Set expectedEntries) { - for (String expected : expectedEntries) { - if (name.startsWith(WEB_INF_LIB_PROVIDED_PREFIX + expected)) { - return true; - } - } - return false; - } - - private boolean isExpectedInWebInfLib(String name, Set unexpectedEntries) { - for (String unexpected : unexpectedEntries) { - if (name.startsWith(WEB_INF_LIB_PREFIX + unexpected)) { - return false; - } - } - return true; - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java deleted file mode 100644 index f8d2fc7922..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/starter/StarterDependenciesIntegrationTests.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2012-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.starter; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.gradle.tooling.BuildException; -import org.gradle.tooling.ProjectConnection; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -import org.springframework.boot.gradle.ProjectCreator; -import org.springframework.boot.gradle.Versions; - -/** - * Tests for the various starter projects to check that they don't pull in unwanted - * transitive dependencies when used with Gradle - * - * @author Andy Wilkinson - */ -@RunWith(Parameterized.class) -public class StarterDependenciesIntegrationTests { - - private static final String STARTER_NAME_PREFIX = "spring-boot-starter"; - - private static final List EXCLUDED_STARTERS = Arrays - .asList("spring-boot-starter-parent"); - - private static ProjectConnection project; - - private static String bootVersion; - - private static String springVersion; - - private final String[] buildArguments; - - @Parameters - public static List getStarters() { - List starters = new ArrayList<>(); - for (File file : new File("../../spring-boot-starters").listFiles()) { - if (file.isDirectory() && new File(file, "pom.xml").exists()) { - String name = file.getName(); - if (name.startsWith(STARTER_NAME_PREFIX) - && !EXCLUDED_STARTERS.contains(file.getName())) { - starters.add(new String[] { file.getName() }); - } - } - } - return starters; - } - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("starter-dependencies"); - } - - @BeforeClass - public static void determineVersions() throws Exception { - springVersion = Versions.getSpringVersion(); - bootVersion = Versions.getBootVersion(); - } - - @AfterClass - public static void closeProject() { - project.close(); - } - - public StarterDependenciesIntegrationTests(String starter) { - this.buildArguments = new String[] { "-Pstarter=" + starter, - "-PbootVersion=" + bootVersion, "-PspringVersion=" + springVersion }; - } - - @Test - public void commonsLoggingIsNotATransitiveDependency() throws IOException { - runBuildForTask("checkCommonsLogging"); - } - - @Test - public void oldSpringModulesAreNotTransitiveDependencies() throws IOException { - runBuildForTask("checkSpring"); - } - - private void runBuildForTask(String task) { - try { - project.newBuild().forTasks(task).withArguments(this.buildArguments).run(); - } - catch (BuildException ex) { - throw new RuntimeException(ex); - } - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle deleted file mode 100644 index c8a854743c..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'org.springframework.boot' - -repositories { - mavenLocal() -} - -bootRun { - addResources = Boolean.valueOf(project.addResources) -} \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/src/main/java/BootRunResourcesApplication.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/src/main/java/BootRunResourcesApplication.java deleted file mode 100644 index 1a640c586b..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/src/main/java/BootRunResourcesApplication.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2012-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -public class BootRunResourcesApplication { - - public static void main(String[] args) { - ClassLoader classLoader = BootRunResourcesApplication.class.getClassLoader(); - System.out.println(classLoader.getResource("test.txt")); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/src/main/resources/test.txt b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/src/main/resources/test.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier-extension.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier-extension.gradle deleted file mode 100644 index 302cb56e61..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier-extension.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'org.springframework.boot' - -jar { - baseName = 'classifier-extension' -} - -springBoot { - classifier = 'exec' - mainClass = 'demo.Application' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile "org.springframework:spring-core" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier.gradle deleted file mode 100644 index abf9c95bfa..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/classifier.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'org.springframework.boot' - -jar { - baseName = 'classifier' -} - -bootRepackage { - classifier = 'exec' - mainClass = 'demo.Application' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile "org.springframework:spring-core" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/build.gradle deleted file mode 100644 index 25986b5968..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/build.gradle +++ /dev/null @@ -1,53 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'org.springframework.boot' -apply plugin: 'java' - -dependencies { - compile 'org.springframework.boot:spring-boot-starter-freemarker' - compile 'org.springframework.boot:spring-boot-starter-web' - compile 'org.springframework.boot:spring-boot-devtools' - compile files("foo.jar") -} - -springBoot { - mainClass = 'foo.bar.Baz' -} - -if (project.properties['taskExecutable']) { - bootRepackage.executable = Boolean.valueOf(project.taskExecutable) -} - -if (project.properties['extensionExecutable']) { - springBoot.executable = Boolean.valueOf(project.extensionExecutable) -} - -if (project.properties['taskProperties']) { - bootRepackage.executable = true - bootRepackage.embeddedLaunchScriptProperties = ['initInfoProvides': '__task__'] -} - -if (project.properties['extensionProperties']) { - bootRepackage.executable = true - springBoot.embeddedLaunchScriptProperties = ['initInfoProvides': '__extension__'] -} - -if (project.properties['taskScript']) { - bootRepackage.embeddedLaunchScript = file('task.script') -} - -if (project.properties['extensionScript']) { - springBoot.embeddedLaunchScript = file('extension.script') -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/extension.script b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/extension.script deleted file mode 100644 index 9c5657221e..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/extension.script +++ /dev/null @@ -1 +0,0 @@ -Custom extension script diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/task.script b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/task.script deleted file mode 100644 index 17a55b540d..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/executable-jar/task.script +++ /dev/null @@ -1 +0,0 @@ -Custom task script diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle deleted file mode 100644 index 1617ae2a87..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'org.springframework.boot' - -group = 'flatdir' -version = '0.0.0' - -bootRun { - main = 'Foo' -} - -jar { - baseName = 'flatdir' -} - -repositories { - mavenLocal() - flatDir( dirs:'lib' ) -} - -dependencies { - compile ':foo:1.0.0' -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/foo.jar b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/foo.jar deleted file mode 100644 index 6b017f90e8..0000000000 Binary files a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/foo.jar and /dev/null differ diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/install-app.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/install-app.gradle deleted file mode 100644 index 89744abfe3..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/install-app.gradle +++ /dev/null @@ -1,33 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'org.springframework.boot' -apply plugin: 'application' - -group = 'installer' -version = '0.0.0' - -bootRun { - main = 'org.springframework.boot.SpringApplication' -} - -jar { - baseName = 'install-app' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile "org.springframework.boot:spring-boot-starter" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer.gradle deleted file mode 100644 index db0f6c0fbd..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer.gradle +++ /dev/null @@ -1,40 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'org.springframework.boot' - -group = 'installer' -version = '0.0.0' - -install { - repositories.mavenInstaller { - pom.project { - parent { - groupId 'org.springframework.boot' - artifactId 'spring-boot-starter-parent' - version "${project.bootVersion}" - } - } - } -} - -jar { - baseName = 'installer' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile "org.springframework.boot:spring-boot-starter" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/main-class.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/main-class.gradle deleted file mode 100644 index 7688b62d8a..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/main-class.gradle +++ /dev/null @@ -1,39 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'org.springframework.boot' - -group = 'installer' -version = '0.0.0' - -if (project.hasProperty('bootRunMain')) { - bootRun { - main = 'org.springframework.boot.SpringApplication' - } -} - -if (project.hasProperty('nonJavaExecRun')) { - task run { } -} - - -jar { - baseName = 'installer' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile "org.springframework.boot:spring-boot-starter" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/mixed-version-repackaging.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/mixed-version-repackaging.gradle deleted file mode 100644 index 9b2ef45dfa..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/mixed-version-repackaging.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'org.springframework.boot' -apply plugin: 'java' - -dependencies { - compile 'com.google.guava:guava:16.0' - runtime 'com.google.guava:guava:18.0' -} - -dependencyManagement { - overriddenByDependencies = false -} - -springBoot { - mainClass = 'foo.bar.Baz' -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle deleted file mode 100644 index 9285bfc05b..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -subprojects { - apply plugin: 'java' - - dependencies { - compile rootProject.files {'lib/foo.jar'} - } -} - -apply plugin: 'org.springframework.boot' - -repositories { - mavenLocal() -} - -springBoot { - mainClass = 'foo.bar.Baz' -} - -dependencies { - compile project(':one') - compile project(':two') -} - diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/lib/foo.jar b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/lib/foo.jar deleted file mode 100644 index 6b017f90e8..0000000000 Binary files a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/lib/foo.jar and /dev/null differ diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/settings.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/settings.gradle deleted file mode 100644 index 9ae3a92d29..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ - -include 'one' -include 'two' \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle deleted file mode 100644 index e33e5c4baf..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -project(':projectA') { - apply plugin: 'org.springframework.boot' - repositories { - mavenLocal() - } - dependencies { - runtime project(':projectB') - } - bootRepackage { - mainClass 'com.foo.Bar' - } -} - -project(':projectB') { - apply plugin: 'java' -} \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/settings.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/settings.gradle deleted file mode 100644 index ee6b6cd92c..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'projectA', 'projectB' \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/build.gradle deleted file mode 100644 index 7b1e7ab95b..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -project('main') { - apply plugin: 'org.springframework.boot' - apply plugin: 'java' - - repositories { - mavenLocal() - mavenCentral() - } - - dependencies { - compile project(':common') - } - - springBoot { - mainClass = 'foo.bar.Baz' - } -} - -project('common') { - apply plugin: 'java' - - repositories { - mavenLocal() - mavenCentral() - } - - dependencies { - compile "commons-logging:commons-logging:1.1.3" - compile files { "lib/foo.jar" } - } -} \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/common/lib/foo.jar b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/common/lib/foo.jar deleted file mode 100644 index 6b017f90e8..0000000000 Binary files a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/common/lib/foo.jar and /dev/null differ diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/settings.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/settings.gradle deleted file mode 100644 index 567c065267..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-transitive-file-dependency/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ - -include 'main' -include 'common' \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/nojar.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/nojar.gradle deleted file mode 100644 index b2e1872648..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/nojar.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'org.springframework.boot' - -group = 'nojar' -version = '0.0.0' - -jar { - enabled = false -} - -bootRepackage { - enabled = false -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile 'org.springframework.boot:spring-boot-starter' -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/repackage.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/repackage.gradle deleted file mode 100644 index 5851ba39b5..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/repackage.gradle +++ /dev/null @@ -1,66 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'org.springframework.boot' -apply plugin: 'java' - -dependencies { - compile 'org.springframework.boot:spring-boot-starter-freemarker' - compile 'org.springframework.boot:spring-boot-starter-web' - compile 'org.springframework.boot:spring-boot-devtools' - compile files("foo.jar") -} - -springBoot { - if (!project.hasProperty("noMainClass")) { - mainClass = 'foo.bar.Baz' - } - if (project.hasProperty("excludeDevtoolsOnExtension")) { - excludeDevtools = Boolean.valueOf(project.excludeDevtoolsOnExtension) - } -} - -bootRepackage { - enabled = Boolean.valueOf(project.repackage) - if (project.hasProperty("excludeDevtoolsOnBootRepackage")) { - excludeDevtools = Boolean.valueOf(project.excludeDevtoolsOnBootRepackage) - } -} - -task customJar(type: Jar) { - archiveName = 'custom.jar' - from sourceSets.main.output -} - -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - -artifacts { - archives sourcesJar -} - -task customRepackagedJar(type: BootRepackage, dependsOn: customJar) { - withJarTask = customJar -} - -task customRepackagedJarWithStringReference(type: BootRepackage, dependsOn: customJar) { - withJarTask = 'customJar' -} - -task customRepackagedJarWithOwnMainClass(type: BootRepackage, dependsOn: customJar) { - withJarTask = customJar - mainClass = 'foo.bar.Baz' -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/build.gradle deleted file mode 100644 index 18551e99f0..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - classpath("org.springframework:springloaded:${project.springLoadedVersion}") - } -} - -apply plugin: 'application' -apply plugin: 'java' -apply plugin: 'org.springframework.boot' - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter") -} - -applicationDefaultJvmArgs = [ - "-DSOME_ARG=someValue" -] - -jar { - baseName = 'spring-loaded-jvm-args' -} \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/src/main/java/test/Application.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/src/main/java/test/Application.java deleted file mode 100644 index a648170a30..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-jvm-args/src/main/java/test/Application.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package test; - -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.lang.management.ManagementFactory; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.Assert; - -public class Application { - - public static void main(String[] args) throws Exception { - PrintWriter writer = new PrintWriter(new FileWriter(new File("build/output.txt"))); - for (String argument: ManagementFactory.getRuntimeMXBean().getInputArguments()) { - writer.println(argument); - } - writer.close(); - } -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/build.gradle deleted file mode 100644 index 83ca8f70a2..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - classpath("org.springframework:springloaded:${project.springLoadedVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'org.springframework.boot' - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compile("org.springframework.boot:spring-boot-starter") -} - -jar { - baseName = 'spring-loaded-old-gradle' -} \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/src/main/java/test/Application.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/src/main/java/test/Application.java deleted file mode 100644 index a648170a30..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/spring-loaded-old-gradle/src/main/java/test/Application.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012-2015 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package test; - -import java.io.File; -import java.io.FileWriter; -import java.io.PrintWriter; -import java.lang.management.ManagementFactory; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.util.Assert; - -public class Application { - - public static void main(String[] args) throws Exception { - PrintWriter writer = new PrintWriter(new FileWriter(new File("build/output.txt"))); - for (String argument: ManagementFactory.getRuntimeMXBean().getInputArguments()) { - writer.println(argument); - } - writer.close(); - } -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/starter-dependencies.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/starter-dependencies.gradle deleted file mode 100644 index f00c9d2de8..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/starter-dependencies.gradle +++ /dev/null @@ -1,60 +0,0 @@ -import org.gradle.api.artifacts.result.UnresolvedDependencyResult; - -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -configurations { - springBootStarter -} - -dependencies { - springBootStarter "org.springframework.boot:${project.starter}:${project.bootVersion}" -} - -apply plugin: 'org.springframework.boot' - -task checkCommonsLogging { - doFirst { - def commonsLogging = resolvedDependencies - .find { it.selected.id.group == 'commons-logging' } - if (commonsLogging) { - throw new GradleException("${project.starter} pulls in commons-logging") - } - } -} - -task checkSpring { - doFirst { - def wrongSpring = resolvedDependencies - .findAll{it.selected.id.group == 'org.springframework'} - .findAll{it.selected.id.version != project.springVersion} - .collect {it.selected.id} - if (wrongSpring) { - throw new GradleException("${project.starter} pulled in ${wrongSpring as Set}") - } - } -} - -def getResolvedDependencies() { - def allDependencies = configurations.springBootStarter.incoming - .resolutionResult.allDependencies - .split { it instanceof UnresolvedDependencyResult } - - def unresolved = allDependencies.first() - def resolved = allDependencies.last() - if (unresolved) { - throw new GradleException("Resolution of ${project.starter} failed: ${unresolved}") - } - resolved -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/war-packaging.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/war-packaging.gradle deleted file mode 100644 index af52898c6e..0000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/war-packaging.gradle +++ /dev/null @@ -1,27 +0,0 @@ -import org.gradle.api.artifacts.result.UnresolvedDependencyResult; - -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'org.springframework.boot' -apply plugin: 'war' - -dependencies { - compile 'org.springframework.boot:spring-boot-starter-freemarker' - providedRuntime "org.springframework.boot:spring-boot-starter-$servletContainer" -} - -springBoot { - mainClass = 'foo.bar.Baz' -} \ No newline at end of file