Updated to files to fit the Standard.

This commit is contained in:
Glenn Renfro
2022-07-25 11:41:43 -04:00
parent 39908bb499
commit 76a5d12136
200 changed files with 2839 additions and 4125 deletions

View File

@@ -48,30 +48,25 @@ public class TaskProcessor {
String message = messagePayload.getPayload();
Map<String, String> properties = new HashMap<>();
if (StringUtils.hasText(this.processorProperties.getDataSourceUrl())) {
properties
.put("spring_datasource_url", this.processorProperties
.getDataSourceUrl());
properties.put("spring_datasource_url", this.processorProperties.getDataSourceUrl());
}
if (StringUtils
.hasText(this.processorProperties.getDataSourceDriverClassName())) {
properties.put("spring_datasource_driverClassName", this.processorProperties
.getDataSourceDriverClassName());
if (StringUtils.hasText(this.processorProperties.getDataSourceDriverClassName())) {
properties.put("spring_datasource_driverClassName",
this.processorProperties.getDataSourceDriverClassName());
}
if (StringUtils.hasText(this.processorProperties.getDataSourceUserName())) {
properties.put("spring_datasource_username", this.processorProperties
.getDataSourceUserName());
properties.put("spring_datasource_username", this.processorProperties.getDataSourceUserName());
}
if (StringUtils.hasText(this.processorProperties.getDataSourcePassword())) {
properties.put("spring_datasource_password", this.processorProperties
.getDataSourcePassword());
properties.put("spring_datasource_password", this.processorProperties.getDataSourcePassword());
}
properties.put("payload", message);
TaskLaunchRequest request = new TaskLaunchRequest(
this.processorProperties.getUri(), null, properties, null,
this.processorProperties.getApplicationName());
TaskLaunchRequest request = new TaskLaunchRequest(this.processorProperties.getUri(), null, properties, null,
this.processorProperties.getApplicationName());
return MessageBuilder.withPayload(request).build();
};
}
}

View File

@@ -28,4 +28,5 @@ public class TaskProcessorApplication {
public static void main(String[] args) {
SpringApplication.run(TaskProcessorApplication.class, args);
}
}

View File

@@ -25,8 +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;
@@ -40,7 +39,6 @@ public class TaskProcessorProperties {
private String applicationName;
public String getDataSourceUrl() {
return this.dataSourceUrl;
}
@@ -88,4 +86,5 @@ public class TaskProcessorProperties {
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
}

View File

@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.AfterEach;
@@ -53,6 +52,7 @@ public class TaskProcessorApplicationTests {
private static final String DEFAULT_PAYLOAD = "hello";
private final ObjectMapper objectMapper = new ObjectMapper();
private ConfigurableApplicationContext applicationContext;
@BeforeEach
@@ -72,22 +72,19 @@ public class TaskProcessorApplicationTests {
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);
"maven://org.springframework.cloud.task.app:" + "timestamp-task:jar:1.0.1.RELEASE", null, properties,
null, null);
List<Message<byte[]>> result = testListener("output", 1);
TaskLaunchRequest tlq = objectMapper.readValue(result.get(0).getPayload(), TaskLaunchRequest.class);
assertThat(tlq).isEqualTo(expectedRequest);
}
private List<Message<byte[]>> testListener(String bindingName, int numberToRead) {
List<Message<byte[]>> results = new ArrayList<>();
this.applicationContext = new SpringApplicationBuilder()
.sources(TestChannelBinderConfiguration
.getCompleteConfiguration(TaskProcessorTestApplication.class)).web(WebApplicationType.NONE)
.run();
.sources(TestChannelBinderConfiguration.getCompleteConfiguration(TaskProcessorTestApplication.class))
.web(WebApplicationType.NONE).run();
InputDestination input = this.applicationContext.getBean(InputDestination.class);
OutputDestination target = this.applicationContext.getBean(OutputDestination.class);
@@ -99,7 +96,9 @@ public class TaskProcessorApplicationTests {
}
@SpringBootApplication
@Import({TaskProcessor.class})
@Import({ TaskProcessor.class })
public static class TaskProcessorTestApplication {
}
}