@@ -63,12 +63,12 @@ void builderTest() throws Exception {
6363
6464 // Specify all options.
6565 HTTPVaultConnectorBuilder builder = HTTPVaultConnector .builder ()
66- .withHost ("vault2.example.com" )
67- .withoutTLS ()
68- .withPort (1234 )
69- .withPrefix ("/foo/" )
70- .withTimeout (5678 )
71- .withNumberOfRetries (9 );
66+ .withHost ("vault2.example.com" )
67+ .withoutTLS ()
68+ .withPort (1234 )
69+ .withPrefix ("/foo/" )
70+ .withTimeout (5678 )
71+ .withNumberOfRetries (9 );
7272 connector = builder .build ();
7373
7474 assertEquals ("http://vault2.example.com:1234/foo/" , getRequestHelperPrivate (connector , "baseURL" ), "URL not set correctly" );
@@ -79,13 +79,13 @@ void builderTest() throws Exception {
7979
8080 // Initialization from URL.
8181 assertThrows (
82- URISyntaxException .class ,
83- () -> HTTPVaultConnector .builder ().withBaseURL ("foo:/\\ 1nv4l1d_UrL" ),
84- "Initialization from invalid URL should fail"
82+ URISyntaxException .class ,
83+ () -> HTTPVaultConnector .builder ().withBaseURL ("foo:/\\ 1nv4l1d_UrL" ),
84+ "Initialization from invalid URL should fail"
8585 );
8686 connector = assertDoesNotThrow (
87- () -> HTTPVaultConnector .builder ().withBaseURL ("https://vault3.example.com:5678/bar/" ).build (),
88- "Initialization from valid URL should not fail"
87+ () -> HTTPVaultConnector .builder ().withBaseURL ("https://vault3.example.com:5678/bar/" ).build (),
88+ "Initialization from valid URL should not fail"
8989 );
9090 assertEquals ("https://vault3.example.com:5678/bar/" , getRequestHelperPrivate (connector , "baseURL" ), "URL not set correctly" );
9191
@@ -106,8 +106,8 @@ void testFromEnv() throws Exception {
106106 // Provide address only should be enough.
107107 withVaultEnv (VAULT_ADDR , null , null , null ).execute (() -> {
108108 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
109- () -> HTTPVaultConnector .builder ().fromEnv (),
110- "Factory creation from minimal environment failed"
109+ () -> HTTPVaultConnector .builder ().fromEnv (),
110+ "Factory creation from minimal environment failed"
111111 );
112112 HTTPVaultConnector connector = builder .build ();
113113
@@ -119,16 +119,16 @@ void testFromEnv() throws Exception {
119119 });
120120 withVaultEnv (VAULT_ADDR_2 , null , null , null ).execute (() -> {
121121 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
122- () -> HTTPVaultConnector .builder ().fromEnv (),
123- "Factory creation from minimal environment failed"
122+ () -> HTTPVaultConnector .builder ().fromEnv (),
123+ "Factory creation from minimal environment failed"
124124 );
125125 assertEquals (VAULT_ADDR_2 + "/v1/" , getRequestHelperPrivate (builder .build (), "baseURL" ), "URL without port not set correctly" );
126126 return null ;
127127 });
128128 withVaultEnv (VAULT_ADDR_3 , null , null , null ).execute (() -> {
129129 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
130- () -> HTTPVaultConnector .builder ().fromEnv (),
131- "Factory creation from minimal environment failed"
130+ () -> HTTPVaultConnector .builder ().fromEnv (),
131+ "Factory creation from minimal environment failed"
132132 );
133133 assertEquals (VAULT_ADDR_3 , getRequestHelperPrivate (builder .build (), "baseURL" ), "URL with custom path not set correctly" );
134134 return null ;
@@ -137,8 +137,8 @@ void testFromEnv() throws Exception {
137137 // Provide address and number of retries.
138138 withVaultEnv (VAULT_ADDR , null , VAULT_MAX_RETRIES .toString (), null ).execute (() -> {
139139 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
140- () -> HTTPVaultConnector .builder ().fromEnv (),
141- "Factory creation from environment failed"
140+ () -> HTTPVaultConnector .builder ().fromEnv (),
141+ "Factory creation from environment failed"
142142 );
143143 HTTPVaultConnector connector = builder .build ();
144144
@@ -152,8 +152,8 @@ void testFromEnv() throws Exception {
152152 // Automatic authentication.
153153 withVaultEnv (VAULT_ADDR , null , VAULT_MAX_RETRIES .toString (), VAULT_TOKEN ).execute (() -> {
154154 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
155- () -> HTTPVaultConnector .builder ().fromEnv (),
156- "Factory creation from minimal environment failed"
155+ () -> HTTPVaultConnector .builder ().fromEnv (),
156+ "Factory creation from minimal environment failed"
157157 );
158158 assertEquals (VAULT_TOKEN , getPrivate (builder , "token" ), "Token not set correctly" );
159159
@@ -163,9 +163,9 @@ void testFromEnv() throws Exception {
163163 // Invalid URL.
164164 withVaultEnv ("This is not a valid URL!" , null , VAULT_MAX_RETRIES .toString (), VAULT_TOKEN ).execute (() -> {
165165 assertThrows (
166- ConnectionException .class ,
167- () -> HTTPVaultConnector .builder ().fromEnv (),
168- "Invalid URL from environment should raise an exception"
166+ ConnectionException .class ,
167+ () -> HTTPVaultConnector .builder ().fromEnv (),
168+ "Invalid URL from environment should raise an exception"
169169 );
170170
171171 return null ;
@@ -182,8 +182,8 @@ void testCertificateFromEnv() throws Exception {
182182 AtomicReference <Object > certFromPem = new AtomicReference <>();
183183 withVaultEnv (VAULT_ADDR , pem , null , null ).execute (() -> {
184184 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
185- () -> HTTPVaultConnector .builder ().fromEnv (),
186- "Builder with PEM certificate from environment failed"
185+ () -> HTTPVaultConnector .builder ().fromEnv (),
186+ "Builder with PEM certificate from environment failed"
187187 );
188188 HTTPVaultConnector connector = builder .build ();
189189
@@ -198,8 +198,8 @@ void testCertificateFromEnv() throws Exception {
198198 AtomicReference <Object > certFromFile = new AtomicReference <>();
199199 withVaultEnv (VAULT_ADDR , file , null , null ).execute (() -> {
200200 HTTPVaultConnectorBuilder builder = assertDoesNotThrow (
201- () -> HTTPVaultConnector .builder ().fromEnv (),
202- "Builder with certificate path from environment failed"
201+ () -> HTTPVaultConnector .builder ().fromEnv (),
202+ "Builder with certificate path from environment failed"
203203 );
204204 HTTPVaultConnector connector = builder .build ();
205205
@@ -215,9 +215,9 @@ void testCertificateFromEnv() throws Exception {
215215 String doesNotExist = tempDir .toString () + "/doesnotexist" ;
216216 withVaultEnv (VAULT_ADDR , doesNotExist , VAULT_MAX_RETRIES .toString (), null ).execute (() -> {
217217 TlsException e = assertThrows (
218- TlsException .class ,
219- () -> HTTPVaultConnector .builder ().fromEnv (),
220- "Creation with unknown cert path failed"
218+ TlsException .class ,
219+ () -> HTTPVaultConnector .builder ().fromEnv (),
220+ "Creation with unknown cert path failed"
221221 );
222222 assertEquals (doesNotExist , assertInstanceOf (NoSuchFileException .class , e .getCause ()).getFile ());
223223
@@ -227,9 +227,9 @@ void testCertificateFromEnv() throws Exception {
227227
228228 private SystemLambda .WithEnvironmentVariables withVaultEnv (String vaultAddr , String vaultCacert , String vaultMaxRetries , String vaultToken ) {
229229 return withEnvironmentVariable ("VAULT_ADDR" , vaultAddr )
230- .and ("VAULT_CACERT" , vaultCacert )
231- .and ("VAULT_MAX_RETRIES" , vaultMaxRetries )
232- .and ("VAULT_TOKEN" , vaultToken );
230+ .and ("VAULT_CACERT" , vaultCacert )
231+ .and ("VAULT_MAX_RETRIES" , vaultMaxRetries )
232+ .and ("VAULT_TOKEN" , vaultToken );
233233 }
234234
235235 private Object getRequestHelperPrivate (HTTPVaultConnector connector , String fieldName ) throws NoSuchFieldException , IllegalAccessException {
0 commit comments