|
18 | 18 | */
|
19 | 19 | package org.neo4j.driver.v1.integration;
|
20 | 20 |
|
| 21 | +import org.junit.jupiter.api.AfterAll; |
| 22 | +import org.junit.jupiter.api.BeforeAll; |
21 | 23 | import org.junit.jupiter.api.Test;
|
22 | 24 | import org.junit.jupiter.api.extension.RegisterExtension;
|
23 | 25 |
|
24 | 26 | import java.io.File;
|
| 27 | +import java.io.IOException; |
| 28 | +import java.nio.file.Files; |
| 29 | +import java.nio.file.Path; |
| 30 | +import java.nio.file.StandardCopyOption; |
25 | 31 | import java.util.function.Supplier;
|
26 | 32 |
|
27 | 33 | import org.neo4j.driver.v1.Config;
|
|
42 | 48 | import static org.neo4j.driver.v1.util.CertificateToolUtil.createNewCertificateAndKeySignedBy;
|
43 | 49 |
|
44 | 50 | @ParallelizableIT
|
45 |
| -public class TrustCustomCertificateIT |
| 51 | +class TrustCustomCertificateIT |
46 | 52 | {
|
47 | 53 | @RegisterExtension
|
48 | 54 | static final DatabaseExtension neo4j = new DatabaseExtension();
|
49 | 55 |
|
| 56 | + private static Path originalKeyFile; |
| 57 | + private static Path originalCertFile; |
| 58 | + |
| 59 | + @BeforeAll |
| 60 | + static void beforeAll() throws IOException |
| 61 | + { |
| 62 | + originalKeyFile = Files.createTempFile( "key-file-", "" ); |
| 63 | + originalCertFile = Files.createTempFile( "cert-file-", "" ); |
| 64 | + |
| 65 | + Files.copy( neo4j.tlsKeyFile().toPath(), originalKeyFile , StandardCopyOption.REPLACE_EXISTING); |
| 66 | + Files.copy( neo4j.tlsCertFile().toPath(), originalCertFile, StandardCopyOption.REPLACE_EXISTING ); |
| 67 | + } |
| 68 | + |
| 69 | + @AfterAll |
| 70 | + static void afterAll() throws Exception |
| 71 | + { |
| 72 | + neo4j.updateEncryptionKeyAndCert( originalKeyFile.toFile(), originalCertFile.toFile() ); |
| 73 | + Files.deleteIfExists( originalKeyFile ); |
| 74 | + Files.deleteIfExists( originalCertFile ); |
| 75 | + } |
| 76 | + |
50 | 77 | @Test
|
51 | 78 | void shouldAcceptServerWithCertificateSignedByDriverCertificate() throws Throwable
|
52 | 79 | {
|
|
0 commit comments