From 8b03834d79ea083e9d0e5bd401cf6bd7232839c6 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 16 Jun 2014 12:56:50 +0100 Subject: [PATCH] Add integration test for "gradle install" See gh-1105 --- .../boot/gradle/InstallTests.java | 48 +++++++++++++++++++ .../src/test/resources/installer.gradle | 40 ++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java create mode 100644 spring-boot-integration-tests/src/test/resources/installer.gradle diff --git a/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java b/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java new file mode 100644 index 0000000000..c665ca78a6 --- /dev/null +++ b/spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java @@ -0,0 +1,48 @@ +/* + * Copyright 2012-2014 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.Test; +import org.springframework.boot.dependency.tools.ManagedDependencies; + +/** + * Tests for using the Gradle plugin's support for installing artifacts + * + * @author Dave Syer + */ +public class InstallTests { + + private static ProjectConnection project; + + private static final String BOOT_VERSION = ManagedDependencies.get() + .find("spring-boot").getVersion(); + + @BeforeClass + public static void createProject() throws IOException { + project = new ProjectCreator().createProject("installer"); + } + + @Test + public void cleanInstall() { + project.newBuild().forTasks("install").withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); + } + +} diff --git a/spring-boot-integration-tests/src/test/resources/installer.gradle b/spring-boot-integration-tests/src/test/resources/installer.gradle new file mode 100644 index 0000000000..bc24c4b133 --- /dev/null +++ b/spring-boot-integration-tests/src/test/resources/installer.gradle @@ -0,0 +1,40 @@ +buildscript { + repositories { + mavenLocal() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'spring-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" +}