Updated the test so that it will now work.

We will need to add a new task to the bamboo integration tests for SCT.
In this task we will pass in the parameters
This will be run after the other integration tasks.
This commit is contained in:
Glenn Renfro
2019-10-14 15:21:05 -04:00
committed by Michael Minella
parent 6a5a81b554
commit 068df27723
3 changed files with 14 additions and 12 deletions

View File

@@ -63,7 +63,6 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -80,7 +80,7 @@ public class JobConfiguration {
@Bean
public PartitionHandler partitionHandler(TaskLauncher taskLauncher, JobExplorer jobExplorer) throws Exception {
Resource resource = this.resourceLoader
.getResource("maven://io.spring.cloud:partitioned-batch-job:1.1.0.RELEASE");
.getResource("maven://io.spring.cloud:partitioned-batch-job:2.2.0.BUILD-SNAPSHOT");
DeployerPartitionHandler partitionHandler =
new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, "workerStep");

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.task.partitioner;
import java.sql.SQLException;
import java.util.Properties;
import javax.sql.DataSource;
@@ -91,21 +92,21 @@ public class TaskPartitionerTests {
public void testWithLocalDeployer() throws Exception {
SpringApplication app = new SpringApplication(PartitionedBatchJobApplication.class);
app.setAdditionalProfiles("master");
app.run("--server.port=0", "--spring.datasource.url=" + DATASOURCE_URL,
"--spring.datasource.username=" + DATASOURCE_USER_NAME,
"--spring.datasource.driverClassName=" + DATASOURCE_DRIVER_CLASS_NAME,
"--spring.cloud.deployer.local.use-spring-application-json=false");
Properties properties = new Properties();
properties.setProperty("spring.datasource.url", DATASOURCE_URL);
properties.setProperty("spring.datasource.username", DATASOURCE_USER_NAME);
properties.setProperty("spring.datasource.driverClassName", DATASOURCE_DRIVER_CLASS_NAME);
properties.setProperty("spring.cloud.deployer.local.use-spring-application-json", "false");
app.setDefaultProperties(properties);
app.run();
Page<TaskExecution> taskExecutions = this.taskExplorer
.findAll(PageRequest.of(0, 10));
assertThat(taskExecutions.getTotalElements()).as("Five rows are expected")
.isEqualTo(5);
assertThat(this.taskExplorer
.getTaskExecutionCountByTaskName("Partitioned Batch Job Task:master:0"))
.getTaskExecutionCountByTaskName("PartitionedBatchJobTask"))
.as("Only One master is expected").isEqualTo(1);
assertThat(this.taskExplorer
.getTaskExecutionCountByTaskName("Partitioned Batch Job Task:worker:0"))
.as("4 partitions is expected").isEqualTo(4);
for (TaskExecution taskExecution : taskExecutions) {
assertThat(taskExecution.getExitCode()
.intValue()).as("return code should be 0").isEqualTo(0);
@@ -119,8 +120,10 @@ public class TaskPartitionerTests {
public org.h2.tools.Server initH2TCPServer() {
Server server;
try {
server = Server.createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort",
String.valueOf(randomPort)).start();
server = Server
.createTcpServer("-tcp", "-ifNotExists", "-tcpAllowOthers", "-tcpPort", String
.valueOf(randomPort))
.start();
}
catch (SQLException e) {
throw new IllegalStateException(e);