Added checkstyle
This commit is contained in:
@@ -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.
|
||||
@@ -43,26 +43,32 @@ public class TaskProcessor {
|
||||
|
||||
@Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
|
||||
public Object setupRequest(String message) {
|
||||
Map<String, String> properties = new HashMap<String,String>();
|
||||
if(StringUtils.hasText(processorProperties.getDataSourceUrl())){
|
||||
properties.put("spring_datasource_url",processorProperties.getDataSourceUrl());
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
if (StringUtils.hasText(this.processorProperties.getDataSourceUrl())) {
|
||||
properties
|
||||
.put("spring_datasource_url", this.processorProperties
|
||||
.getDataSourceUrl());
|
||||
}
|
||||
if(StringUtils.hasText(processorProperties.getDataSourceDriverClassName())){
|
||||
properties.put("spring_datasource_driverClassName",processorProperties.getDataSourceDriverClassName());
|
||||
if (StringUtils
|
||||
.hasText(this.processorProperties.getDataSourceDriverClassName())) {
|
||||
properties.put("spring_datasource_driverClassName", this.processorProperties
|
||||
.getDataSourceDriverClassName());
|
||||
}
|
||||
if(StringUtils.hasText(processorProperties.getDataSourceUserName())){
|
||||
properties.put("spring_datasource_username",processorProperties.getDataSourceUserName());
|
||||
if (StringUtils.hasText(this.processorProperties.getDataSourceUserName())) {
|
||||
properties.put("spring_datasource_username", this.processorProperties
|
||||
.getDataSourceUserName());
|
||||
}
|
||||
if(StringUtils.hasText(processorProperties.getDataSourcePassword())){
|
||||
properties.put("spring_datasource_password",processorProperties.getDataSourcePassword());
|
||||
if (StringUtils.hasText(this.processorProperties.getDataSourcePassword())) {
|
||||
properties.put("spring_datasource_password", this.processorProperties
|
||||
.getDataSourcePassword());
|
||||
}
|
||||
properties.put("payload", message);
|
||||
|
||||
TaskLaunchRequest request = new TaskLaunchRequest(
|
||||
processorProperties.getUri(), null, properties, null,
|
||||
processorProperties.getApplicationName());
|
||||
this.processorProperties.getUri(), null, properties, null,
|
||||
this.processorProperties.getApplicationName());
|
||||
|
||||
return new GenericMessage<TaskLaunchRequest>(request);
|
||||
return new GenericMessage<>(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
@@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
public class TaskProcessorProperties {
|
||||
|
||||
private static final String DEFAULT_URI = "maven://org.springframework.cloud.task.app:"
|
||||
+ "timestamp-task:jar:1.0.1.RELEASE";
|
||||
+ "timestamp-task:jar:1.0.1.RELEASE";
|
||||
|
||||
|
||||
private String uri = DEFAULT_URI;
|
||||
@@ -41,9 +41,8 @@ public class TaskProcessorProperties {
|
||||
private String applicationName;
|
||||
|
||||
|
||||
|
||||
public String getDataSourceUrl() {
|
||||
return dataSourceUrl;
|
||||
return this.dataSourceUrl;
|
||||
}
|
||||
|
||||
public void setDataSourceUrl(String dataSourceUrl) {
|
||||
@@ -51,7 +50,7 @@ public class TaskProcessorProperties {
|
||||
}
|
||||
|
||||
public String getDataSourceDriverClassName() {
|
||||
return dataSourceDriverClassName;
|
||||
return this.dataSourceDriverClassName;
|
||||
}
|
||||
|
||||
public void setDataSourceDriverClassName(String dataSourceDriverClassName) {
|
||||
@@ -59,7 +58,7 @@ public class TaskProcessorProperties {
|
||||
}
|
||||
|
||||
public String getDataSourceUserName() {
|
||||
return dataSourceUserName;
|
||||
return this.dataSourceUserName;
|
||||
}
|
||||
|
||||
public void setDataSourceUserName(String dataSourceUserName) {
|
||||
@@ -67,7 +66,7 @@ public class TaskProcessorProperties {
|
||||
}
|
||||
|
||||
public String getDataSourcePassword() {
|
||||
return dataSourcePassword;
|
||||
return this.dataSourcePassword;
|
||||
}
|
||||
|
||||
public void setDataSourcePassword(String dataSourcePassword) {
|
||||
@@ -75,7 +74,7 @@ public class TaskProcessorProperties {
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
return this.uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
@@ -83,7 +82,7 @@ public class TaskProcessorProperties {
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return applicationName;
|
||||
return this.applicationName;
|
||||
}
|
||||
|
||||
public void setApplicationName(String applicationName) {
|
||||
|
||||
@@ -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.
|
||||
@@ -33,8 +33,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Glenn Renfro
|
||||
@@ -53,18 +52,21 @@ public class TaskProcessorApplicationTests {
|
||||
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
public void test() throws InterruptedException, IOException {
|
||||
channels.input().send(new GenericMessage<Object>(DEFAULT_PAYLOAD));
|
||||
Map<String, String> properties = new HashMap();
|
||||
properties.put("payload", DEFAULT_PAYLOAD);
|
||||
TaskLaunchRequest expectedRequest = new TaskLaunchRequest(
|
||||
"maven://org.springframework.cloud.task.app:"
|
||||
+ "timestamp-task:jar:1.0.1.RELEASE", null, properties,
|
||||
null, null);
|
||||
Message<String> result = (Message<String>)collector.forChannel(channels.output()).take();
|
||||
TaskLaunchRequest tlq = mapper.readValue(result.getPayload(),TaskLaunchRequest.class);
|
||||
assertThat(tlq, is(expectedRequest));
|
||||
}
|
||||
@Test
|
||||
public void test() throws InterruptedException, IOException {
|
||||
this.channels.input().send(new GenericMessage<Object>(DEFAULT_PAYLOAD));
|
||||
Map<String, String> properties = new HashMap();
|
||||
properties.put("payload", DEFAULT_PAYLOAD);
|
||||
TaskLaunchRequest expectedRequest = new TaskLaunchRequest(
|
||||
"maven://org.springframework.cloud.task.app:"
|
||||
+ "timestamp-task:jar:1.0.1.RELEASE", null, properties,
|
||||
null, null);
|
||||
Message<String> result = (Message<String>) this.collector
|
||||
.forChannel(this.channels.output())
|
||||
.take();
|
||||
TaskLaunchRequest tlq = this.mapper
|
||||
.readValue(result.getPayload(), TaskLaunchRequest.class);
|
||||
assertThat(tlq).isEqualTo(expectedRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user