Skip to content

Commit

Permalink
Added checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
marcingrzejszczak committed Feb 3, 2019
1 parent 4d0acf1 commit 60f1e21
Show file tree
Hide file tree
Showing 249 changed files with 7,425 additions and 5,832 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
6 changes: 4 additions & 2 deletions .settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /*
~ * Copyright 2015 the original author or authors.
~ * Copyright 2015-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.
Expand Down Expand Up @@ -34,7 +34,9 @@
this settings file, or copy the profile into their ~/.m2/settings.xml.
-->
<id>spring</id>
<activation><activeByDefault>true</activeByDefault></activation>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>spring-snapshots</id>
Expand Down
Empty file added .springformat
Empty file.
54 changes: 45 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath />
<version>2.1.3.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>

<groupId>org.springframework.cloud</groupId>
Expand Down Expand Up @@ -126,15 +128,24 @@
<properties>
<spring-cloud-stream.version>2.1.0.RELEASE</spring-cloud-stream.version>
<spring-cloud-deployer.version>2.0.0.RELEASE</spring-cloud-deployer.version>
<spring-cloud-deployer-local.version>2.0.0.RELEASE</spring-cloud-deployer-local.version>
<spring-cloud-stream-binder-rabbit.version>2.1.0.RELEASE</spring-cloud-stream-binder-rabbit.version>
<spring-cloud-deployer-local.version>2.0.0.RELEASE
</spring-cloud-deployer-local.version>
<spring-cloud-stream-binder-rabbit.version>2.1.0.RELEASE
</spring-cloud-stream-binder-rabbit.version>
<spring-batch.version>4.1.1.RELEASE</spring-batch.version>
<commons-logging.version>1.1</commons-logging.version>
<java-ee-api.version>8.0</java-ee-api.version>
<junit.version>5.3.1</junit.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.jacoco.reportPath>${project.build.directory}/coverage-reports/jacoco-ut.exec</sonar.jacoco.reportPath>
<sonar.jacoco.reportPath>
${project.build.directory}/coverage-reports/jacoco-ut.exec
</sonar.jacoco.reportPath>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
<maven-checkstyle-plugin.failsOnViolation>true
</maven-checkstyle-plugin.failsOnViolation>
<maven-checkstyle-plugin.includeTestSourceDirectory>true
</maven-checkstyle-plugin.includeTestSourceDirectory>
</properties>

<build>
Expand Down Expand Up @@ -211,7 +222,9 @@
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
<destFile>
${project.build.directory}/coverage-reports/jacoco-ut.exec
</destFile>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
Expand All @@ -231,15 +244,38 @@
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
<dataFile>
${project.build.directory}/coverage-reports/jacoco-ut.exec
</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
<outputDirectory>
${project.reporting.outputDirectory}/jacoco-ut
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.spring.javaformat</groupId>
<artifactId>spring-javaformat-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
</plugins>
</reporting>

<profiles>
<profile>
<id>spring</id>
Expand Down
4 changes: 3 additions & 1 deletion spring-cloud-starter-task/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand Down
9 changes: 6 additions & 3 deletions spring-cloud-task-batch/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

Expand All @@ -12,7 +14,8 @@
<artifactId>spring-cloud-task-batch</artifactId>
<packaging>jar</packaging>
<name>Spring Cloud Task Batch</name>
<description>Module for use when combining Spring Cloud Task with Spring Batch</description>
<description>Module for use when combining Spring Cloud Task with Spring Batch
</description>

<dependencies>
<dependency>
Expand Down Expand Up @@ -79,7 +82,7 @@
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 the original author or authors.
* Copyright 2015-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.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.task.batch.configuration;

import org.springframework.batch.core.Job;
Expand All @@ -38,8 +39,9 @@
* @author Michael Minella
*/
@Configuration
@ConditionalOnBean({Job.class})
@ConditionalOnProperty(name = {"spring.cloud.task.batch.listener.enable", "spring.cloud.task.batch.listener.enabled"}, havingValue = "true", matchIfMissing = true)
@ConditionalOnBean({ Job.class })
@ConditionalOnProperty(name = { "spring.cloud.task.batch.listener.enable",
"spring.cloud.task.batch.listener.enabled" }, havingValue = "true", matchIfMissing = true)
public class TaskBatchAutoConfiguration {

@Bean
Expand All @@ -48,6 +50,9 @@ public TaskBatchExecutionListenerBeanPostProcessor batchTaskExecutionListenerBea
return new TaskBatchExecutionListenerBeanPostProcessor();
}

/**
* Auto configuration for Task Batch Execution Listener.
*/
@Configuration
@ConditionalOnMissingBean(name = "taskBatchExecutionListener")
@EnableConfigurationProperties(TaskProperties.class)
Expand All @@ -60,20 +65,23 @@ public static class TaskBatchExecutionListenerAutoconfiguration {
private TaskProperties taskProperties;

@Bean
public TaskBatchExecutionListenerFactoryBean taskBatchExecutionListener(TaskExplorer taskExplorer) {
public TaskBatchExecutionListenerFactoryBean taskBatchExecutionListener(
TaskExplorer taskExplorer) {
TaskConfigurer taskConfigurer = null;
if(!this.context.getBeansOfType(TaskConfigurer.class).isEmpty()) {
if (!this.context.getBeansOfType(TaskConfigurer.class).isEmpty()) {
taskConfigurer = this.context.getBean(TaskConfigurer.class);
}
if(taskConfigurer != null && taskConfigurer.getTaskDataSource() != null) {
if (taskConfigurer != null && taskConfigurer.getTaskDataSource() != null) {
return new TaskBatchExecutionListenerFactoryBean(
taskConfigurer.getTaskDataSource(),
taskExplorer, taskProperties.getTablePrefix());
taskConfigurer.getTaskDataSource(), taskExplorer,
this.taskProperties.getTablePrefix());
}
else {
return new TaskBatchExecutionListenerFactoryBean(null,
taskExplorer, taskProperties.getTablePrefix());
return new TaskBatchExecutionListenerFactoryBean(null, taskExplorer,
this.taskProperties.getTablePrefix());
}
}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2015-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.
Expand All @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.cloud.task.batch.configuration;

import java.util.ArrayList;
Expand All @@ -28,7 +29,7 @@

/**
* Injects a configured {@link TaskBatchExecutionListener} into any batch jobs (beans
* assignable to {@link AbstractJob}) that are executed within the scope of a task. The
* assignable to {@link AbstractJob}) that are executed within the scope of a task. The
* context this is used within is expected to have only one bean of type
* {@link TaskBatchExecutionListener}.
*
Expand All @@ -50,17 +51,17 @@ public Object postProcessBeforeInitialization(Object bean, String beanName)
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
if(jobNames.size() > 0 && !jobNames.contains(beanName)) {
return bean;
if (this.jobNames.size() > 0 && !this.jobNames.contains(beanName)) {
return bean;
}
int length = this.applicationContext
.getBeanNamesForType(TaskBatchExecutionListener.class).length;

if(bean instanceof AbstractJob) {
if(length != 1) {
throw new IllegalStateException("The application context is required to " +
"have exactly 1 instance of the TaskBatchExecutionListener but has " +
length);
if (bean instanceof AbstractJob) {
if (length != 1) {
throw new IllegalStateException("The application context is required to "
+ "have exactly 1 instance of the TaskBatchExecutionListener but has "
+ length);
}
((AbstractJob) bean).registerJobExecutionListener(
this.applicationContext.getBean(TaskBatchExecutionListener.class));
Expand All @@ -73,4 +74,5 @@ public void setJobNames(List<String> jobNames) {

this.jobNames = jobNames;
}

}
Loading

0 comments on commit 60f1e21

Please sign in to comment.