Skip to content

Commit 55eeed9

Browse files
authored
Merge pull request #32 from rafael-telles/change-ssl-parameter-to-useEncryption
Change ssl parameter to UseEncryption
2 parents 7924e7b + e6d01af commit 55eeed9

9 files changed

Lines changed: 56 additions & 55 deletions

File tree

java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static ArrowFlightSqlClientHandler createNewClientHandler(
100100
.withTrustStorePassword(config.getTrustStorePassword())
101101
.withSystemTrustStore(config.useSystemTrustStore())
102102
.withBufferAllocator(allocator)
103-
.withTlsEncryption(config.useTls())
103+
.withEncryption(config.useEncryption())
104104
.withDisableCertificateVerification(config.getDisableCertificateVerification())
105105
.withToken(config.getToken())
106106
.withCallOptions(config.toCallOption())

java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/client/ArrowFlightSqlClientHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public static final class Builder {
345345
private String trustStorePath;
346346
private String trustStorePassword;
347347
private String token;
348-
private boolean useTls;
348+
private boolean useEncryption;
349349
private boolean disableCertificateVerification;
350350
private boolean useSystemTrustStore;
351351
private BufferAllocator allocator;
@@ -419,11 +419,11 @@ public Builder withTrustStorePassword(final String trustStorePassword) {
419419
/**
420420
* Sets whether to use TLS encryption in this handler.
421421
*
422-
* @param useTls whether to use TLS encryption.
422+
* @param useEncryption whether to use TLS encryption.
423423
* @return this instance.
424424
*/
425-
public Builder withTlsEncryption(final boolean useTls) {
426-
this.useTls = useTls;
425+
public Builder withEncryption(final boolean useEncryption) {
426+
this.useEncryption = useEncryption;
427427
return this;
428428
}
429429

@@ -533,15 +533,15 @@ public ArrowFlightSqlClientHandler build() throws SQLException {
533533
withMiddlewareFactories(new ClientCookieMiddleware.Factory());
534534
middlewareFactories.forEach(clientBuilder::intercept);
535535
Location location;
536-
if (useTls) {
536+
if (useEncryption) {
537537
location = Location.forGrpcTls(host, port);
538538
clientBuilder.useTls();
539539
} else {
540540
location = Location.forGrpcInsecure(host, port);
541541
}
542542
clientBuilder.location(location);
543543

544-
if (useTls) {
544+
if (useEncryption) {
545545
if (disableCertificateVerification) {
546546
clientBuilder.verifyServer(false);
547547
} else {

java/flight/flight-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/utils/ArrowFlightConnectionConfigImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public boolean useSystemTrustStore() {
113113
*
114114
* @return whether to use TLS encryption.
115115
*/
116-
public boolean useTls() {
117-
return ArrowFlightConnectionProperty.SSL.getBoolean(properties);
116+
public boolean useEncryption() {
117+
return ArrowFlightConnectionProperty.USE_ENCRYPTION.getBoolean(properties);
118118
}
119119

120120
public boolean getDisableCertificateVerification() {
@@ -149,7 +149,7 @@ public enum ArrowFlightConnectionProperty implements ConnectionProperty {
149149
PORT("port", null, Type.NUMBER, true),
150150
USER("user", null, Type.STRING, false),
151151
PASSWORD("password", null, Type.STRING, false),
152-
SSL("ssl", true, Type.BOOLEAN, false),
152+
USE_ENCRYPTION("useEncryption", true, Type.BOOLEAN, false),
153153
CERTIFICATE_VERIFICATION("disableCertificateVerification", false, Type.BOOLEAN, false),
154154
TRUST_STORE("trustStore", null, Type.STRING, false),
155155
TRUST_STORE_PASSWORD("trustStorePassword", null, Type.STRING, false),

java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void testShouldConnectWhenProvidedWithValidUrl() throws Exception {
115115
driver.connect("jdbc:arrow-flight://" +
116116
dataSource.getConfig().getHost() + ":" +
117117
dataSource.getConfig().getPort() + "?" +
118-
"ssl=false",
118+
"useEncryption=false",
119119
dataSource.getProperties(dataSource.getConfig().getUser(), dataSource.getConfig().getPassword()))) {
120120
assert connection.isValid(300);
121121
}

java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcFactoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testShouldBeAbleToEstablishAConnectionSuccessfully() throws Exceptio
7878
properties.putAll(ImmutableMap.of(
7979
ArrowFlightConnectionProperty.HOST.camelName(), "localhost",
8080
ArrowFlightConnectionProperty.PORT.camelName(), 32010,
81-
ArrowFlightConnectionProperty.SSL.camelName(), false));
81+
ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), false));
8282

8383
try (Connection connection = factory.newConnection(driver, constructor.newInstance(),
8484
"jdbc:arrow-flight://localhost:32010", properties)) {

java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ConnectionTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void testUnencryptedConnectionShouldOpenSuccessfullyWhenProvidedValidCred
9191
userTest);
9292
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
9393
passTest);
94-
properties.put("ssl", false);
94+
properties.put("useEncryption", false);
9595

9696
try (Connection connection = DriverManager.getConnection(
9797
"jdbc:arrow-flight://" + FLIGHT_SERVER_TEST_RULE.getHost() + ":" +
@@ -154,7 +154,7 @@ public void testUnencryptedConnectionProvidingInvalidPort()
154154
userTest);
155155
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
156156
passTest);
157-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(),
157+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(),
158158
false);
159159
final String invalidUrl = "jdbc:arrow-flight://" + FLIGHT_SERVER_TEST_RULE.getHost() +
160160
":" + 65537;
@@ -192,7 +192,7 @@ public void testUnencryptedConnectionShouldOpenSuccessfullyWithoutAuthentication
192192
properties.put(ArrowFlightConnectionProperty.HOST.camelName(), "localhost");
193193
properties.put(ArrowFlightConnectionProperty.PORT.camelName(),
194194
FLIGHT_SERVER_TEST_RULE.getPort());
195-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(),
195+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(),
196196
false);
197197
try (Connection connection = DriverManager
198198
.getConnection("jdbc:arrow-flight://localhost:32010", properties)) {
@@ -217,7 +217,7 @@ public void testUnencryptedConnectionShouldThrowExceptionWhenProvidedWithInvalid
217217
"invalidUser");
218218
properties.put(ArrowFlightConnectionProperty.PORT.camelName(),
219219
FLIGHT_SERVER_TEST_RULE.getPort());
220-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(),
220+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(),
221221
false);
222222
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
223223
"invalidPassword");
@@ -241,7 +241,7 @@ public void testTLSConnectionPropertyFalseCorrectCastUrlWithDriverManager() thro
241241

242242
Connection connection = DriverManager.getConnection(
243243
String.format(
244-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&ssl=false",
244+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&useEncryption=false",
245245
FLIGHT_SERVER_TEST_RULE.getPort(),
246246
userTest,
247247
passTest));
@@ -267,7 +267,7 @@ public void testTLSConnectionPropertyFalseCorrectCastUrlAndPropertiesUsingSetPro
267267
userTest);
268268
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(),
269269
passTest);
270-
properties.setProperty(ArrowFlightConnectionProperty.SSL.camelName(), "false");
270+
properties.setProperty(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), "false");
271271

272272
Connection connection = DriverManager.getConnection(
273273
String.format(
@@ -295,7 +295,7 @@ public void testTLSConnectionPropertyFalseCorrectCastUrlAndPropertiesUsingPutWit
295295
userTest);
296296
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
297297
passTest);
298-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), false);
298+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), false);
299299

300300
Connection connection = DriverManager.getConnection(
301301
String.format(
@@ -320,7 +320,7 @@ public void testTLSConnectionPropertyFalseIntegerCorrectCastUrlWithDriverManager
320320

321321
Connection connection = DriverManager.getConnection(
322322
String.format(
323-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&ssl=0",
323+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&useEncryption=0",
324324
FLIGHT_SERVER_TEST_RULE.getPort(),
325325
userTest,
326326
passTest));
@@ -346,7 +346,7 @@ public void testTLSConnectionPropertyFalseIntegerCorrectCastUrlAndPropertiesUsin
346346
userTest);
347347
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(),
348348
passTest);
349-
properties.setProperty(ArrowFlightConnectionProperty.SSL.camelName(), "0");
349+
properties.setProperty(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), "0");
350350

351351
Connection connection = DriverManager.getConnection(
352352
String.format(
@@ -375,7 +375,7 @@ public void testTLSConnectionPropertyFalseIntegerCorrectCastUrlAndPropertiesUsin
375375
userTest);
376376
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
377377
passTest);
378-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), 0);
378+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), 0);
379379

380380
Connection connection = DriverManager.getConnection(
381381
String.format(
@@ -400,7 +400,7 @@ public void testThreadPoolSizeConnectionPropertyCorrectCastUrlWithDriverManager(
400400

401401
Connection connection = DriverManager.getConnection(
402402
String.format(
403-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&threadPoolSize=1&ssl=%s",
403+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&threadPoolSize=1&useEncryption=%s",
404404
FLIGHT_SERVER_TEST_RULE.getPort(),
405405
userTest,
406406
passTest,
@@ -428,7 +428,7 @@ public void testThreadPoolSizeConnectionPropertyCorrectCastUrlAndPropertiesUsing
428428
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(),
429429
passTest);
430430
properties.setProperty(ArrowFlightConnectionProperty.THREAD_POOL_SIZE.camelName(), "1");
431-
properties.put("ssl", false);
431+
properties.put("useEncryption", false);
432432

433433
Connection connection = DriverManager.getConnection(
434434
String.format(
@@ -458,7 +458,7 @@ public void testThreadPoolSizeConnectionPropertyCorrectCastUrlAndPropertiesUsing
458458
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
459459
passTest);
460460
properties.put(ArrowFlightConnectionProperty.THREAD_POOL_SIZE.camelName(), 1);
461-
properties.put("ssl", false);
461+
properties.put("useEncryption", false);
462462

463463
Connection connection = DriverManager.getConnection(
464464
String.format(
@@ -483,7 +483,7 @@ public void testPasswordConnectionPropertyIntegerCorrectCastUrlWithDriverManager
483483

484484
Connection connection = DriverManager.getConnection(
485485
String.format(
486-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&ssl=%s",
486+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&useEncryption=%s",
487487
FLIGHT_SERVER_TEST_RULE.getPort(),
488488
userTest,
489489
passTest,
@@ -510,7 +510,7 @@ public void testPasswordConnectionPropertyIntegerCorrectCastUrlAndPropertiesUsin
510510
userTest);
511511
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(),
512512
passTest);
513-
properties.put("ssl", false);
513+
properties.put("useEncryption", false);
514514

515515
Connection connection = DriverManager.getConnection(
516516
String.format(
@@ -539,7 +539,7 @@ public void testPasswordConnectionPropertyIntegerCorrectCastUrlAndPropertiesUsin
539539
userTest);
540540
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
541541
passTest);
542-
properties.put("ssl", false);
542+
properties.put("useEncryption", false);
543543

544544
Connection connection = DriverManager.getConnection(
545545
String.format(

java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/ConnectionTlsTest.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class ConnectionTlsTest {
6363
.host("localhost")
6464
.randomPort()
6565
.authentication(authentication)
66-
.useTls(certKey.cert, certKey.key)
66+
.useEncryption(certKey.cert, certKey.key)
6767
.producer(PRODUCER)
6868
.build();
6969
}
@@ -102,7 +102,7 @@ public void testGetEncryptedClientAuthenticatedWithDisableCertVerification() thr
102102
.withPassword(credentials.getPassword())
103103
.withDisableCertificateVerification(true)
104104
.withBufferAllocator(allocator)
105-
.withTlsEncryption(true)
105+
.withEncryption(true)
106106
.build()) {
107107
assertNotNull(client);
108108
}
@@ -127,7 +127,7 @@ public void testGetEncryptedClientAuthenticated() throws Exception {
127127
.withTrustStorePath(trustStorePath)
128128
.withTrustStorePassword(trustStorePass)
129129
.withBufferAllocator(allocator)
130-
.withTlsEncryption(true)
130+
.withEncryption(true)
131131
.build()) {
132132
assertNotNull(client);
133133
}
@@ -149,7 +149,7 @@ public void testGetEncryptedClientWithNoCertificateOnKeyStore() throws Exception
149149
.withTrustStorePath(noCertificateKeyStorePath)
150150
.withTrustStorePassword(noCertificateKeyStorePassword)
151151
.withBufferAllocator(allocator)
152-
.withTlsEncryption(true)
152+
.withEncryption(true)
153153
.build()) {
154154
Assert.fail();
155155
}
@@ -168,7 +168,7 @@ public void testGetNonAuthenticatedEncryptedClientNoAuth() throws Exception {
168168
.withTrustStorePath(trustStorePath)
169169
.withTrustStorePassword(trustStorePass)
170170
.withBufferAllocator(allocator)
171-
.withTlsEncryption(true)
171+
.withEncryption(true)
172172
.build()) {
173173
assertNotNull(client);
174174
}
@@ -190,7 +190,7 @@ public void testGetEncryptedClientWithKeyStoreBadPasswordAndNoAuth() throws Exce
190190
.withTrustStorePath(trustStorePath)
191191
.withTrustStorePassword(keyStoreBadPassword)
192192
.withBufferAllocator(allocator)
193-
.withTlsEncryption(true)
193+
.withEncryption(true)
194194
.build()) {
195195
Assert.fail();
196196
}
@@ -242,7 +242,7 @@ public void testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPassword() thr
242242
userTest);
243243
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(),
244244
passTest);
245-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), true);
245+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), true);
246246
properties.put(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
247247
properties.put(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), "badpassword");
248248

@@ -264,7 +264,7 @@ public void testGetNonAuthenticatedEncryptedConnection() throws Exception {
264264

265265
properties.put(ArrowFlightConnectionProperty.HOST.camelName(), FLIGHT_SERVER_TEST_RULE.getHost());
266266
properties.put(ArrowFlightConnectionProperty.PORT.camelName(), FLIGHT_SERVER_TEST_RULE.getPort());
267-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), true);
267+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), true);
268268
properties.put(ArrowFlightConnectionProperty.USE_SYSTEM_TRUST_STORE.camelName(), false);
269269
properties.put(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
270270
properties.put(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), trustStorePass);
@@ -288,7 +288,8 @@ public void testTLSConnectionPropertyTrueCorrectCastUrlWithDriverManager() throw
288288

289289
final Connection connection = DriverManager.getConnection(
290290
String.format(
291-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&ssl=true&useSystemTrustStore=false&%s=%s&%s=%s",
291+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s" +
292+
"&useEncryption=true&useSystemTrustStore=false&%s=%s&%s=%s",
292293
FLIGHT_SERVER_TEST_RULE.getPort(),
293294
userTest,
294295
passTest,
@@ -318,7 +319,7 @@ public void testTLSConnectionPropertyTrueCorrectCastUrlAndPropertiesUsingSetProp
318319
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(), passTest);
319320
properties.setProperty(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
320321
properties.setProperty(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), trustStorePass);
321-
properties.setProperty(ArrowFlightConnectionProperty.SSL.camelName(), "true");
322+
properties.setProperty(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), "true");
322323
properties.setProperty(ArrowFlightConnectionProperty.USE_SYSTEM_TRUST_STORE.camelName(), "false");
323324

324325
final Connection connection = DriverManager.getConnection(
@@ -346,7 +347,7 @@ public void testTLSConnectionPropertyTrueCorrectCastUrlAndPropertiesUsingPutWith
346347

347348
properties.put(ArrowFlightConnectionProperty.USER.camelName(), userTest);
348349
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(), passTest);
349-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), true);
350+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), true);
350351
properties.put(ArrowFlightConnectionProperty.USE_SYSTEM_TRUST_STORE.camelName(), false);
351352
properties.put(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
352353
properties.put(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), trustStorePass);
@@ -374,7 +375,7 @@ public void testTLSConnectionPropertyTrueIntegerCorrectCastUrlWithDriverManager(
374375

375376
final Connection connection = DriverManager.getConnection(
376377
String.format(
377-
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&ssl=1&useSystemTrustStore=0&%s=%s&%s=%s",
378+
"jdbc:arrow-flight://localhost:%s?user=%s&password=%s&useEncryption=1&useSystemTrustStore=0&%s=%s&%s=%s",
378379
FLIGHT_SERVER_TEST_RULE.getPort(),
379380
userTest,
380381
passTest,
@@ -404,7 +405,7 @@ public void testTLSConnectionPropertyTrueIntegerCorrectCastUrlAndPropertiesUsing
404405
properties.setProperty(ArrowFlightConnectionProperty.PASSWORD.camelName(), passTest);
405406
properties.setProperty(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
406407
properties.setProperty(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), trustStorePass);
407-
properties.setProperty(ArrowFlightConnectionProperty.SSL.camelName(), "1");
408+
properties.setProperty(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), "1");
408409
properties.setProperty(ArrowFlightConnectionProperty.USE_SYSTEM_TRUST_STORE.camelName(), "0");
409410

410411
final Connection connection = DriverManager.getConnection(
@@ -430,7 +431,7 @@ public void testTLSConnectionPropertyTrueIntegerCorrectCastUrlAndPropertiesUsing
430431

431432
properties.put(ArrowFlightConnectionProperty.USER.camelName(), userTest);
432433
properties.put(ArrowFlightConnectionProperty.PASSWORD.camelName(), passTest);
433-
properties.put(ArrowFlightConnectionProperty.SSL.camelName(), 1);
434+
properties.put(ArrowFlightConnectionProperty.USE_ENCRYPTION.camelName(), 1);
434435
properties.put(ArrowFlightConnectionProperty.USE_SYSTEM_TRUST_STORE.camelName(), 0);
435436
properties.put(ArrowFlightConnectionProperty.TRUST_STORE.camelName(), trustStorePath);
436437
properties.put(ArrowFlightConnectionProperty.TRUST_STORE_PASSWORD.camelName(), trustStorePass);

0 commit comments

Comments
 (0)