Skip to content

Commit 78f27ef

Browse files
committed
Base Task Sink Case with Tests works
In process of migrating batch-events to streambridge BatchEvents Migrated Integration tests for TaskSink now work Batch Event Integration Tests updated Added tests to batch events Event integration tests added Updated with the last bit of tests baseline polishing
1 parent f74d38a commit 78f27ef

File tree

39 files changed

+1146
-1121
lines changed

39 files changed

+1146
-1121
lines changed

pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@
7474
<version>${spring-cloud-deployer-local.version}</version>
7575
<scope>test</scope>
7676
</dependency>
77-
<dependency>
78-
<groupId>org.springframework.cloud</groupId>
79-
<artifactId>spring-cloud-stream-test-support-internal</artifactId>
80-
<version>${spring-cloud-stream.version}</version>
81-
</dependency>
8277
<dependency>
8378
<groupId>org.springframework.cloud</groupId>
8479
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
@@ -89,11 +84,6 @@
8984
<artifactId>spring-cloud-stream</artifactId>
9085
<version>${spring-cloud-stream.version}</version>
9186
</dependency>
92-
<dependency>
93-
<groupId>org.springframework.cloud</groupId>
94-
<artifactId>spring-cloud-stream-test-support</artifactId>
95-
<version>${spring-cloud-stream.version}</version>
96-
</dependency>
9787
</dependencies>
9888
</dependencyManagement>
9989

spring-cloud-task-integration-tests/pom.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141
<artifactId>spring-boot-starter-test</artifactId>
4242
<scope>test</scope>
4343
</dependency>
44-
<dependency>
45-
<groupId>org.springframework.cloud</groupId>
46-
<artifactId>spring-cloud-stream-test-support-internal</artifactId>
47-
<scope>test</scope>
48-
</dependency>
4944
<dependency>
5045
<groupId>org.springframework.cloud</groupId>
5146
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
@@ -113,6 +108,19 @@
113108
<version>${test.ducttape.version}</version>
114109
<scope>test</scope>
115110
</dependency>
111+
<dependency>
112+
<groupId>org.springframework.cloud</groupId>
113+
<artifactId>spring-cloud-stream</artifactId>
114+
<version>${spring-cloud-stream.version}</version>
115+
<type>test-jar</type>
116+
<classifier>test-binder</classifier>
117+
<scope>test</scope>
118+
</dependency>
119+
<dependency>
120+
<groupId>org.springframework.cloud</groupId>
121+
<artifactId>spring-cloud-stream</artifactId>
122+
<scope>test</scope>
123+
</dependency>
116124
</dependencies>
117125
<build>
118126
<plugins>

spring-cloud-task-integration-tests/src/test/java/configuration/JobConfiguration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2021-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
import org.springframework.batch.item.support.ListItemReader;
3333
import org.springframework.batch.repeat.RepeatStatus;
3434
import org.springframework.beans.factory.annotation.Autowired;
35+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3536
import org.springframework.context.annotation.Bean;
3637
import org.springframework.context.annotation.Configuration;
3738

@@ -40,6 +41,8 @@
4041
*/
4142
@Configuration
4243
@EnableBatchProcessing
44+
@ConditionalOnProperty(prefix = "spring.cloud.task.test", name = "enable-job-configuration",
45+
havingValue = "true")
4346
public class JobConfiguration {
4447

4548
private static final int DEFAULT_CHUNK_COUNT = 3;

spring-cloud-task-integration-tests/src/test/java/configuration/JobSkipConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.batch.item.ItemProcessor;
2828
import org.springframework.batch.repeat.RepeatStatus;
2929
import org.springframework.beans.factory.annotation.Autowired;
30+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3031
import org.springframework.context.annotation.Bean;
3132
import org.springframework.context.annotation.Configuration;
3233

@@ -35,6 +36,7 @@
3536
*/
3637
@Configuration
3738
@EnableBatchProcessing
39+
@ConditionalOnProperty(prefix = "spring.cloud.task.test", name = "enable-fail-job-configuration")
3840
public class JobSkipConfiguration {
3941

4042
@Autowired

spring-cloud-task-integration-tests/src/test/java/org/springframework/cloud/task/launcher/TaskLauncherSinkTests.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@
3636
import org.springframework.cloud.deployer.spi.local.LocalDeployerProperties;
3737
import org.springframework.cloud.deployer.spi.local.LocalTaskLauncher;
3838
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
39-
import org.springframework.cloud.stream.messaging.Sink;
39+
import org.springframework.cloud.stream.function.StreamBridge;
4040
import org.springframework.cloud.task.launcher.app.TaskLauncherSinkApplication;
4141
import org.springframework.cloud.task.repository.TaskExecution;
4242
import org.springframework.cloud.task.repository.TaskExplorer;
@@ -62,15 +62,17 @@
6262
classes = { TaskLauncherSinkApplication.class,
6363
TaskLauncherSinkTests.TaskLauncherConfiguration.class },
6464
properties = {
65-
"maven.remote-repositories.repo1.url=https://repo.spring.io/libs-release" })
65+
"maven.remote-repositories.repo1.url=https://repo.spring.io/libs-release",
66+
"spring.cloud.stream.function.bindings.taskLauncherSink-in-0=input",
67+
"spring.cloud.stream.bindings.input.destination=taskLauncherSinkExchange" })
6668
public class TaskLauncherSinkTests {
6769

6870
private final static int WAIT_INTERVAL = 500;
6971

7072
private final static int MAX_WAIT_TIME = 120000;
7173

7274
private final static String URL = "maven://org.springframework.cloud.task.app:"
73-
+ "timestamp-task:2.0.0.RELEASE";
75+
+ "timestamp-task:2.1.1.RELEASE";
7476

7577
private final static String DATASOURCE_URL;
7678

@@ -96,7 +98,7 @@ public class TaskLauncherSinkTests {
9698
}
9799

98100
@Autowired
99-
private Sink sink;
101+
private StreamBridge streamBridge;
100102

101103
private DataSource dataSource;
102104

@@ -185,11 +187,10 @@ private boolean waitForTaskToComplete() throws Exception {
185187
}
186188

187189
private void launchTask(String artifactURL) {
188-
189190
TaskLaunchRequest request = new TaskLaunchRequest(artifactURL, null,
190191
this.properties, null, null);
191192
GenericMessage<TaskLaunchRequest> message = new GenericMessage<>(request);
192-
this.sink.input().send(message);
193+
this.streamBridge.send("taskLauncherSinkExchange", message);
193194
}
194195

195196
@Configuration

0 commit comments

Comments
 (0)