Skip to content

Commit 6074319

Browse files
author
a-brandt
committed
using config file for ssl
1 parent 37b229a commit 6074319

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public class SslExample {
7676
public void httpTest() throws ArangoException {
7777

7878
ArangoConfigure configuration = new ArangoConfigure();
79-
configuration.setArangoHost(new ArangoHost("localhost", 8529));
79+
// get host and port from arangodb.properties
80+
// configuration.setArangoHost(new ArangoHost("localhost", 8529));
8081
configuration.init();
8182

8283
ArangoDriver arangoDriver = new ArangoDriver(configuration);
@@ -110,9 +111,7 @@ public void sslWithSelfSignedCertificateTest() throws ArangoException, KeyManage
110111
SSLContext sslContext = SSLContexts.custom()
111112
.loadTrustMaterial(Paths.get(resource.toURI()).toFile(), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
112113

113-
ArangoConfigure configuration = new ArangoConfigure();
114-
configuration.setArangoHost(new ArangoHost("localhost", 8530));
115-
configuration.setUseSsl(true);
114+
ArangoConfigure configuration = new ArangoConfigure("/ssl-arangodb.properties");
116115
configuration.setSslContext(sslContext);
117116
configuration.init();
118117

@@ -124,9 +123,7 @@ public void sslWithSelfSignedCertificateTest() throws ArangoException, KeyManage
124123

125124
@Test
126125
public void sslHandshakeExceptionTest() {
127-
ArangoConfigure configuration = new ArangoConfigure();
128-
configuration.setArangoHost(new ArangoHost("localhost", 8530));
129-
configuration.setUseSsl(true);
126+
ArangoConfigure configuration = new ArangoConfigure("/ssl-arangodb.properties");
130127
configuration.init();
131128

132129
ArangoDriver arangoDriver = new ArangoDriver(configuration);
@@ -152,10 +149,9 @@ public void sslPeerUnverifiedExceptionTest() throws ArangoException, KeyManageme
152149
SSLContext sslContext = SSLContexts.custom()
153150
.loadTrustMaterial(Paths.get(resource.toURI()).toFile(), SSL_TRUSTSTORE_PASSWORD.toCharArray()).build();
154151

155-
ArangoConfigure configuration = new ArangoConfigure();
152+
ArangoConfigure configuration = new ArangoConfigure("/ssl-arangodb.properties");
156153
// 127.0.0.1 is the wrong name
157-
configuration.setArangoHost(new ArangoHost("127.0.0.1", 8530));
158-
configuration.setUseSsl(true);
154+
configuration.getArangoHost().setHost("127.0.0.1");
159155
configuration.setSslContext(sslContext);
160156
configuration.init();
161157

0 commit comments

Comments
 (0)