Apply automatic cleanup rules

Apply code cleanup rules from Eclipse for better consistency.
This commit is contained in:
Phillip Webb
2018-04-11 22:16:49 -07:00
parent 3d4efbf525
commit 6493eae015
111 changed files with 1278 additions and 1279 deletions

View File

@@ -32,8 +32,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.servlet.resource.ResourceUrlProvider;
/**
* Initializr service application. Enables legacy STS support for older
* clients.
* Initializr service application. Enables legacy STS support for older clients.
*
* @author Stephane Nicoll
*/
@@ -47,7 +46,8 @@ public class InitializrService {
@Bean
@SuppressWarnings("deprecation")
public LegacyStsController legacyStsController(InitializrMetadataProvider metadataProvider,
public LegacyStsController legacyStsController(
InitializrMetadataProvider metadataProvider,
ResourceUrlProvider resourceUrlProvider) {
return new LegacyStsController(metadataProvider, resourceUrlProvider);
}

View File

@@ -36,10 +36,12 @@ class Java9RequestPostProcessor implements ProjectRequestPostProcessor {
private static final Version VERSION_2_0_0_M1 = Version.parse("2.0.0.M1");
private static final List<String> UNSUPPORTED_LANGUAGES = Arrays.asList("groovy", "kotlin");
private static final List<String> UNSUPPORTED_LANGUAGES = Arrays.asList("groovy",
"kotlin");
@Override
public void postProcessAfterResolution(ProjectRequest request, InitializrMetadata metadata) {
public void postProcessAfterResolution(ProjectRequest request,
InitializrMetadata metadata) {
Version requestVersion = Version.safeParse(request.getBootVersion());
if (!"9".equals(request.getJavaVersion())) {
return;

View File

@@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
/**
* A {@link ProjectRequestPostProcessor} that automatically adds "reactor-test" when
* webflux is selected.
*
*
* @author Stephane Nicoll
*/
@Component
@@ -35,11 +35,12 @@ class ReactorTestRequestPostProcessor extends AbstractProjectRequestPostProcesso
private static final Version VERSION_2_0_0_M2 = Version.parse("2.0.0.M2");
static final Dependency REACTOR_TEST = Dependency.withId("reactor-test",
static final Dependency REACTOR_TEST = Dependency.withId("reactor-test",
"io.projectreactor", "reactor-test", null, Dependency.SCOPE_TEST);
@Override
public void postProcessAfterResolution(ProjectRequest request, InitializrMetadata metadata) {
public void postProcessAfterResolution(ProjectRequest request,
InitializrMetadata metadata) {
if (hasDependency(request, "webflux")
&& isSpringBootVersionAtLeastAfter(request, VERSION_2_0_0_M2)) {
request.getResolvedDependencies().add(REACTOR_TEST);

View File

@@ -25,8 +25,8 @@ import io.spring.initializr.util.Version;
import org.springframework.stereotype.Component;
/**
* A {@link ProjectRequestPostProcessor} that automatically adds
* {@code spring-batch-test} when Spring Batch is selected.
* A {@link ProjectRequestPostProcessor} that automatically adds {@code spring-batch-test}
* when Spring Batch is selected.
*
* @author Tim Riemer
*/
@@ -36,7 +36,8 @@ class SpringBatchTestRequestPostProcessor extends AbstractProjectRequestPostProc
private static final Version VERSION_1_3_0 = Version.parse("1.3.0.RELEASE");
static final Dependency SPRING_BATCH_TEST = Dependency.withId("spring-batch-test",
"org.springframework.batch", "spring-batch-test", null, Dependency.SCOPE_TEST);
"org.springframework.batch", "spring-batch-test", null,
Dependency.SCOPE_TEST);
@Override
public void postProcessAfterResolution(ProjectRequest request,

View File

@@ -26,8 +26,8 @@ import io.spring.initializr.util.Version;
import org.springframework.stereotype.Component;
/**
* As of Spring Boot 2.0, Java8 is mandatory so this extension makes sure that the
* java version is forced.
* As of Spring Boot 2.0, Java8 is mandatory so this extension makes sure that the java
* version is forced.
*
* @author Stephane Nicoll
*/

View File

@@ -23,8 +23,8 @@ import io.spring.initializr.metadata.InitializrMetadata;
import org.springframework.stereotype.Component;
/**
* Determine the appropriate Spring Cloud stream dependency to use based on the
* selected integration technology.
* Determine the appropriate Spring Cloud stream dependency to use based on the selected
* integration technology.
* <p>
* Does not replace the integration technology jar by the relevant binder. If more than
* one tech is selected, it is far more easier to remove the unnecessary binder jar than
@@ -33,8 +33,7 @@ import org.springframework.stereotype.Component;
* @author Stephane Nicoll
*/
@Component
class SpringCloudStreamRequestPostProcessor
extends AbstractProjectRequestPostProcessor {
class SpringCloudStreamRequestPostProcessor extends AbstractProjectRequestPostProcessor {
static final Dependency KAFKA_BINDER = Dependency.withId("cloud-stream-binder-kafka",
"org.springframework.cloud", "spring-cloud-stream-binder-kafka");
@@ -79,4 +78,3 @@ class SpringCloudStreamRequestPostProcessor
}
}

View File

@@ -35,9 +35,9 @@ class SpringSecurityTestRequestPostProcessor extends AbstractProjectRequestPostP
private static final Version VERSION_1_3_0 = Version.parse("1.3.0.RELEASE");
static final Dependency SPRING_SECURITY_TEST = Dependency.withId(
"security-test", "org.springframework.security",
"spring-security-test", null, Dependency.SCOPE_TEST);
static final Dependency SPRING_SECURITY_TEST = Dependency.withId("security-test",
"org.springframework.security", "spring-security-test", null,
Dependency.SCOPE_TEST);
@Override
public void postProcessAfterResolution(ProjectRequest request,

View File

@@ -34,8 +34,7 @@ import org.springframework.stereotype.Component;
* @author Stephane Nicoll
*/
@Component
class SpringSessionRequestPostProcessor
extends AbstractProjectRequestPostProcessor {
class SpringSessionRequestPostProcessor extends AbstractProjectRequestPostProcessor {
private static final Version VERSION_2_0_0_M3 = Version.parse("2.0.0.M3");
@@ -45,7 +44,6 @@ class SpringSessionRequestPostProcessor
static final Dependency JDBC = Dependency.withId("session-jdbc",
"org.springframework.session", "spring-session-jdbc");
@Override
public void postProcessAfterResolution(ProjectRequest request,
InitializrMetadata metadata) {

View File

@@ -60,7 +60,8 @@ public class InitializrServiceSmokeTests {
RequestEntity<Void> request = RequestEntity.get(new URI("/"))
.accept(MediaType.parseMediaType("application/vnd.initializr.v2.1+json"))
.build();
ResponseEntity<String> response = this.restTemplate.exchange(request, String.class);
ResponseEntity<String> response = this.restTemplate.exchange(request,
String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
new ObjectMapper().readTree(response.getBody());
}
@@ -68,16 +69,16 @@ public class InitializrServiceSmokeTests {
@Test
public void configurationCanBeSerialized() throws URISyntaxException {
RequestEntity<Void> request = RequestEntity.get(new URI("/metadata/config"))
.accept(MediaType.APPLICATION_JSON)
.build();
ResponseEntity<String> response = this.restTemplate.exchange(request, String.class);
.accept(MediaType.APPLICATION_JSON).build();
ResponseEntity<String> response = this.restTemplate.exchange(request,
String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
InitializrMetadata actual = InitializrMetadataBuilder.create()
.withInitializrMetadata(new ByteArrayResource(
response.getBody().getBytes()))
.withInitializrMetadata(
new ByteArrayResource(response.getBody().getBytes()))
.build();
assertThat(actual).isNotNull();
InitializrMetadata expected = metadataProvider.get();
InitializrMetadata expected = this.metadataProvider.get();
assertThat(actual.getDependencies().getAll().size())
.isEqualTo(expected.getDependencies().getAll().size());
assertThat(actual.getConfiguration().getEnv().getBoms().size())

View File

@@ -52,19 +52,19 @@ public abstract class AbstractRequestPostProcessorTests {
protected PomAssert generateMavenPom(ProjectRequest request) {
request.setType("maven-build");
String content = new String(projectGenerator.generateMavenPom(request));
String content = new String(this.projectGenerator.generateMavenPom(request));
return new PomAssert(content);
}
protected GradleBuildAssert generateGradleBuild(ProjectRequest request) {
request.setType("gradle-build");
String content = new String(projectGenerator.generateGradleBuild(request));
String content = new String(this.projectGenerator.generateGradleBuild(request));
return new GradleBuildAssert(content);
}
protected ProjectRequest createProjectRequest(String... styles) {
ProjectRequest request = new ProjectRequest();
request.initialize(metadataProvider.get());
request.initialize(this.metadataProvider.get());
request.getStyle().addAll(Arrays.asList(styles));
return request;
}

View File

@@ -36,10 +36,8 @@ public class JacksonKotlinRequestPostProcessorTests
ProjectRequest request = createProjectRequest("webflux");
request.setBootVersion("2.0.0.M2");
request.setLanguage("kotlin");
generateMavenPom(request)
.hasSpringBootStarterDependency("webflux")
.hasDependency(JACKSON_KOTLIN)
.hasSpringBootStarterTest()
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
.hasDependency(JACKSON_KOTLIN).hasSpringBootStarterTest()
.hasDependency(REACTOR_TEST)
.hasDependency("org.jetbrains.kotlin", "kotlin-reflect")
.hasDependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
@@ -50,10 +48,8 @@ public class JacksonKotlinRequestPostProcessorTests
public void jacksonModuleKotlinIsNotAddedWithoutKotlin() {
ProjectRequest request = createProjectRequest("webflux");
request.setBootVersion("2.0.0.M2");
generateMavenPom(request)
.hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest()
.hasDependency(REACTOR_TEST)
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest().hasDependency(REACTOR_TEST)
.hasDependenciesCount(3);
}
@@ -62,8 +58,7 @@ public class JacksonKotlinRequestPostProcessorTests
ProjectRequest request = createProjectRequest("actuator");
request.setBootVersion("2.0.0.M2");
request.setLanguage("kotlin");
generateMavenPom(request)
.hasSpringBootStarterDependency("actuator")
generateMavenPom(request).hasSpringBootStarterDependency("actuator")
.hasSpringBootStarterTest()
.hasDependency("org.jetbrains.kotlin", "kotlin-reflect")
.hasDependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")

View File

@@ -24,8 +24,7 @@ import org.junit.Test;
*
* @author Stephane Nicoll
*/
public class Java9RequestPostProcessorTests
extends AbstractRequestPostProcessorTests {
public class Java9RequestPostProcessorTests extends AbstractRequestPostProcessorTests {
@Test
public void java9CannotBeUsedWithSpringBoot1Maven() {

View File

@@ -32,13 +32,11 @@ public class ReactorTestRequestPostProcessorTests
public void reactorTestIsAdded() {
ProjectRequest request = createProjectRequest("webflux");
request.setBootVersion("2.0.0.M2");
Dependency reactorTest = Dependency.withId(
"reactor-test", "io.projectreactor", "reactor-test");
Dependency reactorTest = Dependency.withId("reactor-test", "io.projectreactor",
"reactor-test");
reactorTest.setScope(Dependency.SCOPE_TEST);
generateMavenPom(request)
.hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest()
.hasDependency(reactorTest)
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest().hasDependency(reactorTest)
.hasDependenciesCount(3);
}
@@ -46,20 +44,16 @@ public class ReactorTestRequestPostProcessorTests
public void reactorTestIsNotAddedWithEarlierVersions() {
ProjectRequest request = createProjectRequest("webflux");
request.setBootVersion("2.0.0.M1");
generateMavenPom(request)
.hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("webflux")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
@Test
public void reactorTestIsNotAddedWithoutWebFlux() {
ProjectRequest request = createProjectRequest("web");
request.setBootVersion("2.0.0.M2");
generateMavenPom(request)
.hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
}

View File

@@ -31,10 +31,8 @@ public class SpringBatchTestRequestPostProcessorTests
@Test
public void batchTestIsAddedWithBatch() {
ProjectRequest request = createProjectRequest("batch");
generateMavenPom(request)
.hasSpringBootStarterDependency("batch")
.hasSpringBootStarterTest()
.hasDependency(springBatchTest())
generateMavenPom(request).hasSpringBootStarterDependency("batch")
.hasSpringBootStarterTest().hasDependency(springBatchTest())
.hasDependenciesCount(3);
}
@@ -42,19 +40,15 @@ public class SpringBatchTestRequestPostProcessorTests
public void batchTestIsNotAddedBefore13() {
ProjectRequest request = createProjectRequest("batch");
request.setBootVersion("1.2.7.RELEASE");
generateMavenPom(request)
.hasSpringBootStarterDependency("batch")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("batch")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
@Test
public void batchTestIsNotAddedWithoutSpringBatch() {
ProjectRequest request = createProjectRequest("web");
generateMavenPom(request)
.hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
private static Dependency springBatchTest() {

View File

@@ -35,24 +35,18 @@ public class SpringCloudStreamRequestPostProcessorTests
@Test
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)
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
.hasDependenciesCount(5);
}
@Test
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)
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
.hasDependenciesCount(5);
}
@@ -60,42 +54,32 @@ public class SpringCloudStreamRequestPostProcessorTests
public void springCloudStreamWithKafkaStreams() {
ProjectRequest request = createProjectRequest("cloud-stream", "kafka-streams");
request.setBootVersion("2.0.0.RELEASE");
generateMavenPom(request)
.hasDependency(getDependency("cloud-stream"))
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
.hasDependency(getDependency("kafka-streams"))
.hasDependency(KAFKA_STREAMS_BINDER)
.hasSpringBootStarterTest()
.hasDependency(SCS_TEST)
.hasDependenciesCount(5);
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
.hasDependency(SCS_TEST).hasDependenciesCount(5);
}
@Test
public void springCloudStreamWithAllBinders() {
ProjectRequest request = createProjectRequest(
"cloud-stream", "amqp", "kafka", "kafka-streams");
generateMavenPom(request)
.hasDependency(getDependency("cloud-stream"))
ProjectRequest request = createProjectRequest("cloud-stream", "amqp", "kafka",
"kafka-streams");
generateMavenPom(request).hasDependency(getDependency("cloud-stream"))
.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(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
.hasDependency(SCS_TEST).hasDependenciesCount(9);
}
@Test
public void reactiveSpringCloudStreamWithRabbit() {
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)
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
.hasDependenciesCount(5);
}
@@ -103,122 +87,94 @@ public class SpringCloudStreamRequestPostProcessorTests
public void reactiveSpringCloudStreamWithKafka() {
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)
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest().hasDependency(SCS_TEST)
.hasDependenciesCount(5);
}
@Test
public void reactiveSpringCloudStreamWithKafkaStreams() {
ProjectRequest request = createProjectRequest(
"reactive-cloud-stream", "kafka-streams");
ProjectRequest request = createProjectRequest("reactive-cloud-stream",
"kafka-streams");
request.setBootVersion("2.0.0.RELEASE");
generateMavenPom(request)
.hasDependency(getDependency("reactive-cloud-stream"))
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
.hasDependency(getDependency("kafka-streams"))
.hasDependency(KAFKA_STREAMS_BINDER)
.hasSpringBootStarterTest()
.hasDependency(SCS_TEST)
.hasDependenciesCount(5);
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
.hasDependency(SCS_TEST).hasDependenciesCount(5);
}
@Test
public void reactiveSpringCloudStreamWithAllBinders() {
ProjectRequest request = createProjectRequest(
"reactive-cloud-stream", "amqp", "kafka","kafka-streams");
ProjectRequest request = createProjectRequest("reactive-cloud-stream", "amqp",
"kafka", "kafka-streams");
request.setBootVersion("2.0.0.RELEASE");
generateMavenPom(request)
.hasDependency(getDependency("reactive-cloud-stream"))
generateMavenPom(request).hasDependency(getDependency("reactive-cloud-stream"))
.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(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
.hasDependency(KAFKA_STREAMS_BINDER).hasSpringBootStarterTest()
.hasDependency(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)
.hasSpringBootStarterTest()
.hasDependenciesCount(4);
generateMavenPom(request).hasDependency(getDependency("cloud-bus"))
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(4);
}
@Test
public void springCloudBusWithKafka() {
ProjectRequest request = createProjectRequest("cloud-bus", "amqp");
generateMavenPom(request)
.hasDependency(getDependency("cloud-bus"))
.hasDependency(getDependency("amqp"))
.hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest()
.hasDependenciesCount(4);
generateMavenPom(request).hasDependency(getDependency("cloud-bus"))
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(4);
}
@Test
public void springCloudBusWithAllBinders() {
ProjectRequest request = createProjectRequest(
"cloud-bus", "amqp", "kafka", "kafka-streams");
generateMavenPom(request)
.hasDependency(getDependency("cloud-bus"))
ProjectRequest request = createProjectRequest("cloud-bus", "amqp", "kafka",
"kafka-streams");
generateMavenPom(request).hasDependency(getDependency("cloud-bus"))
.hasDependency(getDependency("amqp"))
.hasDependency(getDependency("kafka"))
.hasDependency(getDependency("kafka-streams"))
.hasDependency(RABBIT_BINDER)
.hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest()
.hasDependenciesCount(7);
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(7);
}
@Test
public void springCloudTurbineStreamWithRabbit() {
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)
.hasSpringBootStarterTest()
.hasDependenciesCount(4);
generateMavenPom(request).hasDependency(getDependency("cloud-turbine-stream"))
.hasDependency(getDependency("amqp")).hasDependency(RABBIT_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(4);
}
@Test
public void springCloudTurbineStreamWithKafka() {
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)
.hasSpringBootStarterTest()
.hasDependenciesCount(4);
generateMavenPom(request).hasDependency(getDependency("cloud-turbine-stream"))
.hasDependency(getDependency("kafka")).hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(4);
}
@Test
public void springCloudTurbineStreamWithAllBinders() {
ProjectRequest request = createProjectRequest(
"cloud-turbine-stream", "amqp", "kafka", "kafka-streams");
ProjectRequest request = createProjectRequest("cloud-turbine-stream", "amqp",
"kafka", "kafka-streams");
request.setBootVersion("2.0.0.RELEASE");
generateMavenPom(request)
.hasDependency(getDependency("cloud-turbine-stream"))
generateMavenPom(request).hasDependency(getDependency("cloud-turbine-stream"))
.hasDependency(getDependency("amqp"))
.hasDependency(getDependency("kafka"))
.hasDependency(getDependency("kafka-streams"))
.hasDependency(RABBIT_BINDER)
.hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest()
.hasDependenciesCount(7);
.hasDependency(RABBIT_BINDER).hasDependency(KAFKA_BINDER)
.hasSpringBootStarterTest().hasDependenciesCount(7);
}
}

View File

@@ -31,10 +31,8 @@ public class SpringSecurityTestRequestPostProcessorTests
@Test
public void securityTestIsAddedWithSecurity() {
ProjectRequest request = createProjectRequest("security");
generateMavenPom(request)
.hasSpringBootStarterDependency("security")
.hasSpringBootStarterTest()
.hasDependency(springSecurityTest())
generateMavenPom(request).hasSpringBootStarterDependency("security")
.hasSpringBootStarterTest().hasDependency(springSecurityTest())
.hasDependenciesCount(3);
}
@@ -42,22 +40,17 @@ public class SpringSecurityTestRequestPostProcessorTests
public void securityTestIsNotAddedBefore13() {
ProjectRequest request = createProjectRequest("security");
request.setBootVersion("1.2.7.RELEASE");
generateMavenPom(request)
.hasSpringBootStarterDependency("security")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("security")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
@Test
public void securityTestIsNotAddedWithoutSpringSecurity() {
ProjectRequest request = createProjectRequest("web");
generateMavenPom(request)
.hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("web")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
private static Dependency springSecurityTest() {
Dependency dependency = Dependency.withId("spring-security-test",
"org.springframework.security", "spring-security-test");

View File

@@ -36,8 +36,7 @@ public class SpringSessionRequestPostProcessorTests
request.setBootVersion("1.5.4.RELEASE");
generateMavenPom(request)
.hasDependency("org.springframework.session", "spring-session")
.hasSpringBootStarterRootDependency()
.hasSpringBootStarterTest()
.hasSpringBootStarterRootDependency().hasSpringBootStarterTest()
.hasDependenciesCount(3);
}
@@ -47,8 +46,7 @@ public class SpringSessionRequestPostProcessorTests
request.setBootVersion("1.5.4.RELEASE");
generateMavenPom(request)
.hasDependency("org.springframework.session", "spring-session")
.hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterTest()
.hasSpringBootStarterDependency("data-redis").hasSpringBootStarterTest()
.hasDependenciesCount(3);
}
@@ -58,8 +56,7 @@ public class SpringSessionRequestPostProcessorTests
request.setBootVersion("1.5.4.RELEASE");
generateMavenPom(request)
.hasDependency("org.springframework.session", "spring-session")
.hasSpringBootStarterDependency("jdbc")
.hasSpringBootStarterTest()
.hasSpringBootStarterDependency("jdbc").hasSpringBootStarterTest()
.hasDependenciesCount(3);
}
@@ -69,19 +66,16 @@ public class SpringSessionRequestPostProcessorTests
request.setBootVersion("2.0.0.M2");
generateMavenPom(request)
.hasDependency("org.springframework.session", "spring-session")
.hasSpringBootStarterRootDependency()
.hasSpringBootStarterTest()
.hasSpringBootStarterRootDependency().hasSpringBootStarterTest()
.hasDependenciesCount(3);
}
@Test
public void noSessionWithRedis() {
ProjectRequest request = createProjectRequest("data-redis");
request.setBootVersion("2.0.0.M3");
generateMavenPom(request)
.hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterTest()
.hasDependenciesCount(2);
generateMavenPom(request).hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterTest().hasDependenciesCount(2);
}
@Test
@@ -90,8 +84,7 @@ public class SpringSessionRequestPostProcessorTests
request.setBootVersion("2.0.0.M3");
generateMavenPom(request)
.hasDependency("org.springframework.session", "spring-session-core")
.hasSpringBootStarterDependency("data-jpa")
.hasSpringBootStarterTest()
.hasSpringBootStarterDependency("data-jpa").hasSpringBootStarterTest()
.hasDependenciesCount(3);
}
@@ -99,46 +92,33 @@ public class SpringSessionRequestPostProcessorTests
public void sessionWithRedis() {
ProjectRequest request = createProjectRequest("session", "data-redis");
request.setBootVersion("2.0.0.M3");
generateMavenPom(request)
.hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterTest()
.hasDependency(REDIS)
.hasDependenciesCount(3);
generateMavenPom(request).hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterTest().hasDependency(REDIS).hasDependenciesCount(3);
}
@Test
public void sessionWithRedisReactive() {
ProjectRequest request = createProjectRequest("session", "data-redis-reactive");
request.setBootVersion("2.0.0.M7");
generateMavenPom(request)
.hasSpringBootStarterDependency("data-redis-reactive")
.hasSpringBootStarterTest()
.hasDependency(REDIS)
.hasDependenciesCount(3);
generateMavenPom(request).hasSpringBootStarterDependency("data-redis-reactive")
.hasSpringBootStarterTest().hasDependency(REDIS).hasDependenciesCount(3);
}
@Test
public void sessionWithJdbc() {
ProjectRequest request = createProjectRequest("session", "jdbc");
request.setBootVersion("2.0.0.M3");
generateMavenPom(request)
.hasSpringBootStarterDependency("jdbc")
.hasSpringBootStarterTest()
.hasDependency(JDBC)
.hasDependenciesCount(3);
generateMavenPom(request).hasSpringBootStarterDependency("jdbc")
.hasSpringBootStarterTest().hasDependency(JDBC).hasDependenciesCount(3);
}
@Test
public void sessionWithRedisAndJdbc() {
ProjectRequest request = createProjectRequest("session", "data-redis", "jdbc");
request.setBootVersion("2.0.0.M3");
generateMavenPom(request)
.hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterDependency("jdbc")
.hasSpringBootStarterTest()
.hasDependency(REDIS)
.hasDependency(JDBC)
.hasDependenciesCount(5);
generateMavenPom(request).hasSpringBootStarterDependency("data-redis")
.hasSpringBootStarterDependency("jdbc").hasSpringBootStarterTest()
.hasDependency(REDIS).hasDependency(JDBC).hasDependenciesCount(5);
}
}

View File

@@ -48,8 +48,8 @@ public class CloudFoundryInfoContributorTests {
assertThat(info.getDetails()).containsOnlyKeys("app");
Object appDetails = info.getDetails().get("app");
assertThat(appDetails).isInstanceOf(Map.class);
assertThat((Map<String, Object>) appDetails).containsOnly(
entry("name", "foo-bar"));
assertThat((Map<String, Object>) appDetails)
.containsOnly(entry("name", "foo-bar"));
}
private static Info getInfo(Environment env) {