|
1 | 1 | /*
|
2 |
| - * Copyright 2006-2022 the original author or authors. |
| 2 | + * Copyright 2006-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
18 | 18 |
|
19 | 19 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
20 | 20 |
|
21 |
| -import javax.sql.DataSource; |
22 |
| - |
23 | 21 | import org.apache.commons.logging.Log;
|
24 | 22 | import org.apache.commons.logging.LogFactory;
|
25 | 23 | import org.junit.jupiter.api.Test;
|
|
29 | 27 | import org.springframework.batch.core.JobParametersBuilder;
|
30 | 28 | import org.springframework.batch.core.StepExecution;
|
31 | 29 | import org.springframework.batch.core.launch.JobLauncher;
|
32 |
| -import org.springframework.batch.core.test.AbstractIntegrationTests; |
33 |
| -import org.springframework.batch.support.DatabaseType; |
34 | 30 | import org.springframework.beans.factory.annotation.Autowired;
|
35 |
| -import org.springframework.jdbc.core.JdbcTemplate; |
36 | 31 | import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
37 | 32 |
|
38 | 33 | /**
|
|
41 | 36 | *
|
42 | 37 | */
|
43 | 38 | @SpringJUnitConfig(locations = { "/simple-job-launcher-context.xml", "/META-INF/batch/footballSkipJob.xml" })
|
44 |
| -public class FootballJobSkipIntegrationTests extends AbstractIntegrationTests { |
| 39 | +public class FootballJobSkipIntegrationTests { |
45 | 40 |
|
46 | 41 | /** Logger */
|
47 | 42 | private final Log logger = LogFactory.getLog(getClass());
|
48 | 43 |
|
49 |
| - private JdbcTemplate jdbcTemplate; |
50 |
| - |
51 | 44 | @Autowired
|
52 | 45 | private JobLauncher jobLauncher;
|
53 | 46 |
|
54 | 47 | @Autowired
|
55 | 48 | private Job job;
|
56 | 49 |
|
57 |
| - private DatabaseType databaseType; |
58 |
| - |
59 |
| - @Autowired |
60 |
| - public void setDataSource(DataSource dataSource) throws Exception { |
61 |
| - this.dataSource = dataSource; |
62 |
| - this.jdbcTemplate = new JdbcTemplate(dataSource); |
63 |
| - databaseType = DatabaseType.fromMetaData(dataSource); |
64 |
| - } |
65 |
| - |
66 | 50 | @Test
|
67 | 51 | void testLaunchJob() throws Exception {
|
68 |
| - try { |
69 |
| - if (databaseType == DatabaseType.POSTGRES || databaseType == DatabaseType.ORACLE) { |
70 |
| - // Extra special test for these platforms (would have failed |
71 |
| - // the job with UNKNOWN status in Batch 2.0): |
72 |
| - jdbcTemplate.update("SET CONSTRAINTS ALL DEFERRED"); |
73 |
| - } |
74 |
| - } |
75 |
| - catch (Exception e) { |
76 |
| - // Ignore (wrong platform) |
77 |
| - } |
78 | 52 | JobExecution execution = jobLauncher.run(job,
|
79 | 53 | new JobParametersBuilder().addLong("skip.limit", 0L).toJobParameters());
|
80 | 54 | assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
|
0 commit comments