mirror of
https://gitee.com/dcren/initializr.git
synced 2025-05-03 04:13:52 +08:00
Fix formatting and checkstyle violations on initializr-service
See gh-676
This commit is contained in:
parent
4a336c6044
commit
5136274146
@ -51,6 +51,9 @@ public class InitializrService {
|
||||
return new LegacyStsController(metadataProvider, resourceUrlProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link Executor} configuration for event processing.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
static class AsyncConfiguration extends AsyncConfigurerSupport {
|
||||
|
@ -65,7 +65,7 @@ public class AbstractProjectRequestPostProcessor implements ProjectRequestPostPr
|
||||
*/
|
||||
protected Dependency getDependency(ProjectRequest request, String id) {
|
||||
return request.getResolvedDependencies().stream()
|
||||
.filter(d -> id.equals(d.getId())).findFirst().orElse(null);
|
||||
.filter((d) -> id.equals(d.getId())).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,9 +67,9 @@ class JavaVersionRequestPostProcessor implements ProjectRequestPostProcessor {
|
||||
private Integer determineJavaGeneration(String javaVersion) {
|
||||
try {
|
||||
int generation = Integer.valueOf(javaVersion);
|
||||
return ((generation > 8 && generation <=10) ? generation : null);
|
||||
return ((generation > 8 && generation <= 10) ? generation : null);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
catch (NumberFormatException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,6 @@ package io.spring.initializr.service.extension;
|
||||
import io.spring.initializr.generator.ProjectRequest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.spring.initializr.service.extension.JacksonKotlinRequestPostProcessor.JACKSON_KOTLIN;
|
||||
import static io.spring.initializr.service.extension.ReactorTestRequestPostProcessor.REACTOR_TEST;
|
||||
|
||||
/**
|
||||
* Tests for {@link JacksonKotlinRequestPostProcessor}.
|
||||
*
|
||||
@ -37,8 +34,9 @@ public class JacksonKotlinRequestPostProcessorTests
|
||||
request.setBootVersion("2.0.0.M2");
|
||||
request.setLanguage("kotlin");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
|
||||
.hasDependency(JACKSON_KOTLIN).hasSpringBootStarterTest()
|
||||
.hasDependency(REACTOR_TEST)
|
||||
.hasDependency(JacksonKotlinRequestPostProcessor.JACKSON_KOTLIN)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(ReactorTestRequestPostProcessor.REACTOR_TEST)
|
||||
.hasDependency("org.jetbrains.kotlin", "kotlin-reflect")
|
||||
.hasDependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
|
||||
.hasDependenciesCount(6);
|
||||
@ -49,7 +47,8 @@ public class JacksonKotlinRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("webflux");
|
||||
request.setBootVersion("2.0.0.M2");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
|
||||
.hasSpringBootStarterTest().hasDependency(REACTOR_TEST)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(ReactorTestRequestPostProcessor.REACTOR_TEST)
|
||||
.hasDependenciesCount(3);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,8 @@ import org.junit.Test;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JavaVersionRequestPostProcessorTests extends AbstractRequestPostProcessorTests {
|
||||
public class JavaVersionRequestPostProcessorTests
|
||||
extends AbstractRequestPostProcessorTests {
|
||||
|
||||
@Test
|
||||
public void java9CannotBeUsedWithSpringBoot1Maven() {
|
||||
@ -126,7 +127,6 @@ public class JavaVersionRequestPostProcessorTests extends AbstractRequestPostPro
|
||||
generateGradleBuild(request).hasJavaVersion("1.8");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void java10CanBeUsedWithSpringBoot2Maven() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
|
@ -19,11 +19,6 @@ package io.spring.initializr.service.extension;
|
||||
import io.spring.initializr.generator.ProjectRequest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.spring.initializr.service.extension.SpringCloudStreamRequestPostProcessor.KAFKA_BINDER;
|
||||
import static io.spring.initializr.service.extension.SpringCloudStreamRequestPostProcessor.KAFKA_STREAMS_BINDER;
|
||||
import static io.spring.initializr.service.extension.SpringCloudStreamRequestPostProcessor.RABBIT_BINDER;
|
||||
import static io.spring.initializr.service.extension.SpringCloudStreamRequestPostProcessor.SCS_TEST;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringCloudStreamRequestPostProcessor}.
|
||||
*
|
||||
@ -36,8 +31,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
public void springCloudStreamWithRabbit() {
|
||||
ProjectRequest request = createProjectRequest("cloud-stream", "amqp");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
|
||||
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@ -45,8 +42,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
public void springCloudStreamWithKafka() {
|
||||
ProjectRequest request = createProjectRequest("cloud-stream", "kafka");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
|
||||
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@ -56,8 +55,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
|
||||
.hasDependency(SCS_TEST).hasDependenciesCount(5);
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_STREAMS_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -68,9 +69,12 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
|
||||
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
|
||||
.hasDependency(SCS_TEST).hasDependenciesCount(9);
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_STREAMS_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(9);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -78,8 +82,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("reactive-cloud-stream", "amqp");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
|
||||
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@ -88,8 +94,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("reactive-cloud-stream", "kafka");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
|
||||
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@ -100,8 +108,10 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
|
||||
.hasDependency(SCS_TEST).hasDependenciesCount(5);
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_STREAMS_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -113,16 +123,20 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
|
||||
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
|
||||
.hasDependency(SCS_TEST).hasDependenciesCount(9);
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_STREAMS_BINDER)
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.SCS_TEST)
|
||||
.hasDependenciesCount(9);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springCloudBusWithRabbit() {
|
||||
ProjectRequest request = createProjectRequest("cloud-bus", "amqp");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-bus"))
|
||||
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(4);
|
||||
}
|
||||
|
||||
@ -130,7 +144,8 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
public void springCloudBusWithKafka() {
|
||||
ProjectRequest request = createProjectRequest("cloud-bus", "amqp");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-bus"))
|
||||
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(4);
|
||||
}
|
||||
|
||||
@ -142,7 +157,8 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(7);
|
||||
}
|
||||
|
||||
@ -151,7 +167,8 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("cloud-turbine-stream", "amqp");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-turbine-stream"))
|
||||
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(4);
|
||||
}
|
||||
|
||||
@ -160,7 +177,8 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("cloud-turbine-stream", "kafka");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateMavenPom(request).hasDependency(getDependency("cloud-turbine-stream"))
|
||||
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(4);
|
||||
}
|
||||
|
||||
@ -173,7 +191,8 @@ public class SpringCloudStreamRequestPostProcessorTests
|
||||
.hasDependency(getDependency("amqp"))
|
||||
.hasDependency(getDependency("kafka"))
|
||||
.hasDependency(getDependency("kafka-streams"))
|
||||
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.RABBIT_BINDER)
|
||||
.hasDependency(SpringCloudStreamRequestPostProcessor.KAFKA_BINDER)
|
||||
.hasSpringBootStarterTest().hasDependenciesCount(7);
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,6 @@ package io.spring.initializr.service.extension;
|
||||
import io.spring.initializr.generator.ProjectRequest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.spring.initializr.service.extension.SpringSessionRequestPostProcessor.JDBC;
|
||||
import static io.spring.initializr.service.extension.SpringSessionRequestPostProcessor.REDIS;
|
||||
|
||||
/**
|
||||
* Tests for {@link SpringSessionRequestPostProcessor}.
|
||||
*
|
||||
@ -93,7 +90,9 @@ public class SpringSessionRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("session", "data-redis");
|
||||
request.setBootVersion("2.0.0.M3");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("data-redis")
|
||||
.hasSpringBootStarterTest().hasDependency(REDIS).hasDependenciesCount(3);
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringSessionRequestPostProcessor.REDIS)
|
||||
.hasDependenciesCount(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -101,7 +100,9 @@ public class SpringSessionRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("session", "data-redis-reactive");
|
||||
request.setBootVersion("2.0.0.M7");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("data-redis-reactive")
|
||||
.hasSpringBootStarterTest().hasDependency(REDIS).hasDependenciesCount(3);
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringSessionRequestPostProcessor.REDIS)
|
||||
.hasDependenciesCount(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -109,7 +110,9 @@ public class SpringSessionRequestPostProcessorTests
|
||||
ProjectRequest request = createProjectRequest("session", "jdbc");
|
||||
request.setBootVersion("2.0.0.M3");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("jdbc")
|
||||
.hasSpringBootStarterTest().hasDependency(JDBC).hasDependenciesCount(3);
|
||||
.hasSpringBootStarterTest()
|
||||
.hasDependency(SpringSessionRequestPostProcessor.JDBC)
|
||||
.hasDependenciesCount(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -118,7 +121,9 @@ public class SpringSessionRequestPostProcessorTests
|
||||
request.setBootVersion("2.0.0.M3");
|
||||
generateMavenPom(request).hasSpringBootStarterDependency("data-redis")
|
||||
.hasSpringBootStarterDependency("jdbc").hasSpringBootStarterTest()
|
||||
.hasDependency(REDIS).hasDependency(JDBC).hasDependenciesCount(5);
|
||||
.hasDependency(SpringSessionRequestPostProcessor.REDIS)
|
||||
.hasDependency(SpringSessionRequestPostProcessor.JDBC)
|
||||
.hasDependenciesCount(5);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,9 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Java6Assertions.entry;
|
||||
import static org.assertj.core.api.Assertions.entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CloudFoundryInfoContributorTests {
|
||||
|
Loading…
Reference in New Issue
Block a user