From e2d54bc03faf0f103836733fbd0aee29a917e670 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 16 Nov 2015 10:17:12 +0100 Subject: [PATCH] Revert 791fb26 and d715066 --- .../generator/ProjectRequest.groovy | 3 +-- .../generator/ProjectGeneratorTests.groovy | 22 ++++++++++--------- .../web/MainControllerIntegrationTests.groovy | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/initializr/src/main/groovy/io/spring/initializr/generator/ProjectRequest.groovy b/initializr/src/main/groovy/io/spring/initializr/generator/ProjectRequest.groovy index 5b0a667c..a6bbbb00 100644 --- a/initializr/src/main/groovy/io/spring/initializr/generator/ProjectRequest.groovy +++ b/initializr/src/main/groovy/io/spring/initializr/generator/ProjectRequest.groovy @@ -174,8 +174,7 @@ class ProjectRequest { resolvedDependencies << metadata.dependencies.get('web') facets << 'web' } - if (!resolvedDependencies.find { it.artifactId.startsWith('spring-boot-starter') }) { - // There's no spring-boot-* dependency so we add the default one + if (resolvedDependencies.isEmpty()) { addDefaultDependency() } } diff --git a/initializr/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy b/initializr/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy index b59c93b5..81dc06d7 100644 --- a/initializr/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy +++ b/initializr/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy @@ -16,25 +16,26 @@ package io.spring.initializr.generator -import static org.mockito.Mockito.mock -import static org.mockito.Mockito.times -import static org.mockito.Mockito.verify import io.spring.initializr.metadata.BillOfMaterials import io.spring.initializr.metadata.Dependency import io.spring.initializr.test.GradleBuildAssert import io.spring.initializr.test.InitializrMetadataTestBuilder import io.spring.initializr.test.PomAssert import io.spring.initializr.test.ProjectAssert - import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.rules.TemporaryFolder + import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.times +import static org.mockito.Mockito.verify + /** * @author Stephane Nicoll */ @@ -112,7 +113,7 @@ class ProjectGeneratorTests { def request = createProjectRequest('thymeleaf') generateMavenPom(request) .hasDependency('org.foo', 'thymeleaf') - .hasDependenciesCount(3) + .hasDependenciesCount(2) } @Test @@ -131,7 +132,7 @@ class ProjectGeneratorTests { .hasSpringBootStarterTomcat() .hasDependency('org.foo', 'thymeleaf') // This is tagged as web facet so it brings the web one .hasSpringBootStarterTest() - .hasDependenciesCount(4) + .hasDependenciesCount(3) } @Test @@ -272,9 +273,9 @@ class ProjectGeneratorTests { void mavenPomWithCustomScope() { def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime') def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest', - artifactId: 'hamcrest', scope: 'test') + artifactId: 'hamcrest', scope: 'test') def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet', - artifactId: 'servlet-api', scope: 'provided') + artifactId: 'servlet-api', scope: 'provided') def metadata = InitializrMetadataTestBuilder.withDefaults() .addDependencyGroup('core', 'web', 'security', 'data-jpa') .addDependencyGroup('database', h2) @@ -291,9 +292,9 @@ class ProjectGeneratorTests { void gradleBuildWithCustomScope() { def h2 = new Dependency(id: 'h2', groupId: 'org.h2', artifactId: 'h2', scope: 'runtime') def hamcrest = new Dependency(id: 'hamcrest', groupId: 'org.hamcrest', - artifactId: 'hamcrest', scope: 'test') + artifactId: 'hamcrest', scope: 'test') def servlet = new Dependency(id: 'servlet-api', groupId: 'javax.servlet', - artifactId: 'servlet-api', scope: 'provided') + artifactId: 'servlet-api', scope: 'provided') def metadata = InitializrMetadataTestBuilder.withDefaults() .addDependencyGroup('core', 'web', 'security', 'data-jpa') .addDependencyGroup('database', h2) @@ -477,4 +478,5 @@ class ProjectGeneratorTests { request.style.addAll Arrays.asList(styles) request } + } diff --git a/initializr/src/test/groovy/io/spring/initializr/web/MainControllerIntegrationTests.groovy b/initializr/src/test/groovy/io/spring/initializr/web/MainControllerIntegrationTests.groovy index 078b31cc..c100f149 100644 --- a/initializr/src/test/groovy/io/spring/initializr/web/MainControllerIntegrationTests.groovy +++ b/initializr/src/test/groovy/io/spring/initializr/web/MainControllerIntegrationTests.groovy @@ -62,7 +62,7 @@ class MainControllerIntegrationTests extends AbstractInitializrControllerIntegra void simpleTgzProject() { downloadTgz('/starter.tgz?style=org.acme:foo').isJavaProject().isMavenProject() .hasStaticAndTemplatesResources(false).pomAssert() - .hasDependenciesCount(3) + .hasDependenciesCount(2) .hasDependency('org.acme', 'foo', '1.3.5') } @@ -72,7 +72,7 @@ class MainControllerIntegrationTests extends AbstractInitializrControllerIntegra artifactId: 'biz', version: '1.3.5', scope: 'runtime') downloadTgz('/starter.tgz?style=org.acme:biz&bootVersion=1.2.1.RELEASE').isJavaProject().isMavenProject() .hasStaticAndTemplatesResources(false).pomAssert() - .hasDependenciesCount(3) + .hasDependenciesCount(2) .hasDependency(biz) }