Skip to content

Commit abd4179

Browse files
author
Mark
committed
Merge remote-tracking branch 'origin/master' into 3.0
2 parents 8e8b977 + 7d5f47a commit abd4179

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# arangodb-java-driver
55

6-
[![Build Status](https://travis-ci.org/arangodb/arangodb-java-driver.svg?branch=3.0)](https://travis-ci.org/arangodb/arangodb-java-driver)
6+
[![Build Status](https://travis-ci.org/arangodb/arangodb-java-driver.svg?branch=master)](https://travis-ci.org/arangodb/arangodb-java-driver)
77

88
This library is a Java driver for ArangoDB.
99

src/test/java/com/arangodb/ArangoConfigureTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import static org.junit.Assert.assertThat;
2424
import static org.junit.Assert.fail;
2525

26+
import java.io.File;
2627
import java.io.IOException;
2728
import java.net.SocketTimeoutException;
2829
import java.net.URISyntaxException;
2930
import java.net.URL;
30-
import java.nio.file.Paths;
3131
import java.security.KeyManagementException;
3232
import java.security.KeyStoreException;
3333
import java.security.NoSuchAlgorithmException;
@@ -70,7 +70,7 @@ public void load_from_property_file() {
7070
// validate file in classpath.
7171
assertThat(getClass().getResource("/arangodb.properties"), is(notNullValue()));
7272

73-
ArangoConfigure configure = new ArangoConfigure();
73+
final ArangoConfigure configure = new ArangoConfigure();
7474
assertThat(configure.getArangoHost().getPort(), is(8529));
7575
assertThat(configure.getArangoHost().getHost(), is(notNullValue()));
7676
assertThat(configure.getDefaultDatabase(), is(nullValue()));
@@ -80,13 +80,13 @@ public void load_from_property_file() {
8080
@Test
8181
public void load_from_proerty_file2() {
8282

83-
ArangoConfigure configure = new ArangoConfigure();
83+
final ArangoConfigure configure = new ArangoConfigure();
8484
configure.loadProperties("/arangodb-test.properties");
8585

8686
assertThat(configure.getRetryCount(), is(10));
8787
assertThat(configure.getDefaultDatabase(), is("mydb2"));
8888

89-
ArangoHost arangoHost = configure.getArangoHost();
89+
final ArangoHost arangoHost = configure.getArangoHost();
9090
assertThat(arangoHost.getPort(), is(9999));
9191
assertThat(arangoHost.getHost(), is(notNullValue()));
9292

@@ -96,17 +96,17 @@ public void load_from_proerty_file2() {
9696
@Test
9797
public void connect_timeout() throws ArangoException {
9898

99-
ArangoConfigure configure = new ArangoConfigure();
99+
final ArangoConfigure configure = new ArangoConfigure();
100100
configure.getArangoHost().setHost("1.0.0.200");
101101
configure.setConnectionTimeout(1); // 1ms
102102
configure.init();
103103

104-
ArangoDriver driver = new ArangoDriver(configure);
104+
final ArangoDriver driver = new ArangoDriver(configure);
105105

106106
try {
107107
driver.getCollections();
108108
fail("did no timeout");
109-
} catch (ArangoException e) {
109+
} catch (final ArangoException e) {
110110
assertThat(e.getCause(), instanceOf(ConnectTimeoutException.class));
111111
}
112112

@@ -118,17 +118,17 @@ public void connect_timeout() throws ArangoException {
118118
@Ignore(value = "this fails some times")
119119
public void so_connect_timeout() throws ArangoException {
120120

121-
ArangoConfigure configure = new ArangoConfigure();
121+
final ArangoConfigure configure = new ArangoConfigure();
122122
configure.setConnectionTimeout(5000);
123123
configure.setTimeout(1); // 1ms
124124
configure.init();
125125

126-
ArangoDriver driver = new ArangoDriver(configure);
126+
final ArangoDriver driver = new ArangoDriver(configure);
127127

128128
try {
129129
driver.getCollections();
130130
fail("did no timeout");
131-
} catch (ArangoException e) {
131+
} catch (final ArangoException e) {
132132
assertThat(e.getCause(), instanceOf(SocketTimeoutException.class));
133133
}
134134

@@ -139,18 +139,18 @@ public void so_connect_timeout() throws ArangoException {
139139
@Test
140140
public void reconnectFallbackArangoHost() throws ArangoException {
141141

142-
ArangoConfigure configure = new ArangoConfigure();
142+
final ArangoConfigure configure = new ArangoConfigure();
143143

144144
// copy default arango host to fallback
145-
ArangoHost arangoHost = configure.getArangoHost();
146-
ArangoHost ah = new ArangoHost(arangoHost.getHost(), arangoHost.getPort());
145+
final ArangoHost arangoHost = configure.getArangoHost();
146+
final ArangoHost ah = new ArangoHost(arangoHost.getHost(), arangoHost.getPort());
147147
configure.addFallbackArangoHost(ah);
148148

149149
// change default port to wrong port
150150
arangoHost.setPort(1025);
151151
configure.init();
152152

153-
ArangoDriver driver = new ArangoDriver(configure);
153+
final ArangoDriver driver = new ArangoDriver(configure);
154154

155155
driver.getCollections();
156156

@@ -163,17 +163,17 @@ public void sslWithSelfSignedCertificateTest() throws ArangoException, KeyManage
163163
NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, URISyntaxException {
164164

165165
// create a sslContext for the self signed certificate
166-
URL resource = this.getClass().getResource(SSL_TRUSTSTORE);
167-
SSLContext sslContext = SSLContexts.custom()
168-
.loadTrustMaterial(Paths.get(resource.toURI()).toFile(), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
166+
final URL resource = this.getClass().getResource(SSL_TRUSTSTORE);
167+
final SSLContext sslContext = SSLContexts.custom()
168+
.loadTrustMaterial(new File(resource.toURI()), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
169169

170-
ArangoConfigure configuration = new ArangoConfigure("/ssl-arangodb.properties");
170+
final ArangoConfigure configuration = new ArangoConfigure("/ssl-arangodb.properties");
171171
configuration.setSslContext(sslContext);
172172
configuration.init();
173173

174-
ArangoDriver arangoDriver = new ArangoDriver(configuration);
174+
final ArangoDriver arangoDriver = new ArangoDriver(configuration);
175175

176-
ArangoVersion version = arangoDriver.getVersion();
176+
final ArangoVersion version = arangoDriver.getVersion();
177177

178178
Assert.assertNotNull(version);
179179
}

src/test/java/com/arangodb/example/ssl/SslExample.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package com.arangodb.example.ssl;
1818

19+
import java.io.File;
1920
import java.io.IOException;
2021
import java.net.URISyntaxException;
2122
import java.net.URL;
22-
import java.nio.file.Paths;
2323
import java.security.KeyManagementException;
2424
import java.security.KeyStoreException;
2525
import java.security.NoSuchAlgorithmException;
@@ -123,8 +123,7 @@ public void sslWithSelfSignedCertificateTest() throws ArangoException, KeyManage
123123
// create a sslContext for the self signed certificate
124124
final URL resource = this.getClass().getResource(SSL_TRUSTSTORE);
125125
final SSLContext sslContext = SSLContexts.custom()
126-
.loadTrustMaterial(Paths.get(resource.toURI()).toFile(), SSL_TRUSTSTORE_PASSWORD.toCharArray())
127-
.build();
126+
.loadTrustMaterial(new File(resource.toURI()), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
128127

129128
configuration = new ArangoConfigure("/ssl-arangodb.properties");
130129
configuration.setSslContext(sslContext);
@@ -176,8 +175,7 @@ public void sslPeerUnverifiedExceptionTest() throws ArangoException, KeyManageme
176175
// create a sslContext for the self signed certificate
177176
final URL resource = this.getClass().getResource(SSL_TRUSTSTORE);
178177
final SSLContext sslContext = SSLContexts.custom()
179-
.loadTrustMaterial(Paths.get(resource.toURI()).toFile(), SSL_TRUSTSTORE_PASSWORD.toCharArray())
180-
.build();
178+
.loadTrustMaterial(new File(resource.toURI()), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
181179

182180
configuration = new ArangoConfigure("/ssl-arangodb.properties");
183181
// 127.0.0.1 is the wrong name

0 commit comments

Comments
 (0)