Turned on checkstyle

This commit is contained in:
Marcin Grzejszczak
2019-02-01 15:48:32 +01:00
parent 94e9b8f2f8
commit e4b08a083c
268 changed files with 5114 additions and 3993 deletions

View File

@@ -11,8 +11,8 @@ buildscript {
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:${shadowVersion}"
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:${shadowVersion}"
classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
@@ -40,39 +40,40 @@ repositories {
ext {
springCloudFunctionVersion = "2.0.0.BUILD-SNAPSHOT"
awsLambdaEventsVersion = "1.2.1"
awsLambdaCoreVersion = "1.1.0"
awsLambdaEventsVersion = "1.2.1"
awsLambdaCoreVersion = "1.1.0"
}
ext['reactor.version'] = "3.1.7.RELEASE"
assemble.dependsOn = [shadowJar, thinJar]
jar {
manifest {
attributes 'Main-Class': 'example.Config'
}
manifest {
attributes 'Main-Class': 'example.Config'
}
}
import com.github.jengelman.gradle.plugins.shadow.transformers.*
shadowJar {
classifier = 'aws'
dependencies {
exclude(dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
}
// Required for Spring
mergeServiceFiles()
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories' ]
mergeStrategy = "append"
}
classifier = 'aws'
dependencies {
exclude(
dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
}
// Required for Spring
mergeServiceFiles()
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories']
mergeStrategy = "append"
}
}
configurations {
testCompile.extendsFrom(compileOnly)
testCompile.extendsFrom(compileOnly)
}
dependencies {

View File

@@ -1,6 +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>
<groupId>io.spring.sample</groupId>
@@ -15,7 +16,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
@@ -24,7 +25,8 @@
<java.version>1.8</java.version>
<wrapper.version>1.0.17.RELEASE</wrapper.version>
<aws-lambda-events.version>2.0.2</aws-lambda-events.version>
<spring-cloud-function.version>2.0.2.BUILD-SNAPSHOT</spring-cloud-function.version>
<spring-cloud-function.version>2.0.2.BUILD-SNAPSHOT
</spring-cloud-function.version>
<start-class>example.Config</start-class>
</properties>

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2017 the original author or authors.
* 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
*
* 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,
@@ -27,6 +27,7 @@ import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.GenericApplicationContext;
// @checkstyle:off
@SpringBootApplication
@EnableConfigurationProperties(Properties.class)
public class Config implements ApplicationContextInitializer<GenericApplicationContext> {
@@ -40,14 +41,14 @@ public class Config implements ApplicationContextInitializer<GenericApplicationC
this.props = props;
}
public static void main(String[] args) throws Exception {
FunctionalSpringApplication.run(Config.class, args);
}
@Bean
public Function<Foo, Bar> function() {
return value -> new Bar(
value.uppercase() + (props.getFoo() != null ? "-" + props.getFoo() : ""));
}
public static void main(String[] args) throws Exception {
FunctionalSpringApplication.run(Config.class, args);
value.uppercase() + (this.props.getFoo() != null ? "-" + this.props.getFoo() : ""));
}
@Override
@@ -61,6 +62,7 @@ public class Config implements ApplicationContextInitializer<GenericApplicationC
}
}
// @checkstyle:on
class Foo {
@@ -69,25 +71,26 @@ class Foo {
Foo() {
}
public String lowercase() {
return value.toLowerCase();
}
public Foo(String value) {
Foo(String value) {
this.value = value;
}
public String lowercase() {
return this.value.toLowerCase();
}
public String uppercase() {
return value.toUpperCase();
return this.value.toUpperCase();
}
public String getValue() {
return value;
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
class Bar {
@@ -97,12 +100,12 @@ class Bar {
Bar() {
}
public Bar(String value) {
Bar(String value) {
this.value = value;
}
public String getValue() {
return value;
return this.value;
}
public void setValue(String value) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* 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.

View File

@@ -1,11 +1,11 @@
/*
* Copyright 2017 the original author or authors.
* 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
*
* 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,
@@ -18,16 +18,21 @@ package example;
import org.springframework.boot.context.properties.ConfigurationProperties;
// @checkstyle:off
@ConfigurationProperties("app")
public class Properties {
public String foo;
public String getFoo() {
return foo;
return this.foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
}
// @checkstyle:on

View File

@@ -1,14 +1,11 @@
log4j.rootCategory=DEBUG, LAMBDA
PID=????
LOG_LEVEL_PATTERN=%5p
LOG_PATTERN=[%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${PID} ${LOG_LEVEL_PATTERN} [%t] --- %c{1}: %m%n
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.LAMBDA=com.amazonaws.services.lambda.runtime.log4j.LambdaAppender
log4j.appender.LAMBDA.layout=org.apache.log4j.PatternLayout
log4j.appender.LAMBDA.layout.conversionPattern=${LOG_PATTERN}
log4j.category.org.apache.catalina.startup.DigesterFactory=ERROR
log4j.category.org.apache.catalina.util.LifecycleBase=ERROR
log4j.category.org.apache.coyote.http11.Http11NioProtocol=WARN
@@ -20,4 +17,4 @@ log4j.category.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR
log4j.category.org.hibernate.validator.internal.util.Version=WARN
log4j.category.org.springframework.boot.actuate.autoconfigure.CrshAutoConfiguration=WARN
log4j.category.org.springframework.boot.actuate.endpoint.jmx=WARN
log4j.category.org.thymeleaf=WARN
log4j.category.org.thymeleaf=WARN

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* 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.
@@ -36,7 +36,8 @@ public class MapTests {
@Test
public void start() throws Exception {
SpringBootRequestHandler<Object, Object> handler = new SpringBootRequestHandler<>(Config.class);
SpringBootRequestHandler<Object, Object> handler = new SpringBootRequestHandler<>(
Config.class);
handler.handleRequest(new Foo("foo"), null);
handler.close();
}