Merge branch '3.4.x'
This commit is contained in:
commit
cb3874fdbe
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
|
|
@ -20,13 +20,11 @@ import java.sql.Driver;
|
|||
import java.time.Duration;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import org.springframework.boot.autoconfigure.jdbc.JdbcConnectionDetails;
|
||||
import org.springframework.boot.docker.compose.service.connection.test.DockerComposeTest;
|
||||
import org.springframework.boot.jdbc.DatabaseDriver;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.boot.testsupport.junit.DisabledOnOs;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
|
@ -38,8 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@DisabledOnOs(os = { OS.LINUX, OS.MAC }, architecture = "aarch64",
|
||||
disabledReason = "The Oracle image has no ARM support")
|
||||
class OracleFreeJdbcDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
|
|
@ -21,13 +21,11 @@ import java.time.Duration;
|
|||
import io.r2dbc.spi.ConnectionFactories;
|
||||
import io.r2dbc.spi.ConnectionFactoryOptions;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcConnectionDetails;
|
||||
import org.springframework.boot.docker.compose.service.connection.test.DockerComposeTest;
|
||||
import org.springframework.boot.jdbc.DatabaseDriver;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.boot.testsupport.junit.DisabledOnOs;
|
||||
import org.springframework.r2dbc.core.DatabaseClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
|
@ -37,8 +35,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@DisabledOnOs(os = { OS.LINUX, OS.MAC }, architecture = "aarch64",
|
||||
disabledReason = "The Oracle image has no ARM support")
|
||||
class OracleFreeR2dbcDockerComposeConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@DockerComposeTest(composeFile = "oracle-compose.yaml", image = TestImage.ORACLE_FREE)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.boot.docker.compose.service.connection.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -63,9 +64,9 @@ class DockerComposeTestExtension implements BeforeTestExecutionCallback, AfterTe
|
|||
Path workspace = Files.createTempDirectory("DockerComposeTestExtension-");
|
||||
store.put(STORE_KEY_WORKSPACE, workspace);
|
||||
try {
|
||||
Path transformedComposeFile = prepareComposeFile(workspace, context);
|
||||
Path composeFile = prepareComposeFile(workspace, context);
|
||||
copyAdditionalResources(workspace, context);
|
||||
SpringApplication application = prepareApplication(transformedComposeFile);
|
||||
SpringApplication application = prepareApplication(composeFile);
|
||||
store.put(STORE_KEY_APPLICATION_CONTEXT, application.run());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
@ -84,11 +85,11 @@ class DockerComposeTestExtension implements BeforeTestExecutionCallback, AfterTe
|
|||
|
||||
private Path transformedComposeFile(Path workspace, Resource composeFileResource, TestImage image) {
|
||||
try {
|
||||
Path composeFile = composeFileResource.getFile().toPath();
|
||||
String transformedContent = Files.readString(composeFile).replace("{imageName}", image.toString());
|
||||
Path transformedComposeFile = workspace.resolve("compose.yaml");
|
||||
Files.writeString(transformedComposeFile, transformedContent);
|
||||
return transformedComposeFile;
|
||||
String template = composeFileResource.getContentAsString(StandardCharsets.UTF_8);
|
||||
String content = template.replace("{imageName}", image.toString());
|
||||
Path composeFile = workspace.resolve("compose.yaml");
|
||||
Files.writeString(composeFile, content);
|
||||
return composeFile;
|
||||
}
|
||||
catch (IOException ex) {
|
||||
fail("Error transforming Docker compose file '" + composeFileResource + "': " + ex.getMessage(), ex);
|
||||
|
|
@ -114,11 +115,11 @@ class DockerComposeTestExtension implements BeforeTestExecutionCallback, AfterTe
|
|||
}
|
||||
}
|
||||
|
||||
private SpringApplication prepareApplication(Path transformedComposeFile) {
|
||||
private SpringApplication prepareApplication(Path composeFile) {
|
||||
SpringApplication application = new SpringApplication(Config.class);
|
||||
Map<String, Object> properties = new LinkedHashMap<>();
|
||||
properties.put("spring.docker.compose.skip.in-tests", "false");
|
||||
properties.put("spring.docker.compose.file", transformedComposeFile);
|
||||
properties.put("spring.docker.compose.file", composeFile);
|
||||
properties.put("spring.docker.compose.stop.command", "down");
|
||||
application.setDefaultProperties(properties);
|
||||
return application;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 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.
|
||||
|
|
@ -20,7 +20,6 @@ import java.time.Duration;
|
|||
|
||||
import io.r2dbc.spi.ConnectionFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.OS;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.oracle.OracleContainer;
|
||||
|
|
@ -31,7 +30,6 @@ import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
|||
import org.springframework.boot.jdbc.DatabaseDriver;
|
||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
||||
import org.springframework.boot.testsupport.container.TestImage;
|
||||
import org.springframework.boot.testsupport.junit.DisabledOnOs;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.r2dbc.core.DatabaseClient;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
|
@ -45,8 +43,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
@SpringJUnitConfig
|
||||
@Testcontainers(disabledWithoutDocker = true)
|
||||
@DisabledOnOs(os = { OS.LINUX, OS.MAC }, architecture = "aarch64",
|
||||
disabledReason = "The Oracle image has no ARM support")
|
||||
class OracleFreeR2dbcContainerConnectionDetailsFactoryIntegrationTests {
|
||||
|
||||
@Container
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public enum TestImage {
|
|||
/**
|
||||
* A container image suitable for testing Oracle Free.
|
||||
*/
|
||||
ORACLE_FREE("gvenzl/oracle-free", "23.3-slim", () -> org.testcontainers.oracle.OracleContainer.class,
|
||||
ORACLE_FREE("gvenzl/oracle-free", "23.6-slim", () -> org.testcontainers.oracle.OracleContainer.class,
|
||||
(container) -> ((org.testcontainers.oracle.OracleContainer) container)
|
||||
.withStartupTimeout(Duration.ofMinutes(2))),
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue