Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v1.24
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: target/**/TEST**.xml
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:
- name: Install demo project
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh

- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '11'
distribution: 'adopt'
java-version: '21'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand All @@ -65,7 +65,7 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v1.24
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: target/**/TEST**.xml
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
47 changes: 30 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

<groupId>org.utplsql</groupId>
<artifactId>utplsql-java-api</artifactId>
<version>3.1.17-SNAPSHOT</version>
<version>3.2.01-SNAPSHOT</version>

<name>utPLSQL Java API</name>
<description>Java API for running Unit Tests with utPLSQL v3+.</description>
<url>https://github.com/utPLSQL/utPLSQL-java-api</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.jupiter.version>5.5.2</junit.jupiter.version>
<oracle.jdbc.version>19.3.0.0</oracle.jdbc.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<junit.jupiter.version>5.12.2</junit.jupiter.version>
<oracle.jdbc.version>23.7.0.25.01</oracle.jdbc.version>

<sonar.organization>utplsql</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down Expand Up @@ -48,17 +48,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
<version>2.0.17</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
<artifactId>ojdbc11</artifactId>
<version>${oracle.jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>19.3.0.0</version>
<version>${oracle.jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand All @@ -75,12 +75,14 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.1</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
<version>5.17.0</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -92,14 +94,20 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>3.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<goals>
Expand All @@ -109,10 +117,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>5.1.0.4751</version>
</plugin>
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.18.0</version>
<version>1.21.0</version>
<configuration>
<verbose>true</verbose>
<gitFlowConfig>
Expand All @@ -131,7 +144,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<version>0.8.13</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down Expand Up @@ -162,7 +175,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -175,7 +188,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -189,7 +202,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void fetchAvailable(Connection conn, Consumer<String> onLineFetched) thro
cstmt.execute();
cstmt.setFetchSize(fetchSize);

try (ResultSet resultSet = (ResultSet) cstmt.getObject(1)) {
try (ResultSet resultSet = (ResultSet) cstmt.getObject("lines_cursor")) {
while (resultSet.next()) {
onLineFetched.accept(resultSet.getString("text"));
}
Expand All @@ -114,7 +114,7 @@ public List<String> fetchAll(Connection conn) throws SQLException {
cstmt.execute();
cstmt.setFetchSize(fetchSize);

try (ResultSet resultSet = (ResultSet) cstmt.getObject(1)) {
try (ResultSet resultSet = (ResultSet) cstmt.getObject("lines_cursor")) {

List<String> outputLines = new ArrayList<>();
while (resultSet.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class CompatibilityOutputBufferPre310 extends AbstractOutputBuffer {

@Override
protected CallableStatement getLinesCursorStatement(Connection conn) throws SQLException {
CallableStatement cstmt = conn.prepareCall("BEGIN ? := ut_output_buffer.get_lines_cursor(?); END;");
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.setString(2, getReporter().getId());
CallableStatement cstmt = conn.prepareCall("begin :lines_cursor := ut_output_buffer.get_lines_cursor(:reporter_id); end;");
cstmt.registerOutParameter("lines_cursor", OracleTypes.CURSOR);
cstmt.setString("reporter_id", getReporter().getId());
return cstmt;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.utplsql.api.outputBuffer;

import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleTypes;
import org.utplsql.api.reporter.Reporter;

Expand All @@ -28,10 +27,16 @@

@Override
protected CallableStatement getLinesCursorStatement(Connection conn) throws SQLException {
OracleConnection oraConn = conn.unwrap(OracleConnection.class);
OracleCallableStatement cstmt = (OracleCallableStatement) oraConn.prepareCall("{? = call ?.get_lines_cursor() }");
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.setORAData(2, getReporter());
Reporter reporter = getReporter();
String plsql = "declare" +
" l_rep " + reporter.getTypeName() + " := " + reporter.getTypeName() + "(); " +
"begin" +
" l_rep.set_reporter_id(:reporter_id); " +
" :lines_cursor := l_rep.get_lines_cursor(); " +
"end;";
OracleCallableStatement cstmt = (OracleCallableStatement) conn.prepareCall(plsql);

Check failure on line 37 in src/main/java/org/utplsql/api/outputBuffer/DefaultOutputBuffer.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use try-with-resources or close this "CallableStatement" in a "finally" clause.

See more on https://sonarcloud.io/project/issues?id=utPLSQL_utPLSQL-java-api&issues=AZ21-CbyJUZXwPu5nNMw&open=AZ21-CbyJUZXwPu5nNMw&pullRequest=106
cstmt.setString("reporter_id", reporter.getId());
cstmt.registerOutParameter("lines_cursor", OracleTypes.CURSOR);
return cstmt;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package org.utplsql.api.reporter.inspect;

import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleType;
import org.utplsql.api.compatibility.CompatibilityProxy;
import org.utplsql.api.reporter.Reporter;
import org.utplsql.api.reporter.ReporterFactory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
import java.util.*;

/**
Expand Down Expand Up @@ -48,7 +40,7 @@ private ReporterInfo getReporterInfo(String reporterNameWithOwner) throws SQLExc
String reporterName = reporterNameWithOwner.substring(reporterNameWithOwner.indexOf(".") + 1).toUpperCase();

ReporterInfo.Type type = ReporterInfo.Type.SQL;
String description = getDescription(reporterName);
String description = getDescription(reporterNameWithOwner);

if (registeredReporterFactoryMethods.containsKey(reporterName)) {
type = ReporterInfo.Type.SQL_WITH_JAVA;
Expand All @@ -58,16 +50,12 @@ private ReporterInfo getReporterInfo(String reporterNameWithOwner) throws SQLExc
return new ReporterInfo(reporterName, type, description);
}

private String getDescription(String reporterName) throws SQLException {
CompatibilityProxy compatibilityProxy = new CompatibilityProxy(connection);
Reporter reporter = reporterFactory.createReporter(reporterName).init(connection, compatibilityProxy, reporterFactory);
OracleConnection oraCon = connection.unwrap(OracleConnection.class);

try (OracleCallableStatement stmt = (OracleCallableStatement) oraCon.prepareCall("{ ? = call ?.get_description() }")) {
stmt.registerOutParameter(1, OracleType.VARCHAR2);
stmt.setORAData(2, reporter);
private String getDescription(String reporterNameWithOwner) throws SQLException {
String plsql = "DECLARE l_obj " + reporterNameWithOwner + " := " + reporterNameWithOwner + "(); "
+ "BEGIN :1 := l_obj.get_description(); END;";
try (CallableStatement stmt = connection.prepareCall(plsql)) {
stmt.registerOutParameter(1, Types.VARCHAR);
stmt.execute();

return stmt.getString(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/utplsql/api/JavaApiVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class JavaApiVersionTest {

@Test
void getJavaApiVersion() {
assertThat(JavaApiVersionInfo.getVersion(), startsWith("3.1"));
assertThat(JavaApiVersionInfo.getVersion(), startsWith("3.2"));
}
}
Loading