Skip to content

Commit

Permalink
feat: upgrade to Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
gerritschlueter authored and jnodorp-jaconi committed Feb 28, 2024
1 parent 9c333f6 commit 217602f
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Install Java
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Validate Gradle wrapper
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install Java
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Validate Gradle wrapper
Expand Down
27 changes: 0 additions & 27 deletions Dockerfile

This file was deleted.

17 changes: 3 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
}

sonarqube {
Expand Down Expand Up @@ -115,7 +115,7 @@ testing {
targets {
all {
testTask.configure {
mustRunAfter(tasks.named("dockerBuild"))
mustRunAfter(tasks.bootBuildImage)
testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
testLogging.showStandardStreams = true
}
Expand All @@ -125,17 +125,6 @@ testing {
}
}

tasks.create<Exec>("dockerBuild") {
mustRunAfter(tasks.test)
executable("docker")
args(listOf("build", "-t", "${registry}/${project.name}:${project.version}", "-t", "${registry}/${project.name}:latest", "."))
}

tasks.create<Exec>("dockerBuildPush") {
executable("docker")
args(listOf("buildx", "build", "--platform", "linux/amd64,linux/arm64", "-t", "${registry}/${project.name}:${project.version}", "--push", "."))
}

tasks.withType<BootBuildImage> {
mustRunAfter(tasks.test)
imageName.value("${registry}/${project.name}:${project.version}")
Expand All @@ -157,7 +146,7 @@ tasks.withType<BootBuildImage> {

tasks.check {
dependsOn(tasks.test)
dependsOn(tasks.named("dockerBuild"))
dependsOn(tasks.bootBuildImage)
dependsOn(testing.suites.named("integrationTest"))
dependsOn(tasks.jacocoTestReport)
}
Expand Down
3 changes: 1 addition & 2 deletions src/integrationTest/java/io/jaconi/morp/SeleniumIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ static class Config {


// we start Chrome for each test to ensure a clean state (i.e. cookies etc)
// screen recording not working on ARM Mac due to missing ARM image of vnc-recorder
@Container
public final BrowserWebDriverContainer<?> chrome = new BrowserWebDriverContainer<>(ArmUtil.select("seleniarm/standalone-chromium:107.0", "selenium/standalone-chrome:107.0"))
public final BrowserWebDriverContainer<?> chrome = new BrowserWebDriverContainer<>(ArmUtil.select("seleniarm/standalone-chromium:latest", "selenium/standalone-chrome:latest"))
.withNetwork(containerSetup.getNetwork())
.withNetworkAliases("chrome")
.withCapabilities(new ChromeOptions())
Expand Down
22 changes: 11 additions & 11 deletions src/integrationTest/java/io/jaconi/morp/TestContainerSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.testcontainers.containers.Network;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.lifecycle.Startables;
import org.testcontainers.utility.DockerImageName;
import org.testcontainers.utility.DockerLoggerFactory;
import reactor.netty.http.client.HttpClient;
Expand Down Expand Up @@ -54,12 +55,15 @@ public TestContainerSetup() {

// setup mockserver (as protected upstream)
var tag = "mockserver-%s".formatted(MockServerClient.class.getPackage().getImplementationVersion());
this.mockserver = new MockServerContainer(DockerImageName.parse("mockserver/mockserver").withTag(tag))
DockerImageName mockServerImage = DockerImageName.parse("mockserver/mockserver").withTag(tag);
this.mockserver = new MockServerContainer(mockServerImage)
.withNetwork(network)
.withNetworkAliases("upstream");
.withNetworkAliases("upstream")
.withLogConsumer(new Slf4jLogConsumer(DockerLoggerFactory.getLogger(mockServerImage.asCanonicalNameString())));

// setup morp as auth proxy for upstream
this.morp = new GenericContainer<>(DockerImageName.parse("ghcr.io/jaconi-io/morp:latest"))
DockerImageName morpImage = DockerImageName.parse("ghcr.io/jaconi-io/morp:latest");
this.morp = new GenericContainer<>(morpImage)
.withNetwork(network)
.withNetworkAliases("morp", "tenant1-morp", "tenant2-morp")
.withExposedPorts(8080, 8081)
Expand All @@ -71,12 +75,8 @@ public TestContainerSetup() {
.waitingFor(new HttpWaitStrategy()
.forPort(8081)
.forPath("/actuator/health/readiness")
.withStartupTimeout(Duration.ofMinutes(5)));

// start the containers
keycloak.start();
mockserver.withLogConsumer(new Slf4jLogConsumer(DockerLoggerFactory.getLogger(mockserver.getDockerImageName())))
.start();
.withStartupTimeout(Duration.ofMinutes(5)))
.withLogConsumer(new Slf4jLogConsumer(DockerLoggerFactory.getLogger(morpImage.asCanonicalNameString())));

// for local development convenience, bind mount the git-ignored 'secret.properties' (if it exists)
if (Files.exists(Path.of("./secret.properties"))) {
Expand All @@ -92,8 +92,8 @@ public TestContainerSetup() {
.filter(e -> e.getKey().startsWith("MORP_"))
.forEach(e -> morp.withEnv(e.getKey(), e.getValue()));

morp.withLogConsumer(new Slf4jLogConsumer(DockerLoggerFactory.getLogger(morp.getDockerImageName())))
.start();
// start the containers
Startables.deepStart(keycloak, mockserver, morp).join();

// create client to control mockserver (running as container)
mockServerClient = new MockServerClient(mockserver.getHost(), mockserver.getServerPort());
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/jaconi/morp/MorpApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;

@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DisabledInAotMode
class MorpApplicationTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DisabledInAotMode
class MorpReactiveOAuth2UserServiceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DisabledInAotMode
class MorpReactiveOidcUserServiceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.when;

@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DisabledInAotMode
class RegistrationResolverTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;

@SpringBootTest
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DisabledInAotMode
class TenantAwareClientRegistrationRepositoryTest {

Expand Down

0 comments on commit 217602f

Please sign in to comment.