Add container support for Oracle Free which replaces Oracle XE
Update Docker Compose and Testcontainers support to work with `gvenzl/oracle-free` which replaces `gvenzl/oracle-xe`. Closes gh-38476
This commit is contained in:
@@ -16,28 +16,33 @@
|
||||
|
||||
package org.springframework.boot.docker.compose.service.connection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.docker.compose.core.ImageReference;
|
||||
import org.springframework.boot.docker.compose.core.RunningService;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link Predicate} that matches against connection names.
|
||||
* {@link Predicate} that matches against connection name.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class ConnectionNamePredicate implements Predicate<DockerComposeConnectionSource> {
|
||||
|
||||
private final String required;
|
||||
private final Set<String> required;
|
||||
|
||||
ConnectionNamePredicate(String required) {
|
||||
this.required = asCanonicalName(required);
|
||||
ConnectionNamePredicate(String... required) {
|
||||
Assert.notEmpty(required, "Required must not be empty");
|
||||
this.required = Arrays.stream(required).map(this::asCanonicalName).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(DockerComposeConnectionSource source) {
|
||||
String actual = getActual(source.getRunningService());
|
||||
return this.required.equals(actual);
|
||||
return this.required.contains(actual);
|
||||
}
|
||||
|
||||
private String getActual(RunningService service) {
|
||||
|
||||
@@ -54,6 +54,16 @@ public abstract class DockerComposeConnectionDetailsFactory<D extends Connection
|
||||
this(new ConnectionNamePredicate(connectionName), requiredClassNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DockerComposeConnectionDetailsFactory} instance.
|
||||
* @param connectionNames the required connection name
|
||||
* @param requiredClassNames the names of classes that must be present
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected DockerComposeConnectionDetailsFactory(String[] connectionNames, String... requiredClassNames) {
|
||||
this(new ConnectionNamePredicate(connectionNames), requiredClassNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link DockerComposeConnectionDetailsFactory} instance.
|
||||
* @param predicate a predicate used to check when a service is accepted
|
||||
|
||||
@@ -28,6 +28,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
class OracleEnvironment {
|
||||
|
||||
static final String[] CONTAINER_NAMES = { "gvenzl/oracle-xe", "gvenzl/oracle-free" };
|
||||
|
||||
private final String username;
|
||||
|
||||
private final String password;
|
||||
|
||||
@@ -34,7 +34,7 @@ class OracleJdbcDockerComposeConnectionDetailsFactory
|
||||
extends DockerComposeConnectionDetailsFactory<JdbcConnectionDetails> {
|
||||
|
||||
protected OracleJdbcDockerComposeConnectionDetailsFactory() {
|
||||
super("gvenzl/oracle-xe");
|
||||
super(OracleEnvironment.CONTAINER_NAMES);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,7 +36,7 @@ class OracleR2dbcDockerComposeConnectionDetailsFactory
|
||||
extends DockerComposeConnectionDetailsFactory<R2dbcConnectionDetails> {
|
||||
|
||||
OracleR2dbcDockerComposeConnectionDetailsFactory() {
|
||||
super("gvenzl/oracle-xe", "io.r2dbc.spi.ConnectionFactoryOptions");
|
||||
super(OracleEnvironment.CONTAINER_NAMES, "io.r2dbc.spi.ConnectionFactoryOptions");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user