Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b4a592

Browse files
authored
Merge pull request #106 from utPLSQL/feature/update_dependencies
Update java version and library dependencies
2 parents 3b745ed + 571d95c commit 5b4a592

9 files changed

Lines changed: 59 additions & 53 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
7878

7979
- name: Publish unit test results
80-
uses: EnricoMi/publish-unit-test-result-action@v1.24
80+
uses: EnricoMi/publish-unit-test-result-action@v2
8181
if: always()
8282
with:
8383
files: target/**/TEST**.xml

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838
- name: Install demo project
3939
run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh
4040

41-
- name: Set up JDK 11
41+
- name: Set up JDK 21
4242
uses: actions/setup-java@v5
4343
with:
44-
java-version: '11'
45-
distribution: 'adopt'
44+
java-version: '21'
45+
distribution: 'temurin'
4646
server-id: central
4747
server-username: MAVEN_USERNAME
4848
server-password: MAVEN_PASSWORD
@@ -65,7 +65,7 @@ jobs:
6565
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
6666

6767
- name: Publish unit test results
68-
uses: EnricoMi/publish-unit-test-result-action@v1.24
68+
uses: EnricoMi/publish-unit-test-result-action@v2
6969
if: always()
7070
with:
7171
files: target/**/TEST**.xml

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
1818
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

pom.xml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
<groupId>org.utplsql</groupId>
66
<artifactId>utplsql-java-api</artifactId>
7-
<version>3.1.17-SNAPSHOT</version>
7+
<version>3.2.01-SNAPSHOT</version>
88

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

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<maven.compiler.source>1.8</maven.compiler.source>
16-
<maven.compiler.target>1.8</maven.compiler.target>
17-
<junit.jupiter.version>5.5.2</junit.jupiter.version>
18-
<oracle.jdbc.version>19.3.0.0</oracle.jdbc.version>
15+
<maven.compiler.source>11</maven.compiler.source>
16+
<maven.compiler.target>11</maven.compiler.target>
17+
<junit.jupiter.version>5.12.2</junit.jupiter.version>
18+
<oracle.jdbc.version>23.7.0.25.01</oracle.jdbc.version>
1919

2020
<sonar.organization>utplsql</sonar.organization>
2121
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
@@ -48,17 +48,17 @@
4848
<dependency>
4949
<groupId>org.slf4j</groupId>
5050
<artifactId>slf4j-api</artifactId>
51-
<version>1.7.36</version>
51+
<version>2.0.17</version>
5252
</dependency>
5353
<dependency>
5454
<groupId>com.oracle.database.jdbc</groupId>
55-
<artifactId>ojdbc8</artifactId>
56-
<version>19.3.0.0</version>
55+
<artifactId>ojdbc11</artifactId>
56+
<version>${oracle.jdbc.version}</version>
5757
</dependency>
5858
<dependency>
5959
<groupId>com.oracle.database.nls</groupId>
6060
<artifactId>orai18n</artifactId>
61-
<version>19.3.0.0</version>
61+
<version>${oracle.jdbc.version}</version>
6262
</dependency>
6363
<dependency>
6464
<groupId>com.google.code.findbugs</groupId>
@@ -75,12 +75,14 @@
7575
<dependency>
7676
<groupId>org.hamcrest</groupId>
7777
<artifactId>hamcrest</artifactId>
78-
<version>2.1</version>
78+
<version>2.2</version>
79+
<scope>test</scope>
7980
</dependency>
8081
<dependency>
8182
<groupId>org.mockito</groupId>
8283
<artifactId>mockito-core</artifactId>
83-
<version>3.0.0</version>
84+
<version>5.17.0</version>
85+
<scope>test</scope>
8486
</dependency>
8587
</dependencies>
8688

@@ -92,14 +94,20 @@
9294
</resource>
9395
</resources>
9496
<plugins>
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-compiler-plugin</artifactId>
100+
<version>3.14.0</version>
101+
</plugin>
95102
<plugin>
96103
<groupId>org.apache.maven.plugins</groupId>
97104
<artifactId>maven-surefire-plugin</artifactId>
98-
<version>3.1.2</version>
105+
<version>3.5.3</version>
99106
</plugin>
100107
<plugin>
101108
<groupId>org.apache.maven.plugins</groupId>
102109
<artifactId>maven-failsafe-plugin</artifactId>
110+
<version>3.5.3</version>
103111
<executions>
104112
<execution>
105113
<goals>
@@ -109,10 +117,15 @@
109117
</execution>
110118
</executions>
111119
</plugin>
120+
<plugin>
121+
<groupId>org.sonarsource.scanner.maven</groupId>
122+
<artifactId>sonar-maven-plugin</artifactId>
123+
<version>5.1.0.4751</version>
124+
</plugin>
112125
<plugin>
113126
<groupId>com.amashchenko.maven.plugin</groupId>
114127
<artifactId>gitflow-maven-plugin</artifactId>
115-
<version>1.18.0</version>
128+
<version>1.21.0</version>
116129
<configuration>
117130
<verbose>true</verbose>
118131
<gitFlowConfig>
@@ -131,7 +144,7 @@
131144
<plugin>
132145
<groupId>org.jacoco</groupId>
133146
<artifactId>jacoco-maven-plugin</artifactId>
134-
<version>0.8.7</version>
147+
<version>0.8.13</version>
135148
<executions>
136149
<execution>
137150
<id>prepare-agent</id>
@@ -162,7 +175,7 @@
162175
<plugin>
163176
<groupId>org.apache.maven.plugins</groupId>
164177
<artifactId>maven-javadoc-plugin</artifactId>
165-
<version>3.3.1</version>
178+
<version>3.11.2</version>
166179
<executions>
167180
<execution>
168181
<id>attach-javadocs</id>
@@ -175,7 +188,7 @@
175188
<plugin>
176189
<groupId>org.apache.maven.plugins</groupId>
177190
<artifactId>maven-source-plugin</artifactId>
178-
<version>3.2.1</version>
191+
<version>3.3.1</version>
179192
<executions>
180193
<execution>
181194
<id>attach-sources</id>
@@ -189,7 +202,7 @@
189202
<plugin>
190203
<groupId>org.apache.maven.plugins</groupId>
191204
<artifactId>maven-gpg-plugin</artifactId>
192-
<version>3.0.1</version>
205+
<version>3.2.7</version>
193206
<executions>
194207
<execution>
195208
<id>sign-artifacts</id>

src/main/java/org/utplsql/api/outputBuffer/AbstractOutputBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void fetchAvailable(Connection conn, Consumer<String> onLineFetched) thro
9292
cstmt.execute();
9393
cstmt.setFetchSize(fetchSize);
9494

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

117-
try (ResultSet resultSet = (ResultSet) cstmt.getObject(1)) {
117+
try (ResultSet resultSet = (ResultSet) cstmt.getObject("lines_cursor")) {
118118

119119
List<String> outputLines = new ArrayList<>();
120120
while (resultSet.next()) {

src/main/java/org/utplsql/api/outputBuffer/CompatibilityOutputBufferPre310.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class CompatibilityOutputBufferPre310 extends AbstractOutputBuffer {
2020

2121
@Override
2222
protected CallableStatement getLinesCursorStatement(Connection conn) throws SQLException {
23-
CallableStatement cstmt = conn.prepareCall("BEGIN ? := ut_output_buffer.get_lines_cursor(?); END;");
24-
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
25-
cstmt.setString(2, getReporter().getId());
23+
CallableStatement cstmt = conn.prepareCall("begin :lines_cursor := ut_output_buffer.get_lines_cursor(:reporter_id); end;");
24+
cstmt.registerOutParameter("lines_cursor", OracleTypes.CURSOR);
25+
cstmt.setString("reporter_id", getReporter().getId());
2626
return cstmt;
2727
}
2828
}

src/main/java/org/utplsql/api/outputBuffer/DefaultOutputBuffer.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.utplsql.api.outputBuffer;
22

33
import oracle.jdbc.OracleCallableStatement;
4-
import oracle.jdbc.OracleConnection;
54
import oracle.jdbc.OracleTypes;
65
import org.utplsql.api.reporter.Reporter;
76

@@ -28,10 +27,16 @@ class DefaultOutputBuffer extends AbstractOutputBuffer {
2827

2928
@Override
3029
protected CallableStatement getLinesCursorStatement(Connection conn) throws SQLException {
31-
OracleConnection oraConn = conn.unwrap(OracleConnection.class);
32-
OracleCallableStatement cstmt = (OracleCallableStatement) oraConn.prepareCall("{? = call ?.get_lines_cursor() }");
33-
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
34-
cstmt.setORAData(2, getReporter());
30+
Reporter reporter = getReporter();
31+
String plsql = "declare" +
32+
" l_rep " + reporter.getTypeName() + " := " + reporter.getTypeName() + "(); " +
33+
"begin" +
34+
" l_rep.set_reporter_id(:reporter_id); " +
35+
" :lines_cursor := l_rep.get_lines_cursor(); " +
36+
"end;";
37+
OracleCallableStatement cstmt = (OracleCallableStatement) conn.prepareCall(plsql);
38+
cstmt.setString("reporter_id", reporter.getId());
39+
cstmt.registerOutParameter("lines_cursor", OracleTypes.CURSOR);
3540
return cstmt;
3641
}
3742
}

src/main/java/org/utplsql/api/reporter/inspect/ReporterInspector310.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
package org.utplsql.api.reporter.inspect;
22

3-
import oracle.jdbc.OracleCallableStatement;
4-
import oracle.jdbc.OracleConnection;
5-
import oracle.jdbc.OracleType;
6-
import org.utplsql.api.compatibility.CompatibilityProxy;
7-
import org.utplsql.api.reporter.Reporter;
83
import org.utplsql.api.reporter.ReporterFactory;
94

10-
import java.sql.Connection;
11-
import java.sql.PreparedStatement;
12-
import java.sql.ResultSet;
13-
import java.sql.SQLException;
5+
import java.sql.*;
146
import java.util.*;
157

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

5042
ReporterInfo.Type type = ReporterInfo.Type.SQL;
51-
String description = getDescription(reporterName);
43+
String description = getDescription(reporterNameWithOwner);
5244

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

61-
private String getDescription(String reporterName) throws SQLException {
62-
CompatibilityProxy compatibilityProxy = new CompatibilityProxy(connection);
63-
Reporter reporter = reporterFactory.createReporter(reporterName).init(connection, compatibilityProxy, reporterFactory);
64-
OracleConnection oraCon = connection.unwrap(OracleConnection.class);
65-
66-
try (OracleCallableStatement stmt = (OracleCallableStatement) oraCon.prepareCall("{ ? = call ?.get_description() }")) {
67-
stmt.registerOutParameter(1, OracleType.VARCHAR2);
68-
stmt.setORAData(2, reporter);
53+
private String getDescription(String reporterNameWithOwner) throws SQLException {
54+
String plsql = "DECLARE l_obj " + reporterNameWithOwner + " := " + reporterNameWithOwner + "(); "
55+
+ "BEGIN :1 := l_obj.get_description(); END;";
56+
try (CallableStatement stmt = connection.prepareCall(plsql)) {
57+
stmt.registerOutParameter(1, Types.VARCHAR);
6958
stmt.execute();
70-
7159
return stmt.getString(1);
7260
}
7361
}

src/test/java/org/utplsql/api/JavaApiVersionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class JavaApiVersionTest {
99

1010
@Test
1111
void getJavaApiVersion() {
12-
assertThat(JavaApiVersionInfo.getVersion(), startsWith("3.1"));
12+
assertThat(JavaApiVersionInfo.getVersion(), startsWith("3.2"));
1313
}
1414
}

0 commit comments

Comments
 (0)