◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
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
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
uses: actions/setup-java@v5
with:
java-version: '11'
distribution: 'adopt'
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
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
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
@@ -4,18 +4,18 @@

<groupId>org.utplsql</groupId>
<artifactId>utplsql-java-api</artifactId>
<version>3.1.17-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>

<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>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
@@ -75,12 +75,14 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>

Expand All @@ -92,14 +94,20 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
Expand All @@ -109,10 +117,15 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.18.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>
<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>
<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>
<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>
<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)) {
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)) {

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());
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;

@@ -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());

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
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.util.*;

/**
Expand Down @@ -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);

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);
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"));
}
}
Loading
Toggle all file notes Toggle all file annotations