Merged MapTaskExecutionTests into TaskExecutionDaoTests
Removes duplicated code. Resolves #427
This commit is contained in:
@@ -55,17 +55,23 @@ public class ExternalDataSourceConfiguration {
|
||||
@Primary
|
||||
public DataSource dataSource(
|
||||
@Qualifier("springDataSourceProperties") DataSourceProperties springDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(springDataSourceProperties.getDriverClassName())
|
||||
.url(springDataSourceProperties.getUrl()).password(springDataSourceProperties.getPassword())
|
||||
.username(springDataSourceProperties.getUsername()).build();
|
||||
return DataSourceBuilder.create()
|
||||
.driverClassName(springDataSourceProperties.getDriverClassName())
|
||||
.url(springDataSourceProperties.getUrl())
|
||||
.password(springDataSourceProperties.getPassword())
|
||||
.username(springDataSourceProperties.getUsername())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource secondDataSource(
|
||||
@Qualifier("secondDataSourceProperties") DataSourceProperties secondDataSourceProperties) {
|
||||
return DataSourceBuilder.create().driverClassName(secondDataSourceProperties.getDriverClassName())
|
||||
.url(secondDataSourceProperties.getUrl()).password(secondDataSourceProperties.getPassword())
|
||||
.username(secondDataSourceProperties.getUsername()).build();
|
||||
return DataSourceBuilder.create()
|
||||
.driverClassName(secondDataSourceProperties.getDriverClassName())
|
||||
.url(secondDataSourceProperties.getUrl())
|
||||
.password(secondDataSourceProperties.getPassword())
|
||||
.username(secondDataSourceProperties.getUsername())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,11 +39,12 @@ public class MultiDataSourcesApplicationTests {
|
||||
String output = capturedOutput.toString();
|
||||
|
||||
assertThat(output.contains("There are 2 DataSources within this application"))
|
||||
.as("Unable to find CommandLineRunner output: " + output).isTrue();
|
||||
.as("Unable to find CommandLineRunner output: " + output)
|
||||
.isTrue();
|
||||
assertThat(output.contains("Creating: TaskExecution{")).as("Unable to find start task message: " + output)
|
||||
.isTrue();
|
||||
.isTrue();
|
||||
assertThat(output.contains("Updating: TaskExecution")).as("Unable to find update task message: " + output)
|
||||
.isTrue();
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,11 +78,12 @@ public class MultiDataSourcesExternalApplicationTests {
|
||||
String output = capturedOutput.toString();
|
||||
|
||||
assertThat(output.contains("There are 2 DataSources within this application"))
|
||||
.as("Unable to find CommandLineRunner output: " + output).isTrue();
|
||||
.as("Unable to find CommandLineRunner output: " + output)
|
||||
.isTrue();
|
||||
assertThat(output.contains("Creating: TaskExecution{")).as("Unable to find start task message: " + output)
|
||||
.isTrue();
|
||||
.isTrue();
|
||||
assertThat(output.contains("Updating: TaskExecution")).as("Unable to find update task message: " + output)
|
||||
.isTrue();
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@@ -97,8 +98,10 @@ public class MultiDataSourcesExternalApplicationTests {
|
||||
Server server = null;
|
||||
try {
|
||||
if (defaultServer == null) {
|
||||
server = Server.createTcpServer("-ifNotExists", "-tcp", "-tcpAllowOthers", "-tcpPort",
|
||||
String.valueOf(randomPort)).start();
|
||||
server = Server
|
||||
.createTcpServer("-ifNotExists", "-tcp", "-tcpAllowOthers", "-tcpPort",
|
||||
String.valueOf(randomPort))
|
||||
.start();
|
||||
defaultServer = server;
|
||||
}
|
||||
}
|
||||
@@ -113,8 +116,10 @@ public class MultiDataSourcesExternalApplicationTests {
|
||||
Server server = null;
|
||||
try {
|
||||
if (secondServer == null) {
|
||||
server = Server.createTcpServer("-ifNotExists", "-tcp", "-tcpAllowOthers", "-tcpPort",
|
||||
String.valueOf(secondRandomPort)).start();
|
||||
server = Server
|
||||
.createTcpServer("-ifNotExists", "-tcp", "-tcpAllowOthers", "-tcpPort",
|
||||
String.valueOf(secondRandomPort))
|
||||
.start();
|
||||
secondServer = server;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user