mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-25 21:22:58 +08:00
Remove support for style
See gh-959
This commit is contained in:
committed by
Stephane Nicoll
parent
23cc192813
commit
74e460a3a1
@@ -77,7 +77,6 @@ public class ProjectRequestDocumentFactory {
|
||||
|
||||
// Let's not rely on the resolved dependencies here
|
||||
List<String> dependencies = new ArrayList<>();
|
||||
dependencies.addAll(request.getStyle());
|
||||
dependencies.addAll(request.getDependencies());
|
||||
List<String> validDependencies = dependencies.stream()
|
||||
.filter((id) -> metadata.getDependencies().get(id) != null).collect(Collectors.toList());
|
||||
|
||||
@@ -200,7 +200,7 @@ public class DefaultProjectRequestToDescriptionConverter
|
||||
}
|
||||
|
||||
private void validateDependencies(ProjectRequest request, InitializrMetadata metadata) {
|
||||
List<String> dependencies = (!request.getStyle().isEmpty() ? request.getStyle() : request.getDependencies());
|
||||
List<String> dependencies = request.getDependencies();
|
||||
dependencies.forEach((dep) -> {
|
||||
Dependency dependency = metadata.getDependencies().get(dep);
|
||||
if (dependency == null) {
|
||||
@@ -242,7 +242,7 @@ public class DefaultProjectRequestToDescriptionConverter
|
||||
|
||||
private List<Dependency> getResolvedDependencies(ProjectRequest request, String springBootVersion,
|
||||
InitializrMetadata metadata) {
|
||||
List<String> depIds = (!request.getStyle().isEmpty() ? request.getStyle() : request.getDependencies());
|
||||
List<String> depIds = request.getDependencies();
|
||||
Version requestedVersion = Version.parse(springBootVersion);
|
||||
return depIds.stream().map((it) -> {
|
||||
Dependency dependency = metadata.getDependencies().get(it);
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class ProjectRequest {
|
||||
|
||||
private List<String> style = new ArrayList<>();
|
||||
|
||||
private List<String> dependencies = new ArrayList<>();
|
||||
|
||||
private String name;
|
||||
@@ -59,14 +57,6 @@ public class ProjectRequest {
|
||||
// The base directory to create in the archive - no baseDir by default
|
||||
private String baseDir;
|
||||
|
||||
public List<String> getStyle() {
|
||||
return this.style;
|
||||
}
|
||||
|
||||
public void setStyle(List<String> style) {
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
public List<String> getDependencies() {
|
||||
return this.dependencies;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ProjectGenerationControllerCustomDefaultsIntegrationTests extends Abstract
|
||||
|
||||
@Test
|
||||
void generateDefaultPom() {
|
||||
String content = getRestTemplate().getForObject(createUrl("/pom.xml?style=web"), String.class);
|
||||
String content = getRestTemplate().getForObject(createUrl("/pom.xml?dependencies=web"), String.class);
|
||||
MavenBuildAssert pomAssert = new MavenBuildAssert(content);
|
||||
pomAssert.hasGroupId("org.foo").hasArtifactId("foo-bar").hasVersion("1.2.4-SNAPSHOT")
|
||||
.doesNotHaveNode("/project/packaging").hasName("FooBar").hasDescription("FooBar Project");
|
||||
|
||||
@@ -35,7 +35,7 @@ class ProjectGenerationControllerCustomEnvIntegrationTests extends AbstractIniti
|
||||
|
||||
@Test
|
||||
void generateProjectWithInvalidName() {
|
||||
ProjectStructure project = downloadZip("/starter.zip?style=data-jpa&name=Invalid");
|
||||
ProjectStructure project = downloadZip("/starter.zip?dependencies=data-jpa&name=Invalid");
|
||||
assertThat(project).containsFiles("src/main/java/com/example/demo/FooBarApplication.java",
|
||||
"src/test/java/com/example/demo/FooBarApplicationTests.java");
|
||||
assertThat(project).doesNotContainFiles("src/main/java/com/example/demo/DemoApplication.java",
|
||||
|
||||
@@ -42,7 +42,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
|
||||
@Test
|
||||
void simpleZipProject() {
|
||||
ResponseEntity<byte[]> entity = downloadArchive("/starter.zip?style=web&style=jpa");
|
||||
ResponseEntity<byte[]> entity = downloadArchive("/starter.zip?dependencies=web&dependencies=jpa");
|
||||
assertArchiveResponseHeaders(entity, MediaType.valueOf("application/zip"), "demo.zip");
|
||||
ProjectStructure project = projectFromArchive(entity.getBody());
|
||||
assertDefaultProject(project);
|
||||
@@ -56,7 +56,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
|
||||
@Test
|
||||
void simpleTgzProject() {
|
||||
ResponseEntity<byte[]> entity = downloadArchive("/starter.tgz?style=org.acme:foo");
|
||||
ResponseEntity<byte[]> entity = downloadArchive("/starter.tgz?dependencies=org.acme:foo");
|
||||
assertArchiveResponseHeaders(entity, MediaType.valueOf("application/x-compress"), "demo.tar.gz");
|
||||
ProjectStructure project = tgzProjectAssert(entity.getBody());
|
||||
assertDefaultProject(project);
|
||||
@@ -74,7 +74,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void dependencyInRange() {
|
||||
Dependency biz = Dependency.create("org.acme", "biz", "1.3.5", "runtime");
|
||||
ProjectStructure project = downloadTgz("/starter.tgz?style=org.acme:biz&bootVersion=2.2.1.RELEASE");
|
||||
ProjectStructure project = downloadTgz("/starter.tgz?dependencies=org.acme:biz&bootVersion=2.2.1.RELEASE");
|
||||
assertDefaultProject(project);
|
||||
assertDoesNotHaveWebResources(project);
|
||||
assertThat(project).mavenBuild().hasDependenciesSize(3).hasDependency(biz);
|
||||
@@ -83,7 +83,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void dependencyNotInRange() {
|
||||
try {
|
||||
execute("/starter.tgz?style=org.acme:bur", byte[].class, null, (String[]) null);
|
||||
execute("/starter.tgz?dependencies=org.acme:bur", byte[].class, null, (String[]) null);
|
||||
}
|
||||
catch (HttpClientErrorException ex) {
|
||||
assertThat(ex.getStatusCode()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
|
||||
@@ -125,7 +125,8 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
|
||||
@Test
|
||||
void kotlinRange() {
|
||||
ProjectStructure project = downloadZip("/starter.zip?style=web&language=kotlin&bootVersion=2.0.1.RELEASE");
|
||||
ProjectStructure project = downloadZip(
|
||||
"/starter.zip?dependencies=web&language=kotlin&bootVersion=2.0.1.RELEASE");
|
||||
assertThat(project).containsFiles("src/main/kotlin/com/example/demo/DemoApplication.kt",
|
||||
"src/test/kotlin/com/example/demo/DemoApplicationTests.kt",
|
||||
"src/main/resources/application.properties");
|
||||
@@ -135,7 +136,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void gradleWarProject() {
|
||||
ProjectStructure project = downloadZip(
|
||||
"/starter.zip?style=web&style=security&packaging=war&type=gradle-project");
|
||||
"/starter.zip?dependencies=web&dependencies=security&packaging=war&type=gradle-project");
|
||||
assertThat(project).hasGroovyDslGradleBuild().hasGradleWrapper();
|
||||
assertThat(project).containsFiles("src/main/java/com/example/demo/DemoApplication.java",
|
||||
"src/main/java/com/example/demo/ServletInitializer.java",
|
||||
@@ -147,7 +148,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void missingDependencyProperException() {
|
||||
try {
|
||||
downloadArchive("/starter.zip?style=foo:bar");
|
||||
downloadArchive("/starter.zip?dependencies=foo:bar");
|
||||
fail("Should have failed");
|
||||
}
|
||||
catch (HttpClientErrorException ex) {
|
||||
@@ -160,7 +161,7 @@ class ProjectGenerationControllerIntegrationTests extends AbstractInitializrCont
|
||||
@Test
|
||||
void invalidDependencyProperException() {
|
||||
try {
|
||||
downloadArchive("/starter.zip?style=foo");
|
||||
downloadArchive("/starter.zip?dependencies=foo");
|
||||
fail("Should have failed");
|
||||
}
|
||||
catch (HttpClientErrorException ex) {
|
||||
|
||||
Reference in New Issue
Block a user