mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 13:43:15 +08:00
Extract project generation test utility to dedicated module
This commit extracts various test utilities to a dedicated initializr-generator-test module for easier consumption. The previous test-jar are no longer published and a dependency to this new module should be equivalent. This commit also cleans various resources that were located in the wrong place. In particular initializr-generator does not know anything about metadata anymore. Closes gh-988
This commit is contained in:
@@ -18,12 +18,12 @@ package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -138,7 +138,8 @@ class Gradle3BuildWriterTests {
|
||||
Gradle3BuildWriter writer = new Gradle3BuildWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
return TextTestUtils.readAllLines(out.toString());
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.Dependency.Exclusion;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import io.spring.initializr.generator.version.VersionProperty;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -433,7 +433,8 @@ class GroovyDslGradleBuildWriterTests {
|
||||
GradleBuildWriter writer = new GroovyDslGradleBuildWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
return TextTestUtils.readAllLines(out.toString());
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -88,7 +88,8 @@ class GroovyDslGradleSettingsWriterTests {
|
||||
GradleSettingsWriter writer = new GroovyDslGradleSettingsWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
return TextTestUtils.readAllLines(out.toString());
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.Dependency.Exclusion;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import io.spring.initializr.generator.version.VersionProperty;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -441,7 +441,8 @@ class KotlinDslGradleBuildWriterTests {
|
||||
GradleBuildWriter writer = new KotlinDslGradleBuildWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
return TextTestUtils.readAllLines(out.toString());
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ package io.spring.initializr.generator.buildsystem.gradle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -87,7 +87,8 @@ class KotlinDslGradleSettingsWriterTests {
|
||||
GradleSettingsWriter writer = new KotlinDslGradleSettingsWriter();
|
||||
StringWriter out = new StringWriter();
|
||||
writer.writeTo(new IndentingWriter(out), build);
|
||||
return TextTestUtils.readAllLines(out.toString());
|
||||
String[] lines = out.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.buildsystem.Dependency.Exclusion;
|
||||
import io.spring.initializr.generator.buildsystem.DependencyScope;
|
||||
import io.spring.initializr.generator.io.IndentingWriter;
|
||||
import io.spring.initializr.generator.test.assertj.NodeAssert;
|
||||
import io.spring.initializr.generator.version.VersionProperty;
|
||||
import io.spring.initializr.generator.version.VersionReference;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package io.spring.initializr.generator.test.assertj;
|
||||
package io.spring.initializr.generator.buildsystem.maven;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -41,7 +40,7 @@ import org.w3c.dom.NodeList;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class NodeAssert extends AbstractAssert<NodeAssert, Node> implements AssertProvider<NodeAssert> {
|
||||
class NodeAssert extends AbstractAssert<NodeAssert, Node> implements AssertProvider<NodeAssert> {
|
||||
|
||||
private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance();
|
||||
|
||||
@@ -49,27 +48,14 @@ public class NodeAssert extends AbstractAssert<NodeAssert, Node> implements Asse
|
||||
|
||||
private final XPath xpath = this.xpathFactory.newXPath();
|
||||
|
||||
public NodeAssert(Path xmlFile) {
|
||||
this(read(xmlFile));
|
||||
}
|
||||
|
||||
public NodeAssert(String xmlContent) {
|
||||
NodeAssert(String xmlContent) {
|
||||
this(read(xmlContent));
|
||||
}
|
||||
|
||||
public NodeAssert(Node actual) {
|
||||
NodeAssert(Node actual) {
|
||||
super(actual, NodeAssert.class);
|
||||
}
|
||||
|
||||
private static Document read(Path xmlFile) {
|
||||
try {
|
||||
return FACTORY.newDocumentBuilder().parse(xmlFile.toFile());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static Document read(String xmlContent) {
|
||||
try {
|
||||
return FACTORY.newDocumentBuilder()
|
||||
@@ -80,7 +66,7 @@ public class NodeAssert extends AbstractAssert<NodeAssert, Node> implements Asse
|
||||
}
|
||||
}
|
||||
|
||||
public NodeAssert nodeAtPath(String xpath) {
|
||||
NodeAssert nodeAtPath(String xpath) {
|
||||
try {
|
||||
return new NodeAssert((Node) this.xpath.evaluate(xpath, this.actual, XPathConstants.NODE));
|
||||
}
|
||||
@@ -89,7 +75,7 @@ public class NodeAssert extends AbstractAssert<NodeAssert, Node> implements Asse
|
||||
}
|
||||
}
|
||||
|
||||
public ListAssert<Node> nodesAtPath(String xpath) {
|
||||
ListAssert<Node> nodesAtPath(String xpath) {
|
||||
try {
|
||||
NodeList nodeList = (NodeList) this.xpath.evaluate(xpath, this.actual, XPathConstants.NODESET);
|
||||
return new ListAssert<>(toList(nodeList));
|
||||
@@ -99,7 +85,7 @@ public class NodeAssert extends AbstractAssert<NodeAssert, Node> implements Asse
|
||||
}
|
||||
}
|
||||
|
||||
public StringAssert textAtPath(String xpath) {
|
||||
StringAssert textAtPath(String xpath) {
|
||||
try {
|
||||
return new StringAssert(
|
||||
(String) this.xpath.evaluate(xpath + "/text()", this.actual, XPathConstants.STRING));
|
||||
@@ -21,7 +21,8 @@ import java.util.Map;
|
||||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuildSystem;
|
||||
import io.spring.initializr.generator.buildsystem.maven.MavenBuildSystem;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.test.project.ProjectAssetTester;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -36,8 +37,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class ConditionalOnBuildSystemTests {
|
||||
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester();
|
||||
|
||||
@Test
|
||||
void outcomeWithMavenBuildSystem() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
@@ -61,8 +60,12 @@ class ConditionalOnBuildSystemTests {
|
||||
}
|
||||
|
||||
private Map<String, String> candidatesFor(ProjectDescription projectDescription, Class<?>... extraConfigurations) {
|
||||
return this.projectTester.withConfiguration(extraConfigurations).generate(projectDescription,
|
||||
(projectGenerationContext) -> projectGenerationContext.getBeansOfType(String.class));
|
||||
try (ProjectGenerationContext context = new ProjectGenerationContext()) {
|
||||
context.registerBean(ResolvedProjectDescription.class, projectDescription::resolve);
|
||||
context.register(extraConfigurations);
|
||||
context.refresh();
|
||||
return context.getBeansOfType(String.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
package io.spring.initializr.generator.condition;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.spring.initializr.generator.language.groovy.GroovyLanguage;
|
||||
import io.spring.initializr.generator.language.java.JavaLanguage;
|
||||
import io.spring.initializr.generator.language.kotlin.KotlinLanguage;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.test.project.ProjectAssetTester;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -35,49 +38,46 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class ConditionalOnLanguageTests {
|
||||
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester()
|
||||
.withConfiguration(LanguageTestConfiguration.class);
|
||||
|
||||
@Test
|
||||
void outcomeWithJavaLanguage() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.setLanguage(new JavaLanguage());
|
||||
String bean = outcomeFor(projectDescription);
|
||||
assertThat(bean).isEqualTo("testJava");
|
||||
assertCondition(projectDescription, (context) -> {
|
||||
assertThat(context.getBeansOfType(String.class)).hasSize(1);
|
||||
assertThat(context.getBean(String.class)).isEqualTo("testJava");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithGroovyBuildSystem() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.setLanguage(new GroovyLanguage());
|
||||
String bean = outcomeFor(projectDescription);
|
||||
assertThat(bean).isEqualTo("testGroovy");
|
||||
assertCondition(projectDescription, (context) -> {
|
||||
assertThat(context.getBeansOfType(String.class)).hasSize(1);
|
||||
assertThat(context.getBean(String.class)).isEqualTo("testGroovy");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithNoMatch() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.setLanguage(new KotlinLanguage());
|
||||
this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).isEmpty();
|
||||
return null;
|
||||
});
|
||||
assertCondition(projectDescription, (context) -> assertThat(context.getBeansOfType(String.class)).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithNoAvailableLanguage() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).isEmpty();
|
||||
return null;
|
||||
});
|
||||
assertCondition(projectDescription, (context) -> assertThat(context.getBeansOfType(String.class)).isEmpty());
|
||||
}
|
||||
|
||||
private String outcomeFor(ProjectDescription projectDescription) {
|
||||
return this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).hasSize(1);
|
||||
return projectGenerationContext.getBean(String.class);
|
||||
});
|
||||
private void assertCondition(ProjectDescription projectDescription, Consumer<ProjectGenerationContext> context) {
|
||||
try (ProjectGenerationContext projectContext = new ProjectGenerationContext()) {
|
||||
projectContext.registerBean(ResolvedProjectDescription.class, projectDescription::resolve);
|
||||
projectContext.register(LanguageTestConfiguration.class);
|
||||
projectContext.refresh();
|
||||
context.accept(projectContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
|
||||
package io.spring.initializr.generator.condition;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.spring.initializr.generator.packaging.jar.JarPackaging;
|
||||
import io.spring.initializr.generator.packaging.war.WarPackaging;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.test.project.ProjectAssetTester;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -34,39 +37,39 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class ConditionalOnPackagingTests {
|
||||
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester()
|
||||
.withConfiguration(PackagingTestConfiguration.class);
|
||||
|
||||
@Test
|
||||
void outcomeWithJarPackaging() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.setPackaging(new JarPackaging());
|
||||
String bean = outcomeFor(projectDescription);
|
||||
assertThat(bean).isEqualTo("testJar");
|
||||
assertCondition(projectDescription, (context) -> {
|
||||
assertThat(context.getBeansOfType(String.class)).hasSize(1);
|
||||
assertThat(context.getBean(String.class)).isEqualTo("testJar");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithWarPackaging() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.setPackaging(new WarPackaging());
|
||||
String bean = outcomeFor(projectDescription);
|
||||
assertThat(bean).isEqualTo("testWar");
|
||||
assertCondition(projectDescription, (context) -> {
|
||||
assertThat(context.getBeansOfType(String.class)).hasSize(1);
|
||||
assertThat(context.getBean(String.class)).isEqualTo("testWar");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithNoAvailablePackaging() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).isEmpty();
|
||||
return null;
|
||||
});
|
||||
assertCondition(projectDescription, (context) -> assertThat(context.getBeansOfType(String.class)).isEmpty());
|
||||
}
|
||||
|
||||
private String outcomeFor(ProjectDescription projectDescription) {
|
||||
return this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).hasSize(1);
|
||||
return projectGenerationContext.getBean(String.class);
|
||||
});
|
||||
private void assertCondition(ProjectDescription projectDescription, Consumer<ProjectGenerationContext> context) {
|
||||
try (ProjectGenerationContext projectContext = new ProjectGenerationContext()) {
|
||||
projectContext.registerBean(ResolvedProjectDescription.class, projectDescription::resolve);
|
||||
projectContext.register(PackagingTestConfiguration.class);
|
||||
projectContext.refresh();
|
||||
context.accept(projectContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -19,7 +19,8 @@ package io.spring.initializr.generator.condition;
|
||||
import java.util.Map;
|
||||
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.test.project.ProjectAssetTester;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import io.spring.initializr.generator.version.Version;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -35,9 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class ConditionalOnPlatformVersionTests {
|
||||
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester()
|
||||
.withConfiguration(PlatformVersionTestConfiguration.class);
|
||||
|
||||
@Test
|
||||
void outcomeWithMatchingRange() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
@@ -91,8 +89,13 @@ class ConditionalOnPlatformVersionTests {
|
||||
}
|
||||
|
||||
private Map<String, String> candidatesFor(ProjectDescription projectDescription, Class<?>... extraConfigurations) {
|
||||
return this.projectTester.withConfiguration(extraConfigurations).generate(projectDescription,
|
||||
(projectGenerationContext) -> projectGenerationContext.getBeansOfType(String.class));
|
||||
try (ProjectGenerationContext context = new ProjectGenerationContext()) {
|
||||
context.registerBean(ResolvedProjectDescription.class, projectDescription::resolve);
|
||||
context.register(PlatformVersionTestConfiguration.class);
|
||||
context.register(extraConfigurations);
|
||||
context.refresh();
|
||||
return context.getBeansOfType(String.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -16,9 +16,12 @@
|
||||
|
||||
package io.spring.initializr.generator.condition;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.Dependency;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.test.project.ProjectAssetTester;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -34,28 +37,30 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
class ConditionalOnRequestedDependencyTests {
|
||||
|
||||
private final ProjectAssetTester projectTester = new ProjectAssetTester()
|
||||
.withConfiguration(RequestedDependencyTestConfiguration.class);
|
||||
|
||||
@Test
|
||||
void outcomeWithMatchingDependency() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.addDependency("web", mock(Dependency.class));
|
||||
String bean = this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).hasSize(1);
|
||||
return projectGenerationContext.getBean(String.class);
|
||||
assertCondition(projectDescription, (context) -> {
|
||||
assertThat(context.getBeansOfType(String.class)).hasSize(1);
|
||||
assertThat(context.getBean(String.class)).isEqualTo("webDependency");
|
||||
});
|
||||
assertThat(bean).isEqualTo("webDependency");
|
||||
}
|
||||
|
||||
@Test
|
||||
void outcomeWithNoMatch() {
|
||||
ProjectDescription projectDescription = new ProjectDescription();
|
||||
projectDescription.addDependency("another", mock(Dependency.class));
|
||||
this.projectTester.generate(projectDescription, (projectGenerationContext) -> {
|
||||
assertThat(projectGenerationContext.getBeansOfType(String.class)).isEmpty();
|
||||
return null;
|
||||
});
|
||||
assertCondition(projectDescription, (context) -> assertThat(context.getBeansOfType(String.class)).isEmpty());
|
||||
}
|
||||
|
||||
private void assertCondition(ProjectDescription projectDescription, Consumer<ProjectGenerationContext> context) {
|
||||
try (ProjectGenerationContext projectContext = new ProjectGenerationContext()) {
|
||||
projectContext.registerBean(ResolvedProjectDescription.class, projectDescription::resolve);
|
||||
projectContext.register(RequestedDependencyTestConfiguration.class);
|
||||
projectContext.refresh();
|
||||
context.accept(projectContext);
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -18,9 +18,9 @@ package io.spring.initializr.generator.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -92,7 +92,8 @@ class IndentingWriterTests {
|
||||
}
|
||||
|
||||
private List<String> readLines() {
|
||||
return TextTestUtils.readAllLines(this.stringWriter.toString());
|
||||
String[] lines = this.stringWriter.toString().split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
package io.spring.initializr.generator.language.groovy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -27,10 +31,11 @@ import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.language.Annotation;
|
||||
import io.spring.initializr.generator.language.Parameter;
|
||||
import io.spring.initializr.generator.language.SourceStructure;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
@@ -273,7 +278,10 @@ class GroovySourceCodeWriterTests {
|
||||
|
||||
private List<String> writeSingleType(GroovySourceCode sourceCode, String location) throws IOException {
|
||||
Path source = writeSourceCode(sourceCode).resolve(location);
|
||||
return TextTestUtils.readAllLines(source);
|
||||
try (InputStream stream = Files.newInputStream(source)) {
|
||||
String[] lines = StreamUtils.copyToString(stream, StandardCharsets.UTF_8).split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
}
|
||||
|
||||
private Path writeSourceCode(GroovySourceCode sourceCode) throws IOException {
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
package io.spring.initializr.generator.language.java;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -27,10 +31,11 @@ import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.language.Annotation;
|
||||
import io.spring.initializr.generator.language.Parameter;
|
||||
import io.spring.initializr.generator.language.SourceStructure;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
@@ -274,7 +279,10 @@ class JavaSourceCodeWriterTests {
|
||||
|
||||
private List<String> writeSingleType(JavaSourceCode sourceCode, String location) throws IOException {
|
||||
Path source = writeSourceCode(sourceCode).resolve(location);
|
||||
return TextTestUtils.readAllLines(source);
|
||||
try (InputStream stream = Files.newInputStream(source)) {
|
||||
String[] lines = StreamUtils.copyToString(stream, StandardCharsets.UTF_8).split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
}
|
||||
|
||||
private Path writeSourceCode(JavaSourceCode sourceCode) throws IOException {
|
||||
|
||||
@@ -17,8 +17,12 @@
|
||||
package io.spring.initializr.generator.language.kotlin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -26,10 +30,11 @@ import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.language.Annotation;
|
||||
import io.spring.initializr.generator.language.Parameter;
|
||||
import io.spring.initializr.generator.language.SourceStructure;
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
@@ -331,7 +336,10 @@ class KotlinSourceCodeWriterTests {
|
||||
|
||||
private List<String> writeSingleType(KotlinSourceCode sourceCode, String location) throws IOException {
|
||||
Path source = writeSourceCode(sourceCode).resolve(location);
|
||||
return TextTestUtils.readAllLines(source);
|
||||
try (InputStream stream = Files.newInputStream(source)) {
|
||||
String[] lines = StreamUtils.copyToString(stream, StandardCharsets.UTF_8).split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
}
|
||||
|
||||
private Path writeSourceCode(KotlinSourceCode sourceCode) throws IOException {
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.project;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import io.spring.initializr.generator.buildsystem.maven.MavenBuildSystem;
|
||||
import io.spring.initializr.generator.project.contributor.ProjectContributor;
|
||||
import io.spring.initializr.generator.test.project.ProjectGeneratorTester;
|
||||
import io.spring.initializr.generator.test.project.ProjectStructure;
|
||||
import io.spring.initializr.generator.version.Version;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link ProjectGenerator}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
class ProjectGeneratorTests {
|
||||
|
||||
private final ProjectGeneratorTester projectTester = new ProjectGeneratorTester()
|
||||
.withDescriptionCustomizer((description) -> {
|
||||
description.setBuildSystem(new MavenBuildSystem());
|
||||
description.setPlatformVersion(Version.parse("2.1.0.RELEASE"));
|
||||
});
|
||||
|
||||
@Test
|
||||
void generateInvokedProcessor() {
|
||||
ProjectDescription description = new ProjectDescription();
|
||||
description.setBuildSystem(new MavenBuildSystem());
|
||||
Version platformVersion = Version.parse("2.1.0.RELEASE");
|
||||
description.setPackageName("com.example.test");
|
||||
ResolvedProjectDescription resolvedProjectDescription = this.projectTester.generate(description,
|
||||
(projectGenerationContext) -> projectGenerationContext.getBean(ResolvedProjectDescription.class));
|
||||
assertThat(resolvedProjectDescription.getPlatformVersion()).isEqualTo(platformVersion);
|
||||
assertThat(resolvedProjectDescription.getPackageName()).isEqualTo("com.example.test");
|
||||
}
|
||||
|
||||
@Test
|
||||
void generateInvokesCustomizers() {
|
||||
ProjectGeneratorTester tester = this.projectTester.withContextInitializer((context) -> {
|
||||
context.registerBean("customizer1", TestProjectDescriptionCustomizer.class,
|
||||
() -> new TestProjectDescriptionCustomizer(5, (description) -> description.setName("Test")));
|
||||
context.registerBean("customizer2", TestProjectDescriptionCustomizer.class,
|
||||
() -> new TestProjectDescriptionCustomizer(3, (description) -> {
|
||||
description.setName("First");
|
||||
description.setGroupId("com.acme");
|
||||
}));
|
||||
});
|
||||
ProjectDescription description = new ProjectDescription();
|
||||
description.setGroupId("com.example.demo");
|
||||
description.setName("Original");
|
||||
|
||||
ResolvedProjectDescription resolvedProjectDescription = tester.generate(description,
|
||||
(projectGenerationContext) -> projectGenerationContext.getBean(ResolvedProjectDescription.class));
|
||||
assertThat(resolvedProjectDescription.getGroupId()).isEqualTo("com.acme");
|
||||
assertThat(resolvedProjectDescription.getName()).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@Test
|
||||
void generateInvokeProjectContributors(@TempDir Path directory) {
|
||||
ProjectGeneratorTester tester = this.projectTester.withDirectory(directory)
|
||||
.withContextInitializer((context) -> {
|
||||
context.registerBean("contributor1", ProjectContributor.class,
|
||||
() -> (projectDirectory) -> Files.createFile(projectDirectory.resolve("test.text")));
|
||||
context.registerBean("contributor2", ProjectContributor.class, () -> (projectDirectory) -> {
|
||||
Path subDir = projectDirectory.resolve("src/main/test");
|
||||
Files.createDirectories(subDir);
|
||||
Files.createFile(subDir.resolve("Test.src"));
|
||||
});
|
||||
});
|
||||
ProjectStructure projectStructure = tester.generate(new ProjectDescription());
|
||||
assertThat(projectStructure.getRelativePathsOfProjectFiles()).containsOnly("test.text",
|
||||
"src/main/test/Test.src");
|
||||
}
|
||||
|
||||
private static class TestProjectDescriptionCustomizer implements ProjectDescriptionCustomizer {
|
||||
|
||||
private final Integer order;
|
||||
|
||||
private final Consumer<ProjectDescription> projectDescription;
|
||||
|
||||
TestProjectDescriptionCustomizer(Integer order, Consumer<ProjectDescription> projectDescription) {
|
||||
this.order = order;
|
||||
this.projectDescription = projectDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(ProjectDescription description) {
|
||||
this.projectDescription.accept(description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.test.io;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Text content related test utilities.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public final class TextTestUtils {
|
||||
|
||||
private TextTestUtils() {
|
||||
}
|
||||
|
||||
public static List<String> readAllLines(String source) {
|
||||
String[] lines = source.split("\\r?\\n");
|
||||
return Arrays.asList(lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read all lines from the specified {@link Path source}. Check the given
|
||||
* {@code source} is a regular file that ends with a new line.
|
||||
* @param source a text file
|
||||
* @return all lines from the file
|
||||
*/
|
||||
public static List<String> readAllLines(Path source) {
|
||||
String content = readContent(source);
|
||||
assertThat(content).endsWith(System.lineSeparator());
|
||||
return readAllLines(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the content from the specified {@link Path source}. Check the given
|
||||
* {@code source} is a regular file.
|
||||
* @param source a text file
|
||||
* @return the content of the file
|
||||
*/
|
||||
public static String readContent(Path source) {
|
||||
assertThat(source).isRegularFile();
|
||||
try {
|
||||
BufferedReader reader = Files.newBufferedReader(source, StandardCharsets.UTF_8);
|
||||
StringWriter writer = new StringWriter();
|
||||
FileCopyUtils.copy(reader, writer);
|
||||
return writer.toString();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.test.project;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.io.SimpleIndentStrategy;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.project.ProjectDirectoryFactory;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationException;
|
||||
|
||||
/**
|
||||
* Base tester for project generation.
|
||||
*
|
||||
* @param <SELF> concrete type of the tester
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public abstract class AbstractProjectGenerationTester<SELF extends AbstractProjectGenerationTester<SELF>> {
|
||||
|
||||
private final Map<Class<?>, Supplier<?>> beanDefinitions;
|
||||
|
||||
private final Consumer<ProjectGenerationContext> contextInitializer;
|
||||
|
||||
private final Consumer<ProjectDescription> descriptionCustomizer;
|
||||
|
||||
protected AbstractProjectGenerationTester(Map<Class<?>, Supplier<?>> beanDefinitions) {
|
||||
this(beanDefinitions, defaultContextInitializer(), defaultDescriptionCustomizer());
|
||||
}
|
||||
|
||||
protected AbstractProjectGenerationTester(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer) {
|
||||
this.beanDefinitions = new LinkedHashMap<>(beanDefinitions);
|
||||
this.descriptionCustomizer = descriptionCustomizer;
|
||||
this.contextInitializer = contextInitializer;
|
||||
}
|
||||
|
||||
protected abstract SELF newInstance(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer);
|
||||
|
||||
public <T> SELF withBean(Class<T> beanType, Supplier<T> beanDefinition) {
|
||||
LinkedHashMap<Class<?>, Supplier<?>> beans = new LinkedHashMap<>(this.beanDefinitions);
|
||||
beans.put(beanType, beanDefinition);
|
||||
return newInstance(beans, this.contextInitializer, this.descriptionCustomizer);
|
||||
}
|
||||
|
||||
public SELF withDirectory(Path directory) {
|
||||
return withBean(ProjectDirectoryFactory.class,
|
||||
() -> (description) -> Files.createTempDirectory(directory, "project-"));
|
||||
}
|
||||
|
||||
public SELF withIndentingWriterFactory() {
|
||||
return withBean(IndentingWriterFactory.class,
|
||||
() -> IndentingWriterFactory.create(new SimpleIndentStrategy(" ")));
|
||||
}
|
||||
|
||||
public SELF withContextInitializer(Consumer<ProjectGenerationContext> context) {
|
||||
return newInstance(this.beanDefinitions, this.contextInitializer.andThen(context), this.descriptionCustomizer);
|
||||
}
|
||||
|
||||
public SELF withDescriptionCustomizer(Consumer<ProjectDescription> description) {
|
||||
return newInstance(this.beanDefinitions, this.contextInitializer,
|
||||
this.descriptionCustomizer.andThen(description));
|
||||
}
|
||||
|
||||
protected static Consumer<ProjectGenerationContext> defaultContextInitializer() {
|
||||
return (context) -> {
|
||||
};
|
||||
}
|
||||
|
||||
protected static Consumer<ProjectDescription> defaultDescriptionCustomizer() {
|
||||
return (projectDescription) -> {
|
||||
if (projectDescription.getGroupId() == null) {
|
||||
projectDescription.setGroupId("com.example");
|
||||
}
|
||||
if (projectDescription.getArtifactId() == null) {
|
||||
projectDescription.setArtifactId("demo");
|
||||
}
|
||||
if (projectDescription.getVersion() == null) {
|
||||
projectDescription.setVersion("0.0.1-SNAPSHOT");
|
||||
}
|
||||
if (projectDescription.getApplicationName() == null) {
|
||||
projectDescription.setApplicationName("DemoApplication");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected <T> T invokeProjectGeneration(ProjectDescription description, ProjectGenerationInvoker<T> invoker) {
|
||||
this.descriptionCustomizer.accept(description);
|
||||
try {
|
||||
return invoker.generate(beansConfigurer().andThen(this.contextInitializer));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new ProjectGenerationException("Failed to generated project", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private Consumer<ProjectGenerationContext> beansConfigurer() {
|
||||
return (context) -> this.beanDefinitions
|
||||
.forEach((type, definition) -> register(context, type, definition.get()));
|
||||
}
|
||||
|
||||
// Restore proper generic signature to make sure the context resolve the bean properly
|
||||
private <T> void register(ProjectGenerationContext context, Class<T> type, Object instance) {
|
||||
T bean = type.cast(instance);
|
||||
context.registerBean(type, () -> bean);
|
||||
}
|
||||
|
||||
protected interface ProjectGenerationInvoker<T> {
|
||||
|
||||
T generate(Consumer<ProjectGenerationContext> contextInitializer) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.test.project;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.spring.initializr.generator.project.ProjectAssetGenerator;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.project.ProjectDirectoryFactory;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ResolvedProjectDescription;
|
||||
import io.spring.initializr.generator.project.contributor.ProjectContributor;
|
||||
|
||||
/**
|
||||
* A tester for project asset that does not detect available {@link ProjectContributor
|
||||
* contributors}. By default, no contributor is available and can be added using a
|
||||
* {@link #withConfiguration(Class[]) configuration class} or a
|
||||
* {@link #withContextInitializer(Consumer) customization of the project generation
|
||||
* context}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectAssetTester extends AbstractProjectGenerationTester<ProjectAssetTester> {
|
||||
|
||||
public ProjectAssetTester() {
|
||||
super(Collections.emptyMap());
|
||||
}
|
||||
|
||||
private ProjectAssetTester(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer) {
|
||||
super(beanDefinitions, contextInitializer, descriptionCustomizer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProjectAssetTester newInstance(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer) {
|
||||
return new ProjectAssetTester(beanDefinitions, contextInitializer, descriptionCustomizer);
|
||||
}
|
||||
|
||||
public ProjectAssetTester withConfiguration(Class<?>... configurationClasses) {
|
||||
return withContextInitializer((context) -> context.register(configurationClasses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a project asset using the specified {@link ProjectAssetGenerator}.
|
||||
* @param description the description of the project to generate
|
||||
* @param projectAssetGenerator the {@link ProjectAssetGenerator} to invoke
|
||||
* @param <T> the project asset type
|
||||
* @return the project asset
|
||||
* @see #withConfiguration(Class[])
|
||||
*/
|
||||
public <T> T generate(ProjectDescription description, ProjectAssetGenerator<T> projectAssetGenerator) {
|
||||
return invokeProjectGeneration(description, (contextInitializer) -> {
|
||||
try (ProjectGenerationContext context = new ProjectGenerationContext()) {
|
||||
ResolvedProjectDescription resolvedProjectDescription = new ResolvedProjectDescription(description);
|
||||
context.registerBean(ResolvedProjectDescription.class, () -> resolvedProjectDescription);
|
||||
contextInitializer.accept(context);
|
||||
context.refresh();
|
||||
return projectAssetGenerator.generate(context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a project structure using only explicitly configured
|
||||
* {@link ProjectContributor contributors}.
|
||||
* @param description the description of the project to generateProject
|
||||
* @return the {@link ProjectStructure} of the generated project
|
||||
* @see #withConfiguration(Class[])
|
||||
*/
|
||||
public ProjectStructure generate(ProjectDescription description) {
|
||||
return generate(description, runAllAvailableContributors());
|
||||
}
|
||||
|
||||
private ProjectAssetGenerator<ProjectStructure> runAllAvailableContributors() {
|
||||
return (context) -> {
|
||||
Path projectDirectory = context.getBean(ProjectDirectoryFactory.class)
|
||||
.createProjectDirectory(context.getBean(ResolvedProjectDescription.class));
|
||||
List<ProjectContributor> projectContributors = context.getBeanProvider(ProjectContributor.class)
|
||||
.orderedStream().collect(Collectors.toList());
|
||||
for (ProjectContributor projectContributor : projectContributors) {
|
||||
projectContributor.contribute(projectDirectory);
|
||||
}
|
||||
return new ProjectStructure(projectDirectory);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.test.project;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import io.spring.initializr.generator.io.IndentingWriterFactory;
|
||||
import io.spring.initializr.generator.io.SimpleIndentStrategy;
|
||||
import io.spring.initializr.generator.io.template.MustacheTemplateRenderer;
|
||||
import io.spring.initializr.generator.project.DefaultProjectAssetGenerator;
|
||||
import io.spring.initializr.generator.project.ProjectAssetGenerator;
|
||||
import io.spring.initializr.generator.project.ProjectDescription;
|
||||
import io.spring.initializr.generator.project.ProjectGenerationContext;
|
||||
import io.spring.initializr.generator.project.ProjectGenerator;
|
||||
|
||||
/**
|
||||
* A tester class for {@link ProjectGenerator}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectGeneratorTester extends AbstractProjectGenerationTester<ProjectGeneratorTester> {
|
||||
|
||||
private ProjectGeneratorTester(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer) {
|
||||
super(beanDefinitions, contextInitializer, descriptionCustomizer);
|
||||
}
|
||||
|
||||
public ProjectGeneratorTester() {
|
||||
super(defaultBeans());
|
||||
}
|
||||
|
||||
private static Map<Class<?>, Supplier<?>> defaultBeans() {
|
||||
Map<Class<?>, Supplier<?>> beans = new HashMap<>();
|
||||
beans.put(IndentingWriterFactory.class, () -> IndentingWriterFactory.create(new SimpleIndentStrategy(" ")));
|
||||
beans.put(MustacheTemplateRenderer.class, () -> new MustacheTemplateRenderer("classpath:/templates"));
|
||||
return beans;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProjectGeneratorTester newInstance(Map<Class<?>, Supplier<?>> beanDefinitions,
|
||||
Consumer<ProjectGenerationContext> contextInitializer, Consumer<ProjectDescription> descriptionCustomizer) {
|
||||
return new ProjectGeneratorTester(beanDefinitions, contextInitializer, descriptionCustomizer);
|
||||
}
|
||||
|
||||
public ProjectStructure generate(ProjectDescription description) {
|
||||
return invokeProjectGeneration(description, (contextInitializer) -> {
|
||||
Path directory = new ProjectGenerator(contextInitializer).generate(description,
|
||||
new DefaultProjectAssetGenerator());
|
||||
return new ProjectStructure(directory);
|
||||
});
|
||||
}
|
||||
|
||||
public <T> T generate(ProjectDescription description, ProjectAssetGenerator<T> projectAssetGenerator) {
|
||||
return invokeProjectGeneration(description, (contextInitializer) -> new ProjectGenerator(contextInitializer)
|
||||
.generate(description, projectAssetGenerator));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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
|
||||
*
|
||||
* https://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 io.spring.initializr.generator.test.project;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.spring.initializr.generator.test.io.TextTestUtils;
|
||||
|
||||
/**
|
||||
* Test helper to assert content of a generated project structure.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectStructure {
|
||||
|
||||
private final Path projectDirectory;
|
||||
|
||||
/**
|
||||
* Create an instance based on the specified project {@link Path directory}.
|
||||
* @param projectDirectory the project's root directory
|
||||
*/
|
||||
public ProjectStructure(Path projectDirectory) {
|
||||
this.projectDirectory = projectDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the project directory.
|
||||
* @return the project directory
|
||||
*/
|
||||
public Path getProjectDirectory() {
|
||||
return this.projectDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a {@link Path} relative to the project directory.
|
||||
* @param other the path string to resolve against the root of the project structure
|
||||
* @return the resulting path
|
||||
* @see Path#resolve(String)
|
||||
*/
|
||||
public Path resolve(String other) {
|
||||
return this.projectDirectory.resolve(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a {@link Path} relative to the project directory and return all lines.
|
||||
* Check that the resolved {@link Path} is a regular text file that ends with a
|
||||
* newline.
|
||||
* @param other the path string to resolve against the root of the project structure
|
||||
* @return all lines from the resolve file
|
||||
* @see TextTestUtils#readAllLines(Path)
|
||||
*/
|
||||
public List<String> readAllLines(String other) {
|
||||
return TextTestUtils.readAllLines(resolve(other));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relative paths of all files. For consistency, always use {@code /} as
|
||||
* path separator.
|
||||
* @return the relative path of all files
|
||||
*/
|
||||
public List<String> getRelativePathsOfProjectFiles() {
|
||||
List<String> relativePaths = new ArrayList<>();
|
||||
try {
|
||||
Files.walkFileTree(this.projectDirectory, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
relativePaths.add(createRelativePath(file));
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
return relativePaths;
|
||||
}
|
||||
|
||||
private String createRelativePath(Path file) {
|
||||
String relativePath = this.projectDirectory.relativize(file).toString();
|
||||
if (FileSystems.getDefault().getSeparator().equals("\\")) {
|
||||
return relativePath.replace('\\', '/');
|
||||
}
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
initializr:
|
||||
groupId:
|
||||
value: org.foo
|
||||
artifactId:
|
||||
value: foo-bar
|
||||
version:
|
||||
value: 1.2.4-SNAPSHOT
|
||||
name:
|
||||
value: FooBar
|
||||
description:
|
||||
value: FooBar Project
|
||||
packageName:
|
||||
value: org.foo.demo
|
||||
@@ -1,9 +0,0 @@
|
||||
initializr:
|
||||
env:
|
||||
artifactRepository: https://repo.spring.io/lib-release
|
||||
google-analytics-tracking-code: UA-1234567-89
|
||||
fallbackApplicationName: FooBarApplication
|
||||
invalidApplicationNames:
|
||||
- InvalidApplication
|
||||
kotlin:
|
||||
default-version: 1.0.0-beta-2423
|
||||
@@ -1,163 +0,0 @@
|
||||
info:
|
||||
spring-boot:
|
||||
version: 2.1.4.RELEASE
|
||||
|
||||
initializr:
|
||||
env:
|
||||
boms:
|
||||
my-api-bom:
|
||||
groupId: org.acme
|
||||
artifactId: my-api-bom
|
||||
versionProperty: my-api.version
|
||||
additionalBoms: ['my-api-dependencies-bom']
|
||||
mappings:
|
||||
- compatibilityRange: "[2.0.0.RELEASE,2.1.6.RELEASE)"
|
||||
version: 1.0.0.RELEASE
|
||||
repositories: my-api-repo-1
|
||||
- compatibilityRange: "2.2.1.RELEASE"
|
||||
version: 2.0.0.RELEASE
|
||||
repositories: my-api-repo-2
|
||||
my-api-dependencies-bom:
|
||||
groupId: org.acme
|
||||
artifactId: my-api-dependencies-bom
|
||||
version: 1.0.0.RELEASE
|
||||
repositories: my-api-repo-3
|
||||
kotlin:
|
||||
defaultVersion: 1.2
|
||||
mappings:
|
||||
- compatibilityRange: "[1.5.0.RELEASE,2.0.0.M1)"
|
||||
version: 1.0
|
||||
- compatibilityRange: "[2.0.0.M1,2.1.0.M1)"
|
||||
version: 1.1
|
||||
repositories:
|
||||
my-api-repo-1:
|
||||
name: repo1
|
||||
url: https://example.com/repo1
|
||||
my-api-repo-2:
|
||||
name: repo2
|
||||
url: https://example.com/repo2
|
||||
my-api-repo-3:
|
||||
name: repo3
|
||||
url: https://example.com/repo3
|
||||
dependencies:
|
||||
- name: Core
|
||||
content:
|
||||
- name: Web
|
||||
id: web
|
||||
description: Web dependency description
|
||||
facets:
|
||||
- web
|
||||
links:
|
||||
- rel: guide
|
||||
href: https://example.com/guide
|
||||
description: Building a RESTful Web Service
|
||||
- rel: reference
|
||||
href: https://example.com/doc
|
||||
- name: Security
|
||||
id: security
|
||||
- name: Data JPA
|
||||
id: data-jpa
|
||||
aliases:
|
||||
- jpa
|
||||
- name: Other
|
||||
content:
|
||||
- name: Foo
|
||||
groupId: org.acme
|
||||
artifactId: foo
|
||||
version: 1.3.5
|
||||
weight: 42
|
||||
keywords:
|
||||
- thefoo
|
||||
- dafoo
|
||||
links:
|
||||
- rel: guide
|
||||
href: https://example.com/guide1
|
||||
- rel: reference
|
||||
href: https://example.com/{bootVersion}/doc
|
||||
- rel: guide
|
||||
href: https://example.com/guide2
|
||||
description: Some guide for foo
|
||||
- name: Bar
|
||||
id: org.acme:bar
|
||||
version: 2.1.0
|
||||
- name: Biz
|
||||
groupId: org.acme
|
||||
artifactId: biz
|
||||
scope: runtime
|
||||
version: 1.3.5
|
||||
compatibilityRange: 2.2.0.BUILD-SNAPSHOT
|
||||
- name: Bur
|
||||
id: org.acme:bur
|
||||
version: 2.1.0
|
||||
scope: test
|
||||
compatibilityRange: "[2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)"
|
||||
- name: My API
|
||||
id : my-api
|
||||
groupId: org.acme
|
||||
artifactId: my-api
|
||||
scope: provided
|
||||
bom: my-api-bom
|
||||
types:
|
||||
- name: Maven POM
|
||||
id: maven-build
|
||||
tags:
|
||||
build: maven
|
||||
format: build
|
||||
default: false
|
||||
action: /pom.xml
|
||||
- name: Maven Project
|
||||
id: maven-project
|
||||
tags:
|
||||
build: maven
|
||||
format: project
|
||||
default: true
|
||||
action: /starter.zip
|
||||
- name: Gradle Config
|
||||
id: gradle-build
|
||||
tags:
|
||||
build: gradle
|
||||
format: build
|
||||
default: false
|
||||
action: /build.gradle
|
||||
- name: Gradle Project
|
||||
id: gradle-project
|
||||
tags:
|
||||
build: gradle
|
||||
format: project
|
||||
default: false
|
||||
action: /starter.zip
|
||||
packagings:
|
||||
- name: Jar
|
||||
id: jar
|
||||
default: true
|
||||
- name: War
|
||||
id: war
|
||||
default: false
|
||||
javaVersions:
|
||||
- id: 1.6
|
||||
default: false
|
||||
- id: 1.7
|
||||
default: false
|
||||
- id: 1.8
|
||||
default: true
|
||||
languages:
|
||||
- name: Groovy
|
||||
id: groovy
|
||||
default: false
|
||||
- name: Java
|
||||
id: java
|
||||
default: true
|
||||
- name: Kotlin
|
||||
id: kotlin
|
||||
default: false
|
||||
bootVersions:
|
||||
- name : Latest SNAPSHOT
|
||||
id: 2.2.0.BUILD-SNAPSHOT
|
||||
default: false
|
||||
- name: 2.1.4
|
||||
id: 2.1.4.RELEASE
|
||||
default: true
|
||||
- name: 1.5.17
|
||||
id: 1.5.17.RELEASE
|
||||
default: false
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
initializr:
|
||||
env:
|
||||
forceSsl: true
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"id": "spring-boot",
|
||||
"name": "Spring Boot",
|
||||
"repoUrl": "https://github.com/spring-projects/spring-boot",
|
||||
"siteUrl": "https://projects.spring.io/spring-boot",
|
||||
"category": "active",
|
||||
"stackOverflowTags": "spring-boot",
|
||||
"projectReleases": [
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.1.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-snapshots",
|
||||
"name": "Spring Snapshots",
|
||||
"url": "https://repo.spring.io/libs-snapshot",
|
||||
"snapshotsEnabled": true
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.3.1",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.3.1.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.0.RELEASE/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.3.0",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.3.0.RELEASE"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.2.6.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-snapshots",
|
||||
"name": "Spring Snapshots",
|
||||
"url": "https://repo.spring.io/libs-snapshot",
|
||||
"snapshotsEnabled": true
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.2.6",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.2.6.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/current/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.2.5",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.2.5.RELEASE"
|
||||
}
|
||||
],
|
||||
"aggregator": false,
|
||||
"stackOverflowTagList": [
|
||||
"spring-boot"
|
||||
]
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"id": "spring-boot",
|
||||
"name": "Spring Boot",
|
||||
"repoUrl": "https://github.com/spring-projects/spring-boot",
|
||||
"siteUrl": "https://projects.spring.io/spring-boot",
|
||||
"category": "active",
|
||||
"stackOverflowTags": "spring-boot",
|
||||
"projectReleases": [
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-snapshots",
|
||||
"name": "Spring Snapshots",
|
||||
"url": "https://repo.spring.io/libs-snapshot",
|
||||
"snapshotsEnabled": true
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.4.1",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.4.1.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.4.0",
|
||||
"current": true,
|
||||
"snapshot": false,
|
||||
"version": "1.4.0.RELEASE"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "SNAPSHOT",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/1.3.8.BUILD-SNAPSHOT/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": {
|
||||
"id": "spring-snapshots",
|
||||
"name": "Spring Snapshots",
|
||||
"url": "https://repo.spring.io/libs-snapshot",
|
||||
"snapshotsEnabled": true
|
||||
},
|
||||
"preRelease": false,
|
||||
"generalAvailability": false,
|
||||
"versionDisplayName": "1.3.8",
|
||||
"current": false,
|
||||
"snapshot": true,
|
||||
"version": "1.3.8.BUILD-SNAPSHOT"
|
||||
},
|
||||
{
|
||||
"releaseStatus": "GENERAL_AVAILABILITY",
|
||||
"refDocUrl": "https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/",
|
||||
"apiDocUrl": "https://docs.spring.io/spring-boot/docs/current/api/",
|
||||
"groupId": "org.springframework.boot",
|
||||
"artifactId": "spring-boot",
|
||||
"repository": null,
|
||||
"preRelease": false,
|
||||
"generalAvailability": true,
|
||||
"versionDisplayName": "1.3.7",
|
||||
"current": false,
|
||||
"snapshot": false,
|
||||
"version": "1.3.7.RELEASE"
|
||||
}
|
||||
],
|
||||
"aggregator": false,
|
||||
"stackOverflowTagList": [
|
||||
"spring-boot"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user