Updated tests to remove deprecated code from tests

* cleanup removing unused headers
* Updated asserts in code base that needed messages (marked as deprecated)
* left one test that was testing a deprecated constructor.  When that code is removed we can remove that test.
* some other cleanup

resolves #338
This commit is contained in:
Glenn Renfro
2018-01-05 09:30:26 -05:00
committed by Michael Minella
parent c4324b550d
commit 3ad9efe3fe
25 changed files with 36 additions and 46 deletions

View File

@@ -101,7 +101,7 @@ public class JpaApplicationTests {
assertTrue("Unable to find the insert message: " + output, output.contains(INSERT_MESSAGE));
JdbcTemplate template = new JdbcTemplate(this.dataSource);
Map<String, Object> result = template.queryForMap("Select * from TASK_RUN_OUTPUT");
assertThat(((Long) result.get("ID")), is(1L));
assertThat((result.get("ID")), is(1L));
assertThat(((String) result.get("OUTPUT")), containsString("Executed at"));
}

View File

@@ -43,7 +43,6 @@ import org.springframework.cloud.deployer.resource.support.DelegatingResourceLoa
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
import org.springframework.cloud.task.batch.partition.DeployerPartitionHandler;
import org.springframework.cloud.task.batch.partition.DeployerStepExecutionHandler;
import org.springframework.cloud.task.batch.partition.NoOpEnvironmentVariablesProvider;
import org.springframework.cloud.task.batch.partition.PassThroughCommandLineArgsProvider;
import org.springframework.cloud.task.batch.partition.SimpleEnvironmentVariablesProvider;
import org.springframework.context.ConfigurableApplicationContext;

View File

@@ -38,7 +38,6 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.SocketUtils;
@@ -97,7 +96,7 @@ public class TaskPartitionerTests {
"--spring.datasource.username=" + DATASOURCE_USER_NAME,
"--spring.datasource.driverClassName=" + DATASOURCE_DRIVER_CLASS_NAME);
Page<TaskExecution> taskExecutions = taskExplorer.findAll(new PageRequest(0, 10));
Page<TaskExecution> taskExecutions = taskExplorer.findAll(PageRequest.of(0, 10));
assertEquals("Five rows are expected", 5, taskExecutions.getTotalElements());
assertEquals("Only One master is expected", 1, taskExplorer.getTaskExecutionCountByTaskName("Partitioned Batch Job Task:master:0"));
assertEquals("4 partitions is expected", 4, taskExplorer.getTaskExecutionCountByTaskName("Partitioned Batch Job Task:worker:0"));

View File

@@ -35,7 +35,6 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.springframework.cloud.stream.test.matcher.MessageQueueMatcher.receivesPayloadThat;
/**
* @author Glenn Renfro

View File

@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
@@ -32,7 +32,8 @@ public class TimestampTaskPropertiesTests {
@Test(expected = IllegalArgumentException.class)
public void testEmptyFormat() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(context, "format:");
TestPropertyValues testPropertyValues = TestPropertyValues.of("format:");
testPropertyValues.applyTo(context);
context.register(Conf.class);
context.refresh();
TimestampTaskProperties properties = context.getBean(TimestampTaskProperties.class);