From 82b6db58d761c9e77acdaf70a5e68e1fad0d6d56 Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Wed, 22 Apr 2026 14:53:10 +0200 Subject: [PATCH 1/8] Add support for Java 25 and Spring Boot 4 --- .github/workflows/ci.yml | 14 ++++---- CONTRIBUTING.md | 2 +- README.md | 2 +- .../jbehave-support-core-test-app/pom.xml | 4 +-- .../core/test/app/DatabaseConfig.java | 18 +++++++++- .../core/test/app/SecurityConfig.java | 15 ++++++--- .../core/test/app/UserController.java | 13 ++++---- .../core/test/app/WebServiceConfig.java | 15 +++++++-- .../src/main/resources/application.yml | 9 +++-- .../jbehave-support-core-test-oxm/pom.xml | 3 +- jbehave-support-core/docs/Migration.md | 10 +++--- .../extension/RestXmlReporterExtension.java | 8 ++--- .../core/rest/RestServiceHandler.java | 4 +-- .../test/TestConfiguration.java | 33 ++++++++++++------- .../src/test/resources/db/init.sql | 13 ++++++++ .../src/test/resources/test.yml | 2 +- pom.xml | 10 +++--- 17 files changed, 118 insertions(+), 57 deletions(-) create mode 100644 jbehave-support-core/src/test/resources/db/init.sql diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbade742..27afd7ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17, 21, 23 ] + java: [ 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17, 21, 23 ] + java: [ 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -52,7 +52,7 @@ jobs: run: | mvn org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report -Dspring-boot.build-image.skip=true -B -V - name: Upload test coverage for unit tests - if: matrix.java == 17 + if: matrix.java == 25 uses: actions/upload-artifact@v4 with: name: jacoco @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17, 21, 23 ] + java: [ 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -88,7 +88,7 @@ jobs: name: reports-java-${{ matrix.java }} path: jbehave-support-core/target/reports - name: Upload test coverage for integration tests - if: matrix.java == 17 + if: matrix.java == 25 uses: actions/upload-artifact@v4 with: name: jacoco-it @@ -115,10 +115,10 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: Set up Java 17 + - name: Set up Java 21 uses: actions/setup-java@v4 with: - java-version: 17 + java-version: 21 distribution: 'zulu' - name: Run Maven run: mvn package -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=EmbedITCZ_jbehave-support -Dsonar.organization=embeditcz -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/jbehave-support/jbehave-support/jacoco/jacoco.xml,/home/runner/work/jbehave-support/jbehave-support/jacoco-it/jacoco.xml -e -X diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e969419..df18046f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ We are happy You are considering contributing to jbehave-support! 😃 Before you start, please read this short guide, so You don`t get lost. If You have any questions, do not hesitate to ask in GitHub discussions. ## Dev environment -This project is written in Java 17, however we are aiming for LTS Java and latest Java compatibility (CI is run against 17, 21 and latest Java - currently 23). +This project is written in Java 17, however we are aiming for LTS Java and latest Java compatibility (CI is run against 17, 21 and latest Java - currently 25). We are using the latest version of IntelliJ IDEA as an IDE. These are the plugins you need: * SonarLint diff --git a/README.md b/README.md index db806489..aa3dbbf8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ along with support for [verification](jbehave-support-core/docs/General.md#verif [expression commands](jbehave-support-core/docs/Expression-commands.md) and basic [reporting](jbehave-support-core/docs/Reporting.md). -Currently supported Java versions are 17, 21 and 23 (latest LTS and latest version). +Currently supported Java versions are 17, 21 and 25 (latest LTS and latest version). ## Contents 1. [Modules](#modules) diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml index ef8ea758..242a7a04 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml @@ -18,7 +18,7 @@ UTF-8 UTF-8 - 17 + 21 @@ -118,7 +118,7 @@ docker.io/library/jbehave-support-core-test-app:latest - 17 + 21 diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java index 6a24e41c..94e0e80c 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java @@ -2,12 +2,16 @@ import java.sql.SQLException; +import javax.sql.DataSource; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.h2.tools.Server; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; import org.springframework.core.env.Environment; +import org.springframework.jdbc.datasource.DriverManagerDataSource; @Slf4j @Configuration @@ -20,7 +24,7 @@ public class DatabaseConfig { public Server initServer() { Server h2Server; try { - h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("spring.datasource.port")).start(); + h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("h2.tcp.port")).start(); if (h2Server.isRunning(true)) { log.info("H2 server was started and is running."); } else { @@ -31,4 +35,16 @@ public Server initServer() { } return h2Server; } + + @Bean("TEST") + @DependsOn("initServer") + public DataSource dataSource() { + DriverManagerDataSource ds = new DriverManagerDataSource(); + ds.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); + ds.setUrl(env.getProperty("spring.datasource.url")); + ds.setUsername(env.getProperty("spring.datasource.username")); + ds.setPassword(env.getProperty("spring.datasource.password")); + log.info("DataSource initialized with URL: {}", env.getProperty("spring.datasource.url")); + return ds; + } } diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java index 8a47ad6c..b0a71e31 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java @@ -4,22 +4,27 @@ import org.springframework.context.annotation.Configuration; import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer; +import org.springframework.security.config.web.PathPatternRequestMatcherBuilderFactoryBean; import org.springframework.security.web.SecurityFilterChain; -import static org.springframework.security.web.util.matcher.AntPathRequestMatcher.antMatcher; - @Configuration public class SecurityConfig { + @Bean + PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { + return new PathPatternRequestMatcherBuilderFactoryBean(); + } + @Bean public SecurityFilterChain basicAuthFilterChain(HttpSecurity http) throws Exception { return http - .csrf(csrf -> csrf.disable()) + .csrf(AbstractHttpConfigurer::disable) .authorizeHttpRequests(matcherRegistry -> matcherRegistry - .requestMatchers(antMatcher("/rest/secure/**")).fullyAuthenticated() - .requestMatchers(antMatcher("/**")).permitAll() + .requestMatchers("/rest/secure/**").fullyAuthenticated() + .requestMatchers("/**").permitAll() ) .httpBasic(Customizer.withDefaults()) .headers(headersConfigurer -> headersConfigurer.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)) diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/UserController.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/UserController.java index 88e2eae7..ed09dca6 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/UserController.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/UserController.java @@ -121,12 +121,11 @@ public ResponseEntity handleBase64Request(HttpServletRequest request) throws IOE @PostMapping("/mirror/") public ResponseEntity mirror(@RequestBody Mirror mirror) { - return (ResponseEntity) new ResponseEntity(mirror, - mirror.getHeaders().stream().collect( - toMap(Header::getKey, h -> Collections.singletonList(h.getValue()), (a, b) -> { - a.addAll(b); - return a; - }, HttpHeaders::new)), - HttpStatus.valueOf(mirror.getHttpStatus())); + var httpHeaders = new HttpHeaders(); + if (mirror.getHeaders() != null) { + mirror.getHeaders().forEach(h -> httpHeaders.add(h.getKey(), h.getValue())); + } + + return new ResponseEntity<>(mirror, httpHeaders, HttpStatus.valueOf(mirror.getHttpStatus())); } } diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/WebServiceConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/WebServiceConfig.java index d3ca3d6d..72932862 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/WebServiceConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/WebServiceConfig.java @@ -1,15 +1,26 @@ package org.jbehavesupport.core.test.app; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.ClassPathResource; -import org.springframework.ws.config.annotation.WsConfigurerAdapter; +import org.springframework.ws.config.annotation.WsConfigurer; +import org.springframework.ws.transport.http.MessageDispatcherServlet; import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; import org.springframework.xml.xsd.SimpleXsdSchema; import org.springframework.xml.xsd.XsdSchema; @Configuration -public class WebServiceConfig extends WsConfigurerAdapter { +public class WebServiceConfig implements WsConfigurer { + + @Bean + public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) { + MessageDispatcherServlet servlet = new MessageDispatcherServlet(); + servlet.setApplicationContext(applicationContext); + servlet.setTransformWsdlLocations(true); + return new ServletRegistrationBean<>(servlet, "/services/*"); + } @Bean(name = "name") public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) { diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml index 34314d50..f3d9abe1 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml @@ -1,7 +1,8 @@ spring: + jackson: + constructor-detector: explicit-only datasource: - port: 11112 - url: jdbc:h2:tcp://localhost:${spring.datasource.port}/mem:test;MODE=ORACLE + url: jdbc:h2:tcp://localhost:${h2.tcp.port}/mem:test;MODE=ORACLE username: sa password: sa driver-class-name: org.h2.Driver @@ -10,6 +11,10 @@ spring: name: sa password: sa +h2: + tcp: + port: 11112 + server: port: 11110 diff --git a/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml index 162bccf2..00048987 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml @@ -18,7 +18,7 @@ UTF-8 UTF-8 - 17 + 21 ${java.version} ${java.version} @@ -63,7 +63,6 @@ - diff --git a/jbehave-support-core/docs/Migration.md b/jbehave-support-core/docs/Migration.md index ab12fcc3..23462822 100644 --- a/jbehave-support-core/docs/Migration.md +++ b/jbehave-support-core/docs/Migration.md @@ -16,14 +16,14 @@ We removed `org.jbehavesupport.core.internal.ConditionalOnMissingBean` annotatio ### Deprecated code removal We have removed all previously deprecated code - please refer to [Deprecated.md](Deprecated.md) for more details how to migrate. -### Spring 6 upgrade -We are currently using Spring 6 internally, this brings with it several other requirements: +### Spring 7 upgrade +We are currently using Spring 7 internally, this brings with it several other requirements: -> #### Java 17 ->We now currently require Java 17 as a minimal Java version (previously 8). +> #### Java 25 +>We now currently require Java 21 as a minimal Java version (previously 17). > > #### Jakarta EE 9 >Spring 6 internally brings with it upgrade to Jakarta EE 9, this means migration from old `javax.*` to `jakarta.*` packages, please consult guides on the Internet (and or your IDE support for migration) if needed. -### Spring Boot 3 introduction +### Spring Boot 4 introduction We are now internally using Spring Boot - this means that ideally your main test configuration file should be annotated with both `@SpringBootConfiguration` and `@EnableAutoConfiguration`. diff --git a/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java b/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java index e302bee7..ed55bfbb 100644 --- a/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java +++ b/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java @@ -127,7 +127,7 @@ private void printRestMessage(final Writer writer, final RestMessageContext mess private void printHeaders(final Writer writer, HttpHeaders headers) { if (headers != null) { printBegin(writer, HEADERS_TAG); - headers.entrySet().forEach(he -> printSelfClosed(writer, HEADER_TAG, getHeaderAttributes(he))); + headers.forEach((key, values) -> printSelfClosed(writer, HEADER_TAG, getHeaderAttributes(key, values))); printEnd(writer, HEADERS_TAG); } } @@ -159,10 +159,10 @@ private Map getResponseMessageAttributes(RestMessageContext mess return responseMessageAttributes; } - private Map getHeaderAttributes(Map.Entry> header) { + private Map getHeaderAttributes(String key, List values) { Map headerAttributes = new HashMap<>(); - headerAttributes.put("key", header.getKey()); - headerAttributes.put("value", header.getValue().get(0)); + headerAttributes.put("key", key); + headerAttributes.put("value", values.isEmpty() ? "" : values.getFirst()); return headerAttributes; } diff --git a/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java b/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java index 69e3aabe..43a211b5 100644 --- a/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java +++ b/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java @@ -177,7 +177,7 @@ private void storeResponse(final HttpStatusCodeException e) { private HttpEntity createRequestEntity(ExamplesTable data) throws IOException { if (data == null) { //return dummy - return new HttpEntity<>("", null); + return new HttpEntity<>("", HttpHeaders.EMPTY); } List> requestDataList = ExamplesTableUtil.convertTriple(data, NAME, DATA, ALIAS); HttpHeaders headers = createHeaders(requestDataList); @@ -443,7 +443,7 @@ private void verifyResponseHeaders(HttpHeaders actualHeaders, ExamplesTable data if (key.startsWith(HEADER_START) && !key.equals(STATUS_HEADER)) { String headerKey = key.substring(HEADER_START.length()); String assertionErrorMessage = "Headers don't contain " + headerKey + "\n" + actualResponseMessage; - assertThat(actualHeaders.containsKey(headerKey)).as(assertionErrorMessage).isTrue(); + assertThat(actualHeaders.get(headerKey) != null).as(assertionErrorMessage).isTrue(); final Verifier verifier = verifierResolver.getVerifierByName(triple.getRight(), equalsVerifier); verifier.verify(actualHeaders.get(headerKey).get(0), triple.getMiddle()); diff --git a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java index f8f8f28e..57246467 100644 --- a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java +++ b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java @@ -20,14 +20,17 @@ import org.jbehavesupport.test.support.TestWebServiceHandler; import org.openqa.selenium.MutableCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; +import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; +import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ResourceLoader; import javax.sql.DataSource; @@ -40,7 +43,6 @@ import static java.lang.Integer.parseInt; import static java.util.Collections.singletonMap; import static java.util.Objects.nonNull; -import static org.jbehavesupport.core.ssh.SshSetting.builder; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -69,12 +71,21 @@ public WebServiceHandler testWebServiceHandler() { @Bean @Qualifier("TEST") public DataSource testDatasource() { - DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); - dataSourceBuilder.driverClassName(env.getProperty("db.driver")); - dataSourceBuilder.url(env.getProperty("db.url")); - dataSourceBuilder.username(env.getProperty("db.username")); - dataSourceBuilder.password(env.getProperty("db.password")); - return dataSourceBuilder.build(); + DriverManagerDataSource ds = new DriverManagerDataSource(); + ds.setDriverClassName(env.getProperty("db.driver")); + ds.setUrl(env.getProperty("db.url")); + ds.setUsername(env.getProperty("db.username")); + ds.setPassword(env.getProperty("db.password")); + return ds; + } + + @Bean + public InitializingBean testDatabaseInitializer(@Qualifier("TEST") DataSource dataSource) { + return () -> { + ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); + populator.addScript(new ClassPathResource("db/init.sql")); + populator.execute(dataSource); + }; } @Bean @@ -122,7 +133,7 @@ public SshTemplate[] sshTemplate() throws IOException { int port = parseInt(env.getProperty("ssh.port")); String logPath = env.getProperty("ssh.logPath"); - SshSetting passwordSetting = builder() + SshSetting passwordSetting = SshSetting.builder() .hostname(hostname) .user(user) .password(env.getProperty("ssh.credentials.password")) @@ -133,7 +144,7 @@ public SshTemplate[] sshTemplate() throws IOException { String keyPath = resourceLoader.getResource(env.getProperty("ssh.credentials.keyPath")) .getURL() .getFile(); - SshSetting keySetting = builder() + SshSetting keySetting = SshSetting.builder() .hostname(hostname) .user(user) .keyPath(keyPath) @@ -152,7 +163,7 @@ public SshTemplate[] sshTemplate() throws IOException { @Bean @Qualifier("LONG_REPORTABLE") SshTemplate longReportableSshTemplate() throws IOException { - SshSetting sshSetting = builder() + SshSetting sshSetting = SshSetting.builder() .hostname("fake hostname") .user("fake user") .password("asdf5684Daa") diff --git a/jbehave-support-core/src/test/resources/db/init.sql b/jbehave-support-core/src/test/resources/db/init.sql new file mode 100644 index 00000000..2e9bac71 --- /dev/null +++ b/jbehave-support-core/src/test/resources/db/init.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS PERSON ( + ID INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + FIRST_NAME VARCHAR(255) NOT NULL, + LAST_NAME VARCHAR(255) NOT NULL, + AGE INT, + LAST_UPDATE DATE +); + +TRUNCATE TABLE PERSON; + +INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('John', 'Doe', 31, DATE '2018-06-18'); +INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('Jane', 'Doe', 29, DATE '2018-06-18'); +INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('Michael', 'Doe', NULL, NULL); diff --git a/jbehave-support-core/src/test/resources/test.yml b/jbehave-support-core/src/test/resources/test.yml index b9fd24b8..d6304682 100644 --- a/jbehave-support-core/src/test/resources/test.yml +++ b/jbehave-support-core/src/test/resources/test.yml @@ -10,7 +10,7 @@ rest: password: sa db: - url: jdbc:h2:tcp://localhost:11112/mem:test;MODE=ORACLE + url: jdbc:h2:mem:test;MODE=ORACLE;DB_CLOSE_DELAY=-1 driver: org.h2.Driver username: sa password: sa diff --git a/pom.xml b/pom.xml index 83d9fbdc..a6dc6aa9 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 3.4.0 + 4.0.5 @@ -69,14 +69,16 @@ - 17 + 21 full + ${java.version} + ${java.version} 5.0 5.0.1 - 2.4-M4-groovy-4.0 + 2.4-M7-groovy-5.0 0.39.0 1.12.0 4.4 @@ -86,7 +88,7 @@ 4.13.0 - 4.0.1 + 4.3.1 3.1.1 1.6.13 3.2.4 From b67d1c11860afb35040b1278e7d3898613b892a9 Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Wed, 22 Apr 2026 15:25:34 +0200 Subject: [PATCH 2/8] Add support for Java 25 --- .github/workflows/browserstack.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- CONTRIBUTING.md | 2 +- README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml index 99ca8f8e..23012924 100644 --- a/.github/workflows/browserstack.yml +++ b/.github/workflows/browserstack.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 17 ] + java: [ 21 ] browser: [ Chrome, Firefox, Safari ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cf0622e7..6ffc4b14 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -40,7 +40,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v4 with: - java-version: 17 + java-version: 21 distribution: 'zulu' # Initializes the CodeQL tools for scanning. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df18046f..27c8b93d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ We are happy You are considering contributing to jbehave-support! 😃 Before you start, please read this short guide, so You don`t get lost. If You have any questions, do not hesitate to ask in GitHub discussions. ## Dev environment -This project is written in Java 17, however we are aiming for LTS Java and latest Java compatibility (CI is run against 17, 21 and latest Java - currently 25). +This project is written in Java 21, however we are aiming for LTS Java and latest Java compatibility (CI is run against 21 and latest Java - currently 25). We are using the latest version of IntelliJ IDEA as an IDE. These are the plugins you need: * SonarLint diff --git a/README.md b/README.md index aa3dbbf8..bf22e568 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ along with support for [verification](jbehave-support-core/docs/General.md#verif [expression commands](jbehave-support-core/docs/Expression-commands.md) and basic [reporting](jbehave-support-core/docs/Reporting.md). -Currently supported Java versions are 17, 21 and 25 (latest LTS and latest version). +Currently supported Java versions are 21 and 25 (latest LTS and latest version). ## Contents 1. [Modules](#modules) From 5b787ca9da2a54f9a2a51a8e58a5599a0a027e6b Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Thu, 23 Apr 2026 21:41:11 +0200 Subject: [PATCH 3/8] Add support for Java 25 - review changes --- .../core/test/app/DatabaseConfig.java | 17 +---------------- .../src/main/resources/application.yml | 6 ++---- .../core/rest/RestServiceHandler.java | 3 +-- pom.xml | 1 - 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java index 94e0e80c..77da4a50 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java @@ -2,16 +2,13 @@ import java.sql.SQLException; -import javax.sql.DataSource; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.h2.tools.Server; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.DependsOn; import org.springframework.core.env.Environment; -import org.springframework.jdbc.datasource.DriverManagerDataSource; @Slf4j @Configuration @@ -24,8 +21,7 @@ public class DatabaseConfig { public Server initServer() { Server h2Server; try { - h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("h2.tcp.port")).start(); - if (h2Server.isRunning(true)) { + h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("spring.datasource.port")).start(); if (h2Server.isRunning(true)) { log.info("H2 server was started and is running."); } else { throw new RuntimeException("Could not start H2 server."); @@ -36,15 +32,4 @@ public Server initServer() { return h2Server; } - @Bean("TEST") - @DependsOn("initServer") - public DataSource dataSource() { - DriverManagerDataSource ds = new DriverManagerDataSource(); - ds.setDriverClassName(env.getProperty("spring.datasource.driver-class-name")); - ds.setUrl(env.getProperty("spring.datasource.url")); - ds.setUsername(env.getProperty("spring.datasource.username")); - ds.setPassword(env.getProperty("spring.datasource.password")); - log.info("DataSource initialized with URL: {}", env.getProperty("spring.datasource.url")); - return ds; - } } diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml index f3d9abe1..6444489f 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/resources/application.yml @@ -2,7 +2,8 @@ spring: jackson: constructor-detector: explicit-only datasource: - url: jdbc:h2:tcp://localhost:${h2.tcp.port}/mem:test;MODE=ORACLE + port: 11112 + url: jdbc:h2:tcp://localhost:${spring.datasource.port}/mem:test;MODE=ORACLE username: sa password: sa driver-class-name: org.h2.Driver @@ -11,9 +12,6 @@ spring: name: sa password: sa -h2: - tcp: - port: 11112 server: port: 11110 diff --git a/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java b/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java index 43a211b5..40eb2e6d 100644 --- a/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java +++ b/jbehave-support-core/src/main/java/org/jbehavesupport/core/rest/RestServiceHandler.java @@ -443,8 +443,7 @@ private void verifyResponseHeaders(HttpHeaders actualHeaders, ExamplesTable data if (key.startsWith(HEADER_START) && !key.equals(STATUS_HEADER)) { String headerKey = key.substring(HEADER_START.length()); String assertionErrorMessage = "Headers don't contain " + headerKey + "\n" + actualResponseMessage; - assertThat(actualHeaders.get(headerKey) != null).as(assertionErrorMessage).isTrue(); - + assertThat(actualHeaders.containsHeader(headerKey)).as(assertionErrorMessage).isTrue(); final Verifier verifier = verifierResolver.getVerifierByName(triple.getRight(), equalsVerifier); verifier.verify(actualHeaders.get(headerKey).get(0), triple.getMiddle()); } diff --git a/pom.xml b/pom.xml index a6dc6aa9..c9100148 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,6 @@ full - ${java.version} ${java.version} 5.0 From e2b47d8cf1dd170ae9098d92fd44d35d799f4986 Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Mon, 27 Apr 2026 10:22:03 +0200 Subject: [PATCH 4/8] Revert support for Java 17 --- .github/workflows/browserstack.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 2 +- CONTRIBUTING.md | 2 +- README.md | 4 ++-- .../jbehave-support-core-test-app/pom.xml | 2 +- .../jbehave-support-core-test-oxm/pom.xml | 2 +- jbehave-support-core/docs/Migration.md | 2 +- .../core/report/extension/RestXmlReporterExtension.java | 2 +- pom.xml | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/browserstack.yml b/.github/workflows/browserstack.yml index 23012924..99ca8f8e 100644 --- a/.github/workflows/browserstack.yml +++ b/.github/workflows/browserstack.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 21 ] + java: [ 17 ] browser: [ Chrome, Firefox, Safari ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27afd7ef..7c9b4f27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 21, 25 ] + java: [ 17, 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 21, 25 ] + java: [ 17, 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -52,7 +52,7 @@ jobs: run: | mvn org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report -Dspring-boot.build-image.skip=true -B -V - name: Upload test coverage for unit tests - if: matrix.java == 25 + if: matrix.java == 17 uses: actions/upload-artifact@v4 with: name: jacoco @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 21, 25 ] + java: [ 17, 21, 25 ] steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6ffc4b14..cf0622e7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -40,7 +40,7 @@ jobs: - name: Set up Java uses: actions/setup-java@v4 with: - java-version: 21 + java-version: 17 distribution: 'zulu' # Initializes the CodeQL tools for scanning. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27c8b93d..df18046f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ We are happy You are considering contributing to jbehave-support! 😃 Before you start, please read this short guide, so You don`t get lost. If You have any questions, do not hesitate to ask in GitHub discussions. ## Dev environment -This project is written in Java 21, however we are aiming for LTS Java and latest Java compatibility (CI is run against 21 and latest Java - currently 25). +This project is written in Java 17, however we are aiming for LTS Java and latest Java compatibility (CI is run against 17, 21 and latest Java - currently 25). We are using the latest version of IntelliJ IDEA as an IDE. These are the plugins you need: * SonarLint diff --git a/README.md b/README.md index bf22e568..4a57c939 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ along with support for [verification](jbehave-support-core/docs/General.md#verif [expression commands](jbehave-support-core/docs/Expression-commands.md) and basic [reporting](jbehave-support-core/docs/Reporting.md). -Currently supported Java versions are 21 and 25 (latest LTS and latest version). +Currently supported Java versions are 17, 21 and 25 (latest LTS and latest version). ## Contents 1. [Modules](#modules) @@ -54,7 +54,7 @@ Contributors guide can be found in [CONTRIBUTING.md](CONTRIBUTING.md) To show you how to set up a project using the jbehave-support library, I am going to make a test that Google searches `EmbedITCZ jbehave-support` and checks the result. To learn more about this example check out [Web-testing.md](jbehave-support-core/docs/Web-testing.md). -Of course you can use jbehave-support for much more than just selenium based testing. For example server communication ([SOAP](jbehave-support-core/docs/examples/Web-service.md), [REST](jbehave-support-core/docs/examples/Rest.md) or database manipulation ([SQL](jbehave-support-core/docs/Sql-steps.md)). +Of course you can use jbehave-support for much more than just selenium based testing. For example server communication ([SOAP](jbehave-support-core/docs/examples/Web-service.md), [REST](jbehave-support-core/docs/examples/Rest.md)) or database manipulation ([SQL](jbehave-support-core/docs/Sql-steps.md)). ### Add to Java project as a Maven dependency diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml index 242a7a04..c711d038 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml @@ -18,7 +18,7 @@ UTF-8 UTF-8 - 21 + 17 diff --git a/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml index 00048987..9a5cf264 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-oxm/pom.xml @@ -18,7 +18,7 @@ UTF-8 UTF-8 - 21 + 17 ${java.version} ${java.version} diff --git a/jbehave-support-core/docs/Migration.md b/jbehave-support-core/docs/Migration.md index 23462822..ae31005d 100644 --- a/jbehave-support-core/docs/Migration.md +++ b/jbehave-support-core/docs/Migration.md @@ -20,7 +20,7 @@ We have removed all previously deprecated code - please refer to [Deprecated.md] We are currently using Spring 7 internally, this brings with it several other requirements: > #### Java 25 ->We now currently require Java 21 as a minimal Java version (previously 17). +>We now currently require Java 17 as a minimal Java version. > > #### Jakarta EE 9 >Spring 6 internally brings with it upgrade to Jakarta EE 9, this means migration from old `javax.*` to `jakarta.*` packages, please consult guides on the Internet (and or your IDE support for migration) if needed. diff --git a/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java b/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java index ed55bfbb..9425e1c2 100644 --- a/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java +++ b/jbehave-support-core/src/main/java/org/jbehavesupport/core/report/extension/RestXmlReporterExtension.java @@ -162,7 +162,7 @@ private Map getResponseMessageAttributes(RestMessageContext mess private Map getHeaderAttributes(String key, List values) { Map headerAttributes = new HashMap<>(); headerAttributes.put("key", key); - headerAttributes.put("value", values.isEmpty() ? "" : values.getFirst()); + headerAttributes.put("value", values.isEmpty() ? "" : values.get(0)); return headerAttributes; } diff --git a/pom.xml b/pom.xml index c9100148..6bf5593c 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ - 21 + 17 full From f963fe73665d60ecfcdc1692db50f3ad13890d0f Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Tue, 5 May 2026 22:20:01 +0200 Subject: [PATCH 5/8] Review changes (h2 tests, test containers, dependencies) --- .../jbehave-support-core-test-app/pom.xml | 4 ++-- .../core/test/app/SecurityConfig.java | 5 ----- jbehave-support-core/pom.xml | 4 ++-- .../test/TestConfiguration.java | 22 ++++++------------- .../src/test/resources/db/init.sql | 13 ----------- pom.xml | 9 ++------ 6 files changed, 13 insertions(+), 44 deletions(-) delete mode 100644 jbehave-support-core/src/test/resources/db/init.sql diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml index c711d038..eec8c957 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml @@ -70,8 +70,8 @@ h2 - org.liquibase - liquibase-core + org.springframework.boot + spring-boot-starter-liquibase org.projectlombok diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java index b0a71e31..d98d0306 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/SecurityConfig.java @@ -12,11 +12,6 @@ @Configuration public class SecurityConfig { - @Bean - PathPatternRequestMatcherBuilderFactoryBean requestMatcherBuilder() { - return new PathPatternRequestMatcherBuilderFactoryBean(); - } - @Bean public SecurityFilterChain basicAuthFilterChain(HttpSecurity http) throws Exception { return http diff --git a/jbehave-support-core/pom.xml b/jbehave-support-core/pom.xml index 336e8e14..10d65c68 100644 --- a/jbehave-support-core/pom.xml +++ b/jbehave-support-core/pom.xml @@ -124,8 +124,8 @@ lombok - org.springframework - spring-jdbc + org.springframework.boot + spring-boot-starter-jdbc org.springframework.ws diff --git a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java index 57246467..0df69103 100644 --- a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java +++ b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.context.annotation.Bean; @@ -71,21 +72,12 @@ public WebServiceHandler testWebServiceHandler() { @Bean @Qualifier("TEST") public DataSource testDatasource() { - DriverManagerDataSource ds = new DriverManagerDataSource(); - ds.setDriverClassName(env.getProperty("db.driver")); - ds.setUrl(env.getProperty("db.url")); - ds.setUsername(env.getProperty("db.username")); - ds.setPassword(env.getProperty("db.password")); - return ds; - } - - @Bean - public InitializingBean testDatabaseInitializer(@Qualifier("TEST") DataSource dataSource) { - return () -> { - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - populator.addScript(new ClassPathResource("db/init.sql")); - populator.execute(dataSource); - }; + DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); + dataSourceBuilder.driverClassName(env.getProperty("db.driver")); + dataSourceBuilder.url(env.getProperty("db.url")); + dataSourceBuilder.username(env.getProperty("db.username")); + dataSourceBuilder.password(env.getProperty("db.password")); + return dataSourceBuilder.build(); } @Bean diff --git a/jbehave-support-core/src/test/resources/db/init.sql b/jbehave-support-core/src/test/resources/db/init.sql deleted file mode 100644 index 2e9bac71..00000000 --- a/jbehave-support-core/src/test/resources/db/init.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE IF NOT EXISTS PERSON ( - ID INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, - FIRST_NAME VARCHAR(255) NOT NULL, - LAST_NAME VARCHAR(255) NOT NULL, - AGE INT, - LAST_UPDATE DATE -); - -TRUNCATE TABLE PERSON; - -INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('John', 'Doe', 31, DATE '2018-06-18'); -INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('Jane', 'Doe', 29, DATE '2018-06-18'); -INSERT INTO PERSON (FIRST_NAME, LAST_NAME, AGE, LAST_UPDATE) VALUES ('Michael', 'Doe', NULL, NULL); diff --git a/pom.xml b/pom.xml index 6bf5593c..ecd41f0e 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,8 @@ full + + ${java.version} 5.0 @@ -82,7 +84,6 @@ 1.12.0 4.4 4.0.4 - 1.20.4 4.13.0 @@ -199,12 +200,6 @@ org.eclipse.persistence.moxy ${version.moxy} - - org.testcontainers - testcontainers - ${version.testcontainers} - test - From 97b295a9547477bd85bc003afe2132b03969ad3e Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Mon, 11 May 2026 11:05:32 +0200 Subject: [PATCH 6/8] Review changes (revert changes for java 17) --- .github/workflows/ci.yml | 6 +++--- .../jbehave-support-core-test-app/pom.xml | 2 +- .../org/jbehavesupport/core/test/app/DatabaseConfig.java | 3 ++- jbehave-support-core/docs/Migration.md | 2 +- jbehave-support-core/src/test/resources/test.yml | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c9b4f27..05aaa1cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,7 @@ jobs: name: reports-java-${{ matrix.java }} path: jbehave-support-core/target/reports - name: Upload test coverage for integration tests - if: matrix.java == 25 + if: matrix.java == 17 uses: actions/upload-artifact@v4 with: name: jacoco-it @@ -115,10 +115,10 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: Set up Java 21 + - name: Set up Java 17 uses: actions/setup-java@v4 with: - java-version: 21 + java-version: 17 distribution: 'zulu' - name: Run Maven run: mvn package -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=EmbedITCZ_jbehave-support -Dsonar.organization=embeditcz -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.coverage.jacoco.xmlReportPaths=/home/runner/work/jbehave-support/jbehave-support/jacoco/jacoco.xml,/home/runner/work/jbehave-support/jbehave-support/jacoco-it/jacoco.xml -e -X diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml index eec8c957..f9c7630d 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml +++ b/jbehave-support-core-test/jbehave-support-core-test-app/pom.xml @@ -118,7 +118,7 @@ docker.io/library/jbehave-support-core-test-app:latest - 21 + 17 diff --git a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java index 77da4a50..fc8610ed 100644 --- a/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java +++ b/jbehave-support-core-test/jbehave-support-core-test-app/src/main/java/org/jbehavesupport/core/test/app/DatabaseConfig.java @@ -21,7 +21,8 @@ public class DatabaseConfig { public Server initServer() { Server h2Server; try { - h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("spring.datasource.port")).start(); if (h2Server.isRunning(true)) { + h2Server = Server.createTcpServer("-ifNotExists", "-tcpAllowOthers", "-tcpPort", env.getProperty("spring.datasource.port")).start(); + if (h2Server.isRunning(true)) { log.info("H2 server was started and is running."); } else { throw new RuntimeException("Could not start H2 server."); diff --git a/jbehave-support-core/docs/Migration.md b/jbehave-support-core/docs/Migration.md index ae31005d..e84ed3bf 100644 --- a/jbehave-support-core/docs/Migration.md +++ b/jbehave-support-core/docs/Migration.md @@ -19,7 +19,7 @@ We have removed all previously deprecated code - please refer to [Deprecated.md] ### Spring 7 upgrade We are currently using Spring 7 internally, this brings with it several other requirements: -> #### Java 25 +> #### Java 17 >We now currently require Java 17 as a minimal Java version. > > #### Jakarta EE 9 diff --git a/jbehave-support-core/src/test/resources/test.yml b/jbehave-support-core/src/test/resources/test.yml index d6304682..b9fd24b8 100644 --- a/jbehave-support-core/src/test/resources/test.yml +++ b/jbehave-support-core/src/test/resources/test.yml @@ -10,7 +10,7 @@ rest: password: sa db: - url: jdbc:h2:mem:test;MODE=ORACLE;DB_CLOSE_DELAY=-1 + url: jdbc:h2:tcp://localhost:11112/mem:test;MODE=ORACLE driver: org.h2.Driver username: sa password: sa From c37054a4693054978a93baa8f8e81007a844f9f8 Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Mon, 11 May 2026 11:12:58 +0200 Subject: [PATCH 7/8] Review changes (revert changes for java 17) --- .../test/groovy/org/jbehavesupport/test/TestConfiguration.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java index 0df69103..f7b093b3 100644 --- a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java +++ b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java @@ -20,13 +20,10 @@ import org.jbehavesupport.test.support.TestWebServiceHandler; import org.openqa.selenium.MutableCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; -import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.PropertySource; From ec6c2b7bfd2a662e727f536a6b17dbec5ca3e9d3 Mon Sep 17 00:00:00 2001 From: "tomas.nejedlo" Date: Mon, 11 May 2026 11:45:22 +0200 Subject: [PATCH 8/8] Review changes (revert changes for java 17) --- .../test/groovy/org/jbehavesupport/test/TestConfiguration.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java index f7b093b3..b638b402 100644 --- a/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java +++ b/jbehave-support-core/src/test/groovy/org/jbehavesupport/test/TestConfiguration.java @@ -28,7 +28,6 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; -import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ResourceLoader; import javax.sql.DataSource;