Class OracleContainer
java.lang.Object
org.testcontainers.containers.GenericContainer<OracleContainer>
org.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
com.oracle.spring.testcontainers.OracleFreeContainer<OracleContainer>
com.oracle.spring.testcontainers.OracleContainer
- All Implemented Interfaces:
AutoCloseable, org.testcontainers.containers.Container<OracleContainer>, org.testcontainers.containers.ContainerState, org.testcontainers.containers.traits.LinkableContainer, org.testcontainers.containers.wait.strategy.WaitStrategyTarget, org.testcontainers.lifecycle.Startable
Testcontainers implementation for the official Oracle AI Database Free image.
The image provides the SYS, SYSTEM, and PDBADMIN
accounts. This container creates a TEST application user in
FREEPDB1 by default.
Supported image: container-registry.oracle.com/database/free
Exposed port: 1521
-
Nested Class Summary
Nested classes/interfaces inherited from class org.testcontainers.containers.JdbcDatabaseContainer
org.testcontainers.containers.JdbcDatabaseContainer.NoDriverFoundExceptionNested classes/interfaces inherited from interface org.testcontainers.containers.Container
org.testcontainers.containers.Container.ExecResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault role granted to the application user.static final StringDefault image tag.static final StringDefault application user.Fields inherited from class OracleFreeContainer
DEFAULT_DATABASE_NAME, DEFAULT_PASSWORD, DEFAULT_SID, IMAGE_NAME, ORACLE_PASSWORD_ENV, ORACLE_PORTFields inherited from class org.testcontainers.containers.JdbcDatabaseContainer
parameters, urlParametersFields inherited from class org.testcontainers.containers.GenericContainer
CONTAINER_RUNNING_TIMEOUT_SEC, dependencies, dockerClient, INTERNAL_HOST_HOSTNAME, waitStrategyFields inherited from interface org.testcontainers.containers.ContainerState
STATE_HEALTHY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a container using the official image and default tag.OracleContainer(String dockerImageName) Creates a container using an image name.OracleContainer(org.testcontainers.utility.DockerImageName dockerImageName) Creates a container using a parsed image name. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidusingSid()Uses a SID-style connection toFREEasSYSTEMinstead of connecting to theFREEPDB1service.withAdminPassword(String adminPassword) Sets the password used by administrative accounts.withAppUserRoles(String... roles) Replaces the roles granted to the application user.withCharacterSet(String characterSet) Configures the database character set.withDatabaseName(String databaseName) withPassword(String password) Sets the administrator password used by a container without an application-user mode.withUrlParam(String paramName, String paramValue) withUsername(String username) Methods inherited from class OracleFreeContainer
getDriverClassName, getLivenessCheckPortNumbers, getOraclePort, getTestQueryString, hasOracleSecrets, isValidOracleIdentifier, normalizeOracleIdentifier, requireNotBlank, requireValidPassword, requireValidPassword, waitUntilContainerStarted, withArchiveLog, withForceLogging, withOracleSecretsMethods inherited from class org.testcontainers.containers.JdbcDatabaseContainer
addParameter, constructUrlForConnection, constructUrlParameters, constructUrlParameters, containerIsStarted, createConnection, createConnection, getConnectTimeoutSeconds, getDatabaseDelegate, getJdbcDriverInstance, getStartupTimeoutSeconds, optionallyMapResourceParameterAsVolume, optionallyMapResourceParameterAsVolume, runInitScriptIfRequired, setParameters, withConnectTimeoutSeconds, withInitScript, withInitScripts, withInitScripts, withStartupTimeoutSecondsMethods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, canBeReused, containerIsCreated, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setContainerDef, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, stop, toString, waitingFor, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCopyToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectoryMethods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBindMethods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, execInContainer, execInContainer, execInContainerWithUser, execInContainerWithUser, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunningMethods inherited from interface org.testcontainers.containers.traits.LinkableContainer
getContainerNameMethods inherited from interface org.testcontainers.lifecycle.Startable
close
-
Field Details
-
DEFAULT_TAG
-
DEFAULT_USERNAME
-
DEFAULT_APP_USER_ROLE
Default role granted to the application user.- See Also:
-
-
Constructor Details
-
OracleContainer
public OracleContainer()Creates a container using the official image and default tag. -
OracleContainer
Creates a container using an image name.- Parameters:
dockerImageName- compatible Oracle AI Database Free image name
-
OracleContainer
public OracleContainer(org.testcontainers.utility.DockerImageName dockerImageName) Creates a container using a parsed image name.- Parameters:
dockerImageName- compatible Oracle AI Database Free image name
-
-
Method Details
-
configure
protected void configure()- Overrides:
configurein classOracleFreeContainer<OracleContainer>
-
getJdbcUrl
- Specified by:
getJdbcUrlin classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-
getUsername
- Specified by:
getUsernamein classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-
getPassword
- Overrides:
getPasswordin classOracleFreeContainer<OracleContainer>
-
getDatabaseName
- Overrides:
getDatabaseNamein classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-
withUsername
- Overrides:
withUsernamein classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-
withPassword
Description copied from class:OracleFreeContainerSets the administrator password used by a container without an application-user mode.- Overrides:
withPasswordin classOracleFreeContainer<OracleContainer>
-
withAdminPassword
Sets the password used by administrative accounts.- Overrides:
withAdminPasswordin classOracleFreeContainer<OracleContainer>- Parameters:
adminPassword- administrator password- Returns:
- this container
-
withAppUserRoles
Replaces the roles granted to the application user.Role names are normalized to uppercase, validated as unquoted Oracle identifiers, and deduplicated. The application user always receives the
CREATE SESSIONsystem privilege. Pass no roles to grant only that privilege.- Parameters:
roles- application-user roles- Returns:
- this container
-
withDatabaseName
- Overrides:
withDatabaseNamein classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-
usingSid
Uses a SID-style connection toFREEasSYSTEMinstead of connecting to theFREEPDB1service.- Returns:
- this container
-
withCharacterSet
Configures the database character set.- Parameters:
characterSet- Oracle character set name- Returns:
- this container
-
withUrlParam
- Overrides:
withUrlParamin classorg.testcontainers.containers.JdbcDatabaseContainer<OracleContainer>
-