3030import java .io .InputStreamReader ;
3131import java .io .OutputStream ;
3232import java .net .InetSocketAddress ;
33+ import java .net .URL ;
3334import java .nio .charset .StandardCharsets ;
3435import java .security .KeyStore ;
3536import java .sql .Connection ;
@@ -48,7 +49,7 @@ public class ITLocalSslValidationTest {
4849 private static final String HOST = "localhost" ;
4950 private static final String PASSWORD = "changeit" ;
5051 private static final String KEYSTORE_RESOURCE = "/localhost-keystore.jks" ;
51- private static final String TRUSTSTORE_PATH = "src/test/resources /localhost-truststore.jks" ;
52+ private static final String TRUSTSTORE_RESOURCE = "/localhost-truststore.jks" ;
5253 private static final String SUCCESS_MARKER = "SUBPROCESS_RESULT: SUCCESS" ;
5354 private static final String FAILURE_MARKER_PREFIX = "SUBPROCESS_RESULT: FAILURE - " ;
5455 private static final String PKIX_ERROR_MSG = "PKIX path building failed" ;
@@ -219,7 +220,12 @@ public void testDefaultSslFailsForSelfSigned() throws Exception {
219220
220221 @ Test
221222 public void testCustomTrustStoreSucceeds () throws Exception {
222- String trustStorePath = new File (TRUSTSTORE_PATH ).getAbsolutePath ();
223+ URL trustStoreUrl = getClass ().getResource (TRUSTSTORE_RESOURCE );
224+ if (trustStoreUrl == null ) {
225+ throw new IllegalStateException (
226+ "Truststore resource " + TRUSTSTORE_RESOURCE + " not found on classpath!" );
227+ }
228+ String trustStorePath = new File (trustStoreUrl .toURI ()).getAbsolutePath ();
223229 ProcessResult result = runSubprocess (trustStorePath , PASSWORD );
224230
225231 assertEquals (0 , result .exitCode , "Subprocess failed. Output:\n " + result .stdout );
0 commit comments