diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 60a309433d..60b898a209 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -26,10 +26,7 @@ jobs: with: java-version: '17' distribution: 'liberica' - - uses: jvalkeal/setup-maven@v1 - with: - maven-version: 3.8.8 - maven-mirror: 'https://dlcdn.apache.org/maven/maven-3/' +# secrets not available to PR. # - name: Login dockerhub # if: ${{ secrets.DOCKERHUB_USERNAME != null && secrets.DOCKERHUB_USERNAME != '' }} # uses: docker/login-action@v3 @@ -39,14 +36,7 @@ jobs: # build - name: Build run: | - mvn -B -s .github/settings.xml clean install - - name: Capture Test Results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: Unit Tests - path: '**/surefire-reports/*.xml' - retention-days: 3 + ./mvnw -B -s .github/settings.xml -Pasciidoctordocs,restdocs clean install # clean m2 cache - name: Clean cache run: | diff --git a/spring-cloud-dataflow-registry/src/test/java/org/springframework/cloud/dataflow/registry/support/AppResourceCommonTests.java b/spring-cloud-dataflow-registry/src/test/java/org/springframework/cloud/dataflow/registry/support/AppResourceCommonTests.java index a98fb182cc..d9aebbf734 100644 --- a/spring-cloud-dataflow-registry/src/test/java/org/springframework/cloud/dataflow/registry/support/AppResourceCommonTests.java +++ b/spring-cloud-dataflow-registry/src/test/java/org/springframework/cloud/dataflow/registry/support/AppResourceCommonTests.java @@ -47,6 +47,7 @@ class AppResourceCommonTests { private AppResourceCommon appResourceCommon = new AppResourceCommon(new MavenProperties(), resourceLoader); @Test + void badNamedJars() throws Exception { UrlResource urlResource = new UrlResource("https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/file-sink-rabbit/5.0.0/file-sink-rabbit.jar"); assertThatIllegalArgumentException().isThrownBy( () -> appResourceCommon.getUrlResourceVersion(urlResource)); diff --git a/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/AppRegistryControllerTests.java b/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/AppRegistryControllerTests.java index 7bc7afcaa6..be6084821f 100644 --- a/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/AppRegistryControllerTests.java +++ b/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/AppRegistryControllerTests.java @@ -717,6 +717,7 @@ void pagination() throws Exception { } @Test + void listApplicationsByVersion() throws Exception { mockMvc.perform(get("/apps?version=5.0.0").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) diff --git a/spring-cloud-dataflow-shell-core/src/test/java/org/springframework/cloud/dataflow/shell/command/JobCommandTests.java b/spring-cloud-dataflow-shell-core/src/test/java/org/springframework/cloud/dataflow/shell/command/JobCommandTests.java index d341da75cb..f0af93f4a6 100644 --- a/spring-cloud-dataflow-shell-core/src/test/java/org/springframework/cloud/dataflow/shell/command/JobCommandTests.java +++ b/spring-cloud-dataflow-shell-core/src/test/java/org/springframework/cloud/dataflow/shell/command/JobCommandTests.java @@ -16,13 +16,13 @@ package org.springframework.cloud.dataflow.shell.command; -import javax.sql.DataSource; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.BiConsumer; + +import javax.sql.DataSource; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -38,7 +38,6 @@ import org.springframework.batch.core.JobParameter; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobRepository; @@ -51,8 +50,6 @@ import org.springframework.shell.table.Table; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Glenn Renfro @@ -159,9 +156,7 @@ void viewExecution() { logger.info("Retrieve Job Execution Detail by Id"); Table table = getTable(job().executionDisplay(getFirstJobExecutionIdFromTable())); verifyColumnNumber(table, 2); - assertEquals(19, - table.getModel().getRowCount(), - "Number of expected rows returned from the table is incorrect"); + assertThat(table.getModel().getRowCount()).as("Number of expected rows returned from the table is incorrect").isEqualTo(19); int rowNumber = 0; checkCell(table, rowNumber++, 0, "Key "); checkCell(table, rowNumber++, 0, "Job Execution Id "); @@ -181,14 +176,11 @@ void viewExecution() { checkCell(table, rowNumber++, 0, "Job Parameters "); int paramRowOne = rowNumber; - assertTrue(checkModelColumn(paramRowOne, table, "-foo(java.lang.String) "), - "the table did not contain the correct job parameters for job parameter value foo"); + assertThat(checkModelColumn(paramRowOne, table, "-foo(java.lang.String) ")).as("the table did not contain the correct job parameters for job parameter value foo").isTrue(); - assertTrue(checkModelColumn(paramRowOne, table, "bar(java.lang.String) "), - "the table did not contain the correct job parameters for job parameter value bar"); + assertThat(checkModelColumn(paramRowOne, table, "bar(java.lang.String) ")).as("the table did not contain the correct job parameters for job parameter value bar").isTrue(); - assertTrue(checkModelColumn(paramRowOne, table, "baz(java.lang.Long) "), - "the table did not contain the correct job parameters for job parameter value baz"); + assertThat(checkModelColumn(paramRowOne, table, "baz(java.lang.Long) ")).as("the table did not contain the correct job parameters for job parameter value baz").isTrue(); } diff --git a/spring-cloud-starter-dataflow-server/src/test/java/org/springframework/cloud/dataflow/server/single/LocalConfigurationTests.java b/spring-cloud-starter-dataflow-server/src/test/java/org/springframework/cloud/dataflow/server/single/LocalConfigurationTests.java index e11918b451..10abb5b60b 100644 --- a/spring-cloud-starter-dataflow-server/src/test/java/org/springframework/cloud/dataflow/server/single/LocalConfigurationTests.java +++ b/spring-cloud-starter-dataflow-server/src/test/java/org/springframework/cloud/dataflow/server/single/LocalConfigurationTests.java @@ -40,11 +40,8 @@ import org.springframework.core.io.ResourceLoader; import org.springframework.test.util.TestSocketUtils; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; /** * Tests for {@link LocalTestDataFlowServer}. @@ -73,10 +70,10 @@ void config() { int randomPort = TestSocketUtils.findAvailableTcpPort(); String dataSourceUrl = String.format("jdbc:h2:tcp://localhost:%s/mem:dataflow;DATABASE_TO_UPPER=FALSE", randomPort); context = app.run(new String[] { "--debug","--spring.cloud.kubernetes.enabled=false", "--server.port=0", "--spring.datasource.url=" + dataSourceUrl }); - assertNotNull(context.getBean(AppRegistryService.class)); - assertNotNull(context.getBean(TaskExecutionController.class)); + assertThat(context.getBean(AppRegistryService.class)).isNotNull(); + assertThat(context.getBean(TaskExecutionController.class)).isNotNull(); // From DataFlowControllerAutoConfiguration - assertNotNull(context.getBean(AboutController.class)); + assertThat(context.getBean(AboutController.class)).isNotNull(); } @Test @@ -86,9 +83,9 @@ void localAutoConfigApplied() throws Exception { // LocalDataFlowServerAutoConfiguration also adds docker and maven resource loaders. DelegatingResourceLoader delegatingResourceLoader = context.getBean(DelegatingResourceLoader.class); Map loaders = TestUtils.readField("loaders", delegatingResourceLoader); - assertThat(loaders.size(), is(2)); - assertThat(loaders.get("maven"), notNullValue()); - assertThat(loaders.get("docker"), notNullValue()); + assertThat(loaders).hasSize(2); + assertThat(loaders.get("maven")).isNotNull(); + assertThat(loaders.get("docker")).isNotNull(); } @Test @@ -96,9 +93,9 @@ void configWithStreamsDisabled() { SpringApplication app = new SpringApplication(LocalTestDataFlowServer.class); context = app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--server.port=0", "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.STREAMS_ENABLED + "=false" }); - assertNotNull(context.getBean(TaskDefinitionRepository.class)); + assertThat(context.getBean(TaskDefinitionRepository.class)).isNotNull(); // The StreamDefinition repository is expected to exist. - assertNotNull(context.getBean(StreamDefinitionRepository.class)); + assertThat(context.getBean(StreamDefinitionRepository.class)).isNotNull(); try { context.getBean(StreamService.class); fail("Stream features should have been disabled."); @@ -112,9 +109,9 @@ void configWithTasksDisabled() { SpringApplication app = new SpringApplication(LocalTestDataFlowServer.class); context = app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--server.port=0", "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.TASKS_ENABLED + "=false" }); - assertNotNull(context.getBean(StreamDefinitionRepository.class)); + assertThat(context.getBean(StreamDefinitionRepository.class)).isNotNull(); // The TaskDefinition repository is expected to exist. - assertNotNull(context.getBean(TaskDefinitionRepository.class)); + assertThat(context.getBean(TaskDefinitionRepository.class)).isNotNull(); try { context.getBean(TaskExecutionService.class); fail("Task features should have been disabled."); @@ -127,6 +124,6 @@ void configWithTasksDisabled() { void noDataflowConfig() { SpringApplication app = new SpringApplication(LocalTestNoDataFlowServer.class); context = app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--server.port=0", "--spring.jpa.database=H2", "--spring.flyway.enabled=false" }); - assertThat(context.containsBean("appRegistry"), is(false)); + assertThat(context.containsBean("appRegistry")).isEqualTo(false); } }