Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oralce12 module moved back #2664

Merged
merged 7 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/versions-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,32 @@ jobs:
MAVEN_CONFIG: "-B -fae -pl :jdbi3-spring5 -Ddep.spring.version=${{ matrix.test-version }}"
run: |
make run-tests

oracle:
name: Test Oracle versions
runs-on: ubuntu-latest

strategy:
matrix:
test-version: [ '21-slim-faststart', '18-slim-faststart' ]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven

- name: Build
env:
MAVEN_CONFIG: "-B -fae"
run: |
make install-fast

- name: Test
env:
MAVEN_CONFIG: "-B -fae -Doracle.container.version=${{ matrix.test-version }}"
run: |
make run-slow-tests
13 changes: 0 additions & 13 deletions docs/src/adoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ jdbi3-oracle12::
jdbi3-postgis::
Support for https://postgis.net/[PostGIS^] types.

[NOTE]
While Oracle support is considered part of Jdbi, the actual library is developed and shipped as a separate component for historic reasons.


===== SQL rendering

Expand Down Expand Up @@ -309,16 +306,6 @@ The following modules are maintained outside the main Jdbi tree:
[%header, cols="<1, ^1, ^1, ^1, <3", stripe=none]
|===
| Module | Source | Javadoc | Site | Description
| jdbi3-oracle12 | https://github.com/jdbi/jdbi3-oracle12/[Github^]
ifndef::release[]
| https://jdbi.org/modules/jdbi3-oracle12/apidocs/[Javadoc^]
| https://jdbi.org/modules/jdbi3-oracle12/[Site^]
endif::[]
ifdef::release[]
| https://jdbi.org/modules/jdbi3-oracle12/releases/{revnumber}/apidocs/[Javadoc^]
| https://jdbi.org/modules/jdbi3-oracle12/releases/{revnumber}/[Site^]
endif::[]
| Support for Oracle 12 and beyond.
| jdbi3-guava-cache | https://github.com/jdbi/jdbi3-guava-cache/[Github^]
ifndef::release[]
| https://jdbi.org/modules/jdbi3-guava-cache/apidocs/[Javadoc^]
Expand Down
7 changes: 7 additions & 0 deletions internal/build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<dep.moshi.version>1.15.0</dep.moshi.version>
<dep.mssql.version>12.4.2.jre11</dep.mssql.version>
<dep.mysql.version>8.2.0</dep.mysql.version>
<dep.oracle-xe.version>23.3.0.23.09</dep.oracle-xe.version>
<dep.otj-pg-embedded.version>1.0.2</dep.otj-pg-embedded.version>
<dep.pg-embedded.version>5.1.0</dep.pg-embedded.version>
<dep.plugin.asciidoctor.version>2.2.4</dep.plugin.asciidoctor.version>
Expand Down Expand Up @@ -313,6 +314,12 @@
<version>${dep.postgresql.version}</version>
</dependency>

<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${dep.oracle-xe.version}</version>
</dependency>

<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
Expand Down
111 changes: 111 additions & 0 deletions oracle12/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jdbi.internal</groupId>
<artifactId>jdbi3-parent</artifactId>
<version>3.45.2-SNAPSHOT</version>
</parent>

<groupId>org.jdbi</groupId>
<artifactId>jdbi3-oracle12</artifactId>

<name>jdbi3 oracle12</name>
<description>Support for Oracle 12+ specific features.</description>

<properties>
<basepom.test.fork-count>1</basepom.test.fork-count>
<moduleName>org.jdbi.v3.oracle12</moduleName>
</properties>

<dependencies>
<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-core</artifactId>
</dependency>

<!-- https://www.oracle.com/database/technologies/maven-central-guide.html -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-testing</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>oracle-xe</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>jdbc</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-core</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-sqlobject</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jdbi</groupId>
<artifactId>jdbi3-testcontainers</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.oracle12;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import oracle.jdbc.pool.OracleDataSource;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.testing.JdbiRule;
import org.testcontainers.containers.OracleContainer;

/**
* JUnit 4 Helper for a database managed by testcontainers.
*/
public class OracleDatabaseRule extends JdbiRule {

private final String uri;
private final String username;
private final String password;

public OracleDatabaseRule(OracleContainer oracleContainer) {
this.uri = oracleContainer.getJdbcUrl();
this.username = oracleContainer.getUsername();
this.password = oracleContainer.getPassword();
}

@Override
protected DataSource createDataSource() {
try {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setURL(uri);
dataSource.setUser(username);
dataSource.setPassword(password);

return dataSource;
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}

public static void createTables(OracleContainer oracleContainer) throws SQLException {
try (Connection connection = oracleContainer.createConnection("")) {
Jdbi jdbi = Jdbi.create(connection);

jdbi.withHandle(handle -> {
handle.execute("create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
handle.execute("create table something (name varchar(200), id int, constraint something_id primary key (id))");
return null;
});
}
}
}