Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Run build with Java 8 and 21 #107

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
name: Build
on:
on:
push:
branches:
- master
- 2.0.x
pull_request:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: ['8', '11']
java_version: ['8', '21']
os: ['ubuntu-latest']
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
Expand All @@ -26,7 +25,7 @@ jobs:
java-version: ${{ matrix.java_version }}
cache: 'maven'
- name: Cache SonarCloud packages
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '11' }}
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '21' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: actions/[email protected]
Expand All @@ -37,7 +36,7 @@ jobs:
- name: Build
run: ./mvnw -B -V -ntp install
- name: Analyze with SonarCloud
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '11' }}
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '21' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Optional;

public class OffsetDateTimeArgumentTest {
Expand All @@ -19,7 +20,7 @@ public class OffsetDateTimeArgumentTest {

@Test
public void apply() throws Exception {
final Instant now = OffsetDateTime.now().toInstant();
final Instant now = OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC).toInstant();
final OffsetDateTime dateTime = OffsetDateTime.ofInstant(now, ZoneId.systemDefault());

new OffsetDateTimeArgument(dateTime, Optional.empty()).apply(1, statement, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
Expand All @@ -20,7 +21,7 @@ public class OffsetDateTimeMapperTest {

@Test
public void mapColumnByName() throws Exception {
final Instant now = OffsetDateTime.now().toInstant();
final Instant now = OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC).toInstant();

when(resultSet.getTimestamp("name")).thenReturn(Timestamp.from(now));

Expand All @@ -40,7 +41,7 @@ public void mapColumnByName_TimestampIsNull() throws Exception {

@Test
public void mapColumnByIndex() throws Exception {
final Instant now = OffsetDateTime.now().toInstant();
final Instant now = OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC).toInstant();

when(resultSet.getTimestamp(1)).thenReturn(Timestamp.from(now));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final Instant startDate = Instant.now();
final Instant startDate = Instant.ofEpochMilli(1705570308068L);
final Instant endDate = startDate.plus(1L, ChronoUnit.DAYS);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.absent());

Expand All @@ -54,7 +54,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), Instant.now(),
dao.insert(2, Optional.of("Kate Johansen"), Instant.ofEpochMilli(1705570308068L),
Optional.absent(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final LocalDate startDate = LocalDate.now();
final LocalDate startDate = LocalDate.of(2021, 12, 31);
final LocalDate endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.absent());

Expand All @@ -53,7 +53,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), LocalDate.now(),
dao.insert(2, Optional.of("Kate Johansen"), LocalDate.of(2021, 12, 31),
Optional.absent(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final LocalDateTime startDate = LocalDateTime.now();
final LocalDateTime startDate = LocalDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000);
final LocalDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.absent());

Expand All @@ -53,7 +53,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), LocalDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), LocalDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000),
Optional.absent(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -45,7 +46,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final OffsetDateTime startDate = OffsetDateTime.now();
final OffsetDateTime startDate = OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC);
final OffsetDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.absent());

Expand All @@ -54,7 +55,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), OffsetDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC),
Optional.absent(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.skife.jdbi.v2.sqlobject.customizers.SingleValueResult;

import java.io.IOException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final ZonedDateTime startDate = ZonedDateTime.now();
final ZonedDateTime startDate = ZonedDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC);
final ZonedDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.absent());

Expand All @@ -54,7 +55,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), ZonedDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), ZonedDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC),
Optional.absent(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final Instant startDate = Instant.now();
final Instant startDate = Instant.ofEpochMilli(1705570308068L);
final Instant endDate = startDate.plus(1L, ChronoUnit.DAYS);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());

Expand All @@ -54,7 +54,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), Instant.now(),
dao.insert(2, Optional.of("Kate Johansen"), Instant.ofEpochMilli(1705570308068L),
Optional.empty(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final LocalDate startDate = LocalDate.now();
final LocalDate startDate = LocalDate.of(2021, 12, 31);
final LocalDate endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());

Expand All @@ -53,7 +53,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), LocalDate.now(),
dao.insert(2, Optional.of("Kate Johansen"), LocalDate.of(2021, 12, 31),
Optional.empty(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final LocalDateTime startDate = LocalDateTime.now();
final LocalDateTime startDate = LocalDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000);
final LocalDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());

Expand All @@ -53,7 +53,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), LocalDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), LocalDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000),
Optional.empty(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final OffsetDateTime startDate = OffsetDateTime.now();
final OffsetDateTime startDate = OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC);
final OffsetDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());

Expand All @@ -54,7 +55,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), OffsetDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), OffsetDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC),
Optional.empty(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.skife.jdbi.v2.sqlobject.customizers.SingleValueResult;

import java.io.IOException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Optional;

Expand Down Expand Up @@ -45,7 +46,7 @@ public void setupTests() throws IOException {

@Test
public void testPresent() {
final ZonedDateTime startDate = ZonedDateTime.now();
final ZonedDateTime startDate = ZonedDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC);
final ZonedDateTime endDate = startDate.plusDays(1L);
dao.insert(1, Optional.of("John Hughes"), startDate, Optional.of(endDate), Optional.empty());

Expand All @@ -54,7 +55,7 @@ public void testPresent() {

@Test
public void testAbsent() {
dao.insert(2, Optional.of("Kate Johansen"), ZonedDateTime.now(),
dao.insert(2, Optional.of("Kate Johansen"), ZonedDateTime.of(2007, 12, 3, 10, 15, 30, 375_000_000, ZoneOffset.UTC),
Optional.empty(), Optional.of("To be done"));

assertThat(dao.findEndDateById(2).isPresent()).isFalse();
Expand Down