Added checkstyle

This commit is contained in:
Marcin Grzejszczak
2019-02-03 19:27:07 +01:00
parent 4d0acf120c
commit 60f1e21d03
249 changed files with 7450 additions and 5857 deletions

View File

@@ -1,12 +1,15 @@
<?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>
<groupId>io.spring.cloud</groupId>
<artifactId>multiple-datasources</artifactId>
<packaging>jar</packaging>
<version>2.1.0.BUILD-SNAPSHOT</version>
<description>To show users how to enable a task with a multiple DataSources.</description>
<description>To show users how to enable a task with a multiple DataSources.
</description>
<name>Spring Cloud Task Multiple DataSources Application</name>
@@ -14,7 +17,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath />
<relativePath/>
</parent>
<properties>

View File

@@ -1,17 +1,17 @@
/*
* Copyright 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.
* You may obtain a copy of the License at
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://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.
* 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;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.configuration;
import javax.sql.DataSource;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.configuration;
import javax.sql.DataSource;
@@ -31,14 +32,14 @@ public class DataSourceConfiguration {
@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.HSQL)
.build();
.setType(EmbeddedDatabaseType.HSQL)
.build();
}
@Bean
public DataSource secondDataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.H2)
.build();
.setType(EmbeddedDatabaseType.H2)
.build();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 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.
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.task;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,7 +39,7 @@ public class SampleCommandLineRunner implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
System.out.println("There are " + dataSources.size() +
" DataSources within this application");
System.out.println("There are " + this.dataSources.size() +
" DataSources within this application");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 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.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring;
import org.junit.Rule;
@@ -21,7 +22,7 @@ import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import static org.junit.Assert.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Michael Minella
@@ -38,11 +39,11 @@ public class MultiDataSourcesApplicationTests {
String output = this.outputCapture.toString();
assertTrue("Unable to find CommandLineRunner output: " + output,
output.contains("There are 2 DataSources within this application"));
assertTrue("Unable to find start task message: " + output,
output.contains("Creating: TaskExecution{"));
assertTrue("Unable to find update task message: " + output,
output.contains("Updating: TaskExecution"));
assertThat(output.contains("There are 2 DataSources within this application"))
.as("Unable to find CommandLineRunner output: " + output).isTrue();
assertThat(output.contains("Creating: TaskExecution{"))
.as("Unable to find start task message: " + output).isTrue();
assertThat(output.contains("Updating: TaskExecution"))
.as("Unable to find update task message: " + output).isTrue();
}
}

View File

@@ -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.
@@ -13,6 +13,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
spring.application.name=Demo Multiple DataSources Task
logging.level.org.springframework.cloud.task=DEBUG