2323import static org .junit .Assert .assertThat ;
2424import static org .junit .Assert .fail ;
2525
26+ import java .io .File ;
2627import java .io .IOException ;
2728import java .net .SocketTimeoutException ;
2829import java .net .URISyntaxException ;
2930import java .net .URL ;
30- import java .nio .file .Paths ;
3131import java .security .KeyManagementException ;
3232import java .security .KeyStoreException ;
3333import 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 }
0 commit comments