Search in sources :

Example 1 with TempFile

use of io.airlift.testing.TempFile in project airlift by airlift.

the class TestHttpServerProvider method testKeystoreReloading.

@Test
public void testKeystoreReloading() throws Exception {
    try (TempFile tempFile = new TempFile()) {
        appendCertificate(tempFile.file(), "certificate-1");
        config.setHttpsEnabled(true).setHttpEnabled(false);
        httpsConfig.setSslContextRefreshTime(new Duration(5, SECONDS)).setKeystorePath(tempFile.file().getAbsolutePath()).setKeystorePassword("airlift");
        createAndStartServer();
        assertEventually(() -> assertEquals(server.getCertificates().size(), 1));
        appendCertificate(tempFile.file(), "certificate-2");
        assertEventually(() -> assertEquals(server.getCertificates().size(), 2));
    }
}
Also used : TempFile(io.airlift.testing.TempFile) Duration(io.airlift.units.Duration) Test(org.testng.annotations.Test)

Aggregations

TempFile (io.airlift.testing.TempFile)1 Duration (io.airlift.units.Duration)1 Test (org.testng.annotations.Test)1