diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/pom.xml b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/pom.xml index d1e9777..0c85e99 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/pom.xml +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/pom.xml @@ -45,6 +45,12 @@ org.springframework.boot spring-boot-starter-test test + + + org.junit.vintage + junit-vintage-engine + + org.springframework.batch diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillrunApplicationTests.java b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillRunApplicationTests.java similarity index 53% rename from dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillrunApplicationTests.java rename to dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillRunApplicationTests.java index ebfac98..f965399 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillrunApplicationTests.java +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billrun/src/test/java/io/spring/billrun/BillRunApplicationTests.java @@ -1,42 +1,32 @@ package io.spring.billrun; -import java.util.List; - import io.spring.billrun.model.Bill; -import javax.sql.DataSource; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.batch.test.context.SpringBatchTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.junit4.SpringRunner; -import static org.junit.Assert.assertEquals; +import javax.sql.DataSource; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; -@RunWith(SpringRunner.class) @SpringBootTest -@SpringBatchTest -public class BillrunApplicationTests { +public class BillRunApplicationTests { @Autowired private DataSource dataSource; private JdbcTemplate jdbcTemplate; - @Before - public void setup() { + @BeforeEach + public void setup() { this.jdbcTemplate = new JdbcTemplate(this.dataSource); } @Test public void testJobResults() { - testResult(); - } - - private void testResult() { List billStatements = this.jdbcTemplate.query("select id, " + "first_name, last_name, minutes, data_usage, bill_amount " + "FROM bill_statements ORDER BY id", @@ -44,14 +34,15 @@ public class BillrunApplicationTests { rs.getString("FIRST_NAME"), rs.getString("LAST_NAME"), rs.getLong("DATA_USAGE"), rs.getLong("MINUTES"), rs.getDouble("bill_amount"))); - assertEquals(5, billStatements.size()); + assertThat(billStatements.size()).isEqualTo(5); Bill billStatement = billStatements.get(0); - assertEquals(6, billStatement.getBillAmount(), 1e-15); - assertEquals("jane", billStatement.getFirstName()); - assertEquals("doe", billStatement.getLastName()); - assertEquals(new Long(1), billStatement.getId()); - assertEquals(new Long(500), billStatement.getMinutes()); - assertEquals(new Long(1000), billStatement.getDataUsage()); + assertThat(billStatement.getBillAmount()).isEqualTo(6.0); + assertThat(billStatement.getFirstName()).isEqualTo("jane"); + assertThat(billStatement.getLastName()).isEqualTo("doe"); + assertThat(billStatement.getId()).isEqualTo(1); + assertThat(billStatement.getMinutes()).isEqualTo(500); + assertThat(billStatement.getDataUsage()).isEqualTo(1000); + } -} +} \ No newline at end of file diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/pom.xml b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/pom.xml index d91c003..5326f9d 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/pom.xml +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/pom.xml @@ -44,6 +44,12 @@ org.springframework.boot spring-boot-starter-test test + + + org.junit.vintage + junit-vintage-engine + + com.fasterxml.jackson.core diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillSetuptaskApplicationTests.java b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillSetuptaskApplicationTests.java new file mode 100644 index 0000000..f1e5196 --- /dev/null +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillSetuptaskApplicationTests.java @@ -0,0 +1,26 @@ +package io.spring.billsetuptask; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.jdbc.core.JdbcTemplate; + +import javax.sql.DataSource; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +class BillSetupTaskApplicationTests { + + @Autowired + private DataSource dataSource; + + @Test + public void testRepository() { + JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource); + int result = jdbcTemplate.queryForObject( + "SELECT COUNT(*) FROM BILL_STATEMENTS", Integer.class); + assertThat(result).isEqualTo(0); + } + +} diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillsetuptaskApplicationTests.java b/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillsetuptaskApplicationTests.java deleted file mode 100644 index d59a53f..0000000 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/billsetuptask/src/test/java/io/spring/billsetuptask/BillsetuptaskApplicationTests.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.billsetuptask; - -import javax.sql.DataSource; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.junit.Assert.assertEquals; - - -@RunWith(SpringRunner.class) -@SpringBootTest -public class BillsetuptaskApplicationTests { - - @Autowired - private DataSource dataSource; - - @Test - public void testRepository() { - JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource); - int result = jdbcTemplate.queryForObject( - "SELECT COUNT(*) FROM BILL_STATEMENTS", Integer.class); - - assertEquals(0, result); - } -} diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/dist/batchsamples.zip b/dataflow-website/batch-developer-guides/batch/batchsamples/dist/batchsamples.zip index 371f611..6c5f44f 100644 Binary files a/dataflow-website/batch-developer-guides/batch/batchsamples/dist/batchsamples.zip and b/dataflow-website/batch-developer-guides/batch/batchsamples/dist/batchsamples.zip differ diff --git a/dataflow-website/batch-developer-guides/batch/batchsamples/pom.xml b/dataflow-website/batch-developer-guides/batch/batchsamples/pom.xml index 8dc2bf2..1b23452 100644 --- a/dataflow-website/batch-developer-guides/batch/batchsamples/pom.xml +++ b/dataflow-website/batch-developer-guides/batch/batchsamples/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.0.BUILD-SNAPSHOT + 2.2.2.RELEASE @@ -34,14 +34,6 @@ - - org.springframework.cloud - spring-cloud-task-dependencies - 2.2.0.BUILD-SNAPSHOT - pom - import - - org.springframework.cloud spring-cloud-dependencies diff --git a/dataflow-website/batch-developer-guides/batch/simple-task/simple-task.zip b/dataflow-website/batch-developer-guides/batch/simple-task/simple-task.zip new file mode 100644 index 0000000..e69de29