@@ -402,7 +427,6 @@ protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQL
.verifyComplete();
}
-
@Disabled("Compound statements are not supported by Oracle Database")
@Test
@Override
@@ -418,6 +442,11 @@ public void savePoint() {}
@Override
public void savePointStartsTransaction() {}
+ static Mono close(Connection connection) {
+ return Mono.from(connection.close())
+ .then(Mono.empty());
+ }
+
}
/*
diff --git a/src/test/java/oracle/r2dbc/impl/OracleResultImplTest.java b/src/test/java/oracle/r2dbc/impl/OracleResultImplTest.java
index 0121cfa..aad008b 100644
--- a/src/test/java/oracle/r2dbc/impl/OracleResultImplTest.java
+++ b/src/test/java/oracle/r2dbc/impl/OracleResultImplTest.java
@@ -30,7 +30,6 @@
import reactor.core.publisher.Mono;
import reactor.core.publisher.Signal;
-import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
@@ -42,7 +41,6 @@
import static oracle.r2dbc.util.Awaits.awaitMany;
import static oracle.r2dbc.util.Awaits.awaitNone;
import static oracle.r2dbc.util.Awaits.awaitOne;
-import static oracle.r2dbc.util.Awaits.awaitUpdate;
import static org.junit.jupiter.api.Assertions.*;
/**
@@ -50,14 +48,14 @@
* {@link OracleResultImpl} implements behavior that is specified in it's
* class and method level javadocs.
*/
-class OracleResultImplTest {
+public class OracleResultImplTest {
/**
* Verifies the implementation of
* {@link OracleResultImpl#getRowsUpdated()}
*/
@Test
- void testGetRowsUpdated() {
+ public void testGetRowsUpdated() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -178,7 +176,7 @@ void testGetRowsUpdated() {
* {@link OracleResultImpl#map(BiFunction)}
*/
@Test
- void testMap() {
+ public void testMap() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
diff --git a/src/test/java/oracle/r2dbc/impl/OracleStatementImplTest.java b/src/test/java/oracle/r2dbc/impl/OracleStatementImplTest.java
index d05811a..9707f4d 100644
--- a/src/test/java/oracle/r2dbc/impl/OracleStatementImplTest.java
+++ b/src/test/java/oracle/r2dbc/impl/OracleStatementImplTest.java
@@ -24,7 +24,6 @@
import io.r2dbc.spi.Connection;
import io.r2dbc.spi.R2dbcException;
import io.r2dbc.spi.Result;
-import io.r2dbc.spi.Row;
import io.r2dbc.spi.Statement;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
@@ -34,7 +33,6 @@
import java.math.BigDecimal;
import java.sql.RowId;
import java.util.Collections;
-import java.util.List;
import static java.util.Arrays.asList;
import static oracle.r2dbc.DatabaseConfig.connectTimeout;
@@ -42,7 +40,6 @@
import static oracle.r2dbc.DatabaseConfig.sharedConnection;
import static oracle.r2dbc.util.Awaits.awaitError;
import static oracle.r2dbc.util.Awaits.awaitExecution;
-import static oracle.r2dbc.util.Awaits.awaitMany;
import static oracle.r2dbc.util.Awaits.awaitNone;
import static oracle.r2dbc.util.Awaits.awaitOne;
import static oracle.r2dbc.util.Awaits.awaitQuery;
@@ -62,7 +59,7 @@ public class OracleStatementImplTest {
* {@link OracleStatementImpl#bind(int, Object)}
*/
@Test
- void testBindByIndex() {
+ public void testBindByIndex() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -184,7 +181,7 @@ class UnsupportedType {
* {@link OracleStatementImpl#bind(String, Object)}
*/
@Test
- void testBindByName() {
+ public void testBindByName() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -326,7 +323,7 @@ class UnsupportedType {
* {@link OracleStatementImpl#bindNull(int, Class)}
*/
@Test
- void testBindNullByIndex() {
+ public void testBindNullByIndex() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -464,7 +461,7 @@ void testBindNullByIndex() {
* {@link OracleStatementImpl#bindNull(String, Class)}
*/
@Test
- void testBindNullByName() {
+ public void testBindNullByName() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -633,7 +630,7 @@ void testBindNullByName() {
* {@link OracleStatementImpl#add()}
*/
@Test
- void testAdd() {
+ public void testAdd() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -744,7 +741,7 @@ void testAdd() {
* {@link OracleStatementImpl#execute()}
*/
@Test
- void testExecute() {
+ public void testExecute() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -849,7 +846,7 @@ void testExecute() {
* {@link OracleStatementImpl#returnGeneratedValues(String...)}
*/
@Test
- void testReturnGeneratedValues() {
+ public void testReturnGeneratedValues() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
@@ -995,7 +992,7 @@ void testReturnGeneratedValues() {
* {@link OracleStatementImpl#fetchSize(int)
*/
@Test
- void testFetchSize() {
+ public void testFetchSize() {
Connection connection =
Mono.from(sharedConnection()).block(connectTimeout());
try {
diff --git a/src/test/java/oracle/r2dbc/util/DatabaseConfigExtension.java b/src/test/java/oracle/r2dbc/util/DatabaseConfigExtension.java
deleted file mode 100755
index 5c0c75d..0000000
--- a/src/test/java/oracle/r2dbc/util/DatabaseConfigExtension.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- Copyright (c) 2020, 2021, Oracle and/or its affiliates.
-
- This software is dual-licensed to you under the Universal Permissive License
- (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
- 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
- either license.
-
- 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
-
- https://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 oracle.r2dbc.util;
-
-import oracle.jdbc.pool.OracleDataSource;
-import oracle.r2dbc.DatabaseConfig;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.springframework.jdbc.core.JdbcOperations;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.sql.SQLException;
-import java.util.Properties;
-
-/**
- * JUnit Extension to establish an Oracle Database connection configuration
- * during integration tests.
- *
- * @author harayuanwang
- * @since 0.1.0
- */
-public final class DatabaseConfigExtension implements BeforeAllCallback {
- private JdbcOperations jdbcOperations;
- private OracleDataSource dataSource;
-
- @Override
- public void beforeAll(ExtensionContext extensionContext)
- throws IOException, SQLException {
- initialize();
- }
-
- private void initialize() throws IOException, SQLException {
- dataSource = new OracleDataSource();
- dataSource.setURL(String.format("jdbc:oracle:thin:@%s:%d/%s",
- DatabaseConfig.host(), DatabaseConfig.port(),
- DatabaseConfig.serviceName()));
- dataSource.setUser(DatabaseConfig.user());
- dataSource.setPassword(DatabaseConfig.password());
- this.jdbcOperations = new JdbcTemplate(dataSource);
- }
-
- public JdbcOperations getJDBCOperations() {
- return this.jdbcOperations;
- }
-
- public String getUsername() {
- return DatabaseConfig.user();
- }
-
- public String getPassword() {
- return DatabaseConfig.password();
- }
-
- public String getServiceName() {
- return DatabaseConfig.serviceName();
- }
-
- public String getHost() {
- return DatabaseConfig.host();
- }
-
- public int getPort() {
- return DatabaseConfig.port();
- }
-}
-
-/*
- MODIFIED (MM/DD/YY)
- harayuanwang 05/12/20 - Creation
- */
diff --git a/src/test/java/oracle/r2dbc/util/OracleTestKitSupport.java b/src/test/java/oracle/r2dbc/util/OracleTestKitSupport.java
deleted file mode 100755
index a9d58fb..0000000
--- a/src/test/java/oracle/r2dbc/util/OracleTestKitSupport.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- Copyright (c) 2020, 2021, Oracle and/or its affiliates.
-
- This software is dual-licensed to you under the Universal Permissive License
- (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
- 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
- either license.
-
- 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
-
- https://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 oracle.r2dbc.util;
-
-import io.r2dbc.spi.ConnectionFactories;
-import io.r2dbc.spi.ConnectionFactory;
-import io.r2dbc.spi.ConnectionFactoryOptions;
-import oracle.r2dbc.impl.OracleConnectionFactoryProviderImpl;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import static io.r2dbc.spi.ConnectionFactoryOptions.*;
-
-/**
- * Initializes a {@link ConnectionFactory} with options specified
- * by {@link DatabaseConfigExtension}.
- *
- * @author harayuanwang
- * @since 0.1.0
- */
-public abstract class OracleTestKitSupport {
- @RegisterExtension
- protected static final DatabaseConfigExtension CONFIG =
- new DatabaseConfigExtension();
-
- protected static ConnectionFactory connectionFactory;
-
- @BeforeAll
- static void beforeAll() {
- ConnectionFactoryOptions options = builder().build();
- connectionFactory = ConnectionFactories.get(options);
- }
-
- static ConnectionFactoryOptions.Builder builder() {
- return ConnectionFactoryOptions.builder()
- .option(DRIVER, new OracleConnectionFactoryProviderImpl().getDriver())
- .option(DATABASE, CONFIG.getServiceName())
- .option(HOST, CONFIG.getHost())
- .option(PORT, CONFIG.getPort())
- .option(PASSWORD, CONFIG.getPassword())
- .option(USER, CONFIG.getUsername());
- }
-}
-
-/*
- MODIFIED (MM/DD/YY)
- harayuanwang 05/12/20 - Creation
- */
From ab87d0f0893c9c987b89093202add17899b75958 Mon Sep 17 00:00:00 2001
From: Michael-A-McMahon
Date: Sun, 7 Mar 2021 14:24:06 -0800
Subject: [PATCH 3/4] Add main method to print build info
---
pom.xml | 29 ++++++++
src/main/java/oracle/r2dbc/impl/Main.java | 84 +++++++++++++++++++++++
2 files changed, 113 insertions(+)
create mode 100644 src/main/java/oracle/r2dbc/impl/Main.java
diff --git a/pom.xml b/pom.xml
index aded4b9..fe3c510 100755
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,35 @@
${java.version}
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.1
+
+
+
+ Oracle R2DBC
+
+ ${project.version}
+
+ Oracle Corporation
+
+ R2DBC - Reactive Relational Database Connectivity
+
+ ${r2dbc.version}
+
+ Pivotal Software, Inc
+
+
+ Oracle R2DBC ${project.version} compiled with JDK ${java.vm.version} from ${java.vm.vendor} on ${maven.build.timestamp}
+
+
+ oracle.r2dbc.impl.Main
+
+
+
+
+ org.apache.maven.pluginsmaven-deploy-plugin
diff --git a/src/main/java/oracle/r2dbc/impl/Main.java b/src/main/java/oracle/r2dbc/impl/Main.java
new file mode 100644
index 0000000..4a15342
--- /dev/null
+++ b/src/main/java/oracle/r2dbc/impl/Main.java
@@ -0,0 +1,84 @@
+/*
+ Copyright (c) 2020, 2021, Oracle and/or its affiliates.
+
+ This software is dual-licensed to you under the Universal Permissive License
+ (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License
+ 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
+ either license.
+
+ 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
+
+ https://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 oracle.r2dbc.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
+import java.util.jar.Manifest;
+
+/**
+ *
+ * A public class implementing a main method that may be executed from a
+ * command line. This class is specified as the Main-Class attribute in
+ * the META-INF/MANIFEST.MF of the Oracle R2DBC jar.
+ *
+ * The behavior implemented by this class may change between minor and patch
+ * version release updates.
+ *
+ * The following command, in
+ * which "x.y.z" is the semantic version number of the jar,
+ * executes the main method of this class:
+ *
+ * java -jar oracle-r2dbc-x.y.z.jar
+ *
+ * Since version 0.1.1, the main method is implemented to exit after printing
+ * a message to the standard output stream. The message includes the version
+ * numbers of the Oracle R2DBC Driver along with the JDK that compiled it. A
+ * timestamp captured at the moment when the jar was compiled is also included.
+ *
+ *
+ * @since 0.1.1
+ * @author Michael-A-McMahon
+ */
+public final class Main {
+
+ private Main() {/*This class has no instance fields*/}
+
+ /**
+ * Prints information about this build of Oracle R2DBC. This method attempts
+ * to read a "Build-Info" attribute from META-INF/MANIFEST.MF. If the
+ * manifest is not available to the class loader, or if the manifest does
+ * not contain a Build-Info attribute, then this method prints a message
+ * indicating that build information can not be located.
+ * @param args ignored
+ * @throws IOException If the META-INF/MANIFEST.MF resource can not be read.
+ */
+ public static void main(String[] args) throws IOException {
+
+ InputStream manifestStream =
+ Main.class.getModule().getResourceAsStream("META-INF/MANIFEST.MF");
+
+ if (manifestStream == null) {
+ System.out.println("META-INF/MANIFEST.MF not found");
+ return;
+ }
+
+ try (manifestStream) {
+ System.out.println(Objects.requireNonNullElse(
+ new Manifest(manifestStream)
+ .getMainAttributes()
+ .getValue("Build-Info"),
+ "Build-Info is missing from the manifest"));
+ }
+ }
+}
From 28879f26e07aabdbb078a76d8db3340aed9f08a7 Mon Sep 17 00:00:00 2001
From: jean_de_lavarene
Date: Fri, 12 Mar 2021 18:48:41 +0100
Subject: [PATCH 4/4] Change the module name
---
src/main/java/module-info.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
index af213c3..1c59cc7 100644
--- a/src/main/java/module-info.java
+++ b/src/main/java/module-info.java
@@ -24,7 +24,7 @@
* @provides io.r2dbc.spi.ConnectionFactoryProvider
* @since 0.1.1
*/
-module oracle.r2dbc {
+module com.oracle.database.r2dbc {
provides io.r2dbc.spi.ConnectionFactoryProvider
with oracle.r2dbc.impl.OracleConnectionFactoryProviderImpl;