Skip to content

Commit

Permalink
Update Oracle-XE docs and use code example from tests (testcontainers…
Browse files Browse the repository at this point in the history
…#4385)

Co-authored-by: Sergei Egorov <[email protected]>
  • Loading branch information
kiview and bsideup authored Jul 21, 2022
1 parent c654018 commit d387d85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
25 changes: 4 additions & 21 deletions docs/modules/databases/oraclexe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,10 @@ See [Database containers](./index.md) for documentation and usage that is common

## Usage example

Running Oracle XE as a stand-in for in a test:

```java
public class SomeTest {

@Rule
public OracleContainer oracle = new OracleContainer("name_of_your_oracle_xe_image");

@Test
public void someTestMethod() {
String url = oracle.getJdbcUrl();

... create a connection and run test as normal
```

## Specifying a docker image name via config

If you do not pass an image name to the `OracleContainer` constructor, a suitable image name should be placed in
configuration instead.
To do this, please place a file on the classpath named `testcontainers.properties`,
containing `oracle.container.image=IMAGE`, where IMAGE is a suitable image name and tag.
You can use `OracleContainer` like any other JDBC container:
<!--codeinclude-->
[Container creation](../../../modules/oracle-xe/src/test/java/org/testcontainers/junit/oracle/SimpleOracleTest.java) inside_block:constructor
<!--/codeinclude-->

## Adding this module to your project dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ public void testPluggableDatabase() throws SQLException {
@Test
public void testPluggableDatabaseAndCustomUser() throws SQLException {
try (
OracleContainer oracle = new OracleContainer(ORACLE_DOCKER_IMAGE_NAME)
// constructor {
OracleContainer oracle = new OracleContainer("gvenzl/oracle-xe:18.4.0-slim")
.withDatabaseName("testDB")
.withUsername("testUser")
.withPassword("testPassword")
// }
) {
runTest(oracle, "testDB", "testUser", "testPassword");
}
Expand Down

0 comments on commit d387d85

Please sign in to comment.