You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2020/09/29 10:26:10 UTC

[ignite] branch master updated: IGNITE-11312 Fix JDBC Driver properties for UI tools like DBeaver - Fixes #6900.

This is an automated email from the ASF dual-hosted git repository.

ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new c1c7f1a  IGNITE-11312 Fix JDBC Driver properties for UI tools like DBeaver - Fixes #6900.
c1c7f1a is described below

commit c1c7f1aaffa173965132a02b7275c3a0d9aad909
Author: Lev Agafonov <Le...@epam.com>
AuthorDate: Tue Sep 29 13:25:12 2020 +0300

    IGNITE-11312 Fix JDBC Driver properties for UI tools like DBeaver - Fixes #6900.
    
    Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java      |  2 +
 .../thin/JdbcThinConnectionPropertiesTest.java     | 64 ++++++++++++++++++++++
 .../jdbc/thin/ConnectionPropertiesImpl.java        |  2 +-
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index ea529d0..36c98a8 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -49,6 +49,7 @@ import org.apache.ignite.jdbc.thin.JdbcThinComplexQuerySelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionAdditionalSecurityTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionMultipleAddressesTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionMvccEnabledSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinConnectionPropertiesTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionSSLTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionSelfTest;
 import org.apache.ignite.jdbc.thin.JdbcThinConnectionTimeoutSelfTest;
@@ -174,6 +175,7 @@ import org.junit.runners.Suite;
     JdbcThinDataSourceSelfTest.class,
     JdbcThinPreparedStatementSelfTest.class,
     JdbcThinResultSetSelfTest.class,
+    JdbcThinConnectionPropertiesTest.class,
 
     JdbcThinStatementSelfTest.class,
     JdbcThinComplexQuerySelfTest.class,
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionPropertiesTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionPropertiesTest.java
new file mode 100644
index 0000000..2d7e72b
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionPropertiesTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.ignite.jdbc.thin;
+
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Properties;
+import org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl;
+import org.junit.Test;
+
+/**
+ * {@link ConnectionPropertiesImpl} unit tests.
+ */
+public class JdbcThinConnectionPropertiesTest extends JdbcThinAbstractSelfTest {
+    /**
+     * Test check the {@link ConnectionPropertiesImpl#getDriverPropertyInfo()} return properties with prefix {@link
+     * ConnectionPropertiesImpl#PROP_PREFIX}
+     */
+    @Test
+    public void testNamePrefixDriverPropertyInfo() {
+        ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
+        DriverPropertyInfo[] propsInfo = connProps.getDriverPropertyInfo();
+
+        String propName = propsInfo[0].name;
+
+        assertTrue(propName.startsWith(ConnectionPropertiesImpl.PROP_PREFIX));
+    }
+
+    /**
+     * Test check the {@link ConnectionPropertiesImpl#init(String, Properties)} requires property names
+     * with prefix {@link ConnectionPropertiesImpl#PROP_PREFIX}
+     */
+    @Test
+    public void testPrefixedPropertiesApplicable() throws SQLException {
+        final String TEST_PROP_NAME = ConnectionPropertiesImpl.PROP_PREFIX + "enforceJoinOrder";
+        final Properties props = new Properties();
+
+        props.setProperty(TEST_PROP_NAME, Boolean.TRUE.toString());
+        ConnectionPropertiesImpl connPropsTrue = new ConnectionPropertiesImpl();
+        connPropsTrue.init("", props);
+
+        props.setProperty(TEST_PROP_NAME, Boolean.FALSE.toString());
+        ConnectionPropertiesImpl connPropsFalse = new ConnectionPropertiesImpl();
+        connPropsFalse.init("", props);
+
+        assertTrue(connPropsTrue.isEnforceJoinOrder());
+        assertFalse(connPropsFalse.isEnforceJoinOrder());
+    }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
index 93d0107..9cc5853 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/ConnectionPropertiesImpl.java
@@ -1088,7 +1088,7 @@ public class ConnectionPropertiesImpl implements ConnectionProperties, Serializa
          * @return JDBC property info object.
          */
         DriverPropertyInfo getDriverPropertyInfo() {
-            DriverPropertyInfo dpi = new DriverPropertyInfo(name, valueObject());
+            DriverPropertyInfo dpi = new DriverPropertyInfo(PROP_PREFIX + name, valueObject());
 
             dpi.choices = choices();
             dpi.required = required;