Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Nov 7, 2023
1 parent 57b8354 commit 6ea9de4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
23 changes: 15 additions & 8 deletions src/test/java/com/exasol/clusterlogs/MappedClusterLogsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import java.io.File;
import java.io.IOException;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.shaded.com.google.common.io.Files;

import com.exasol.containers.ExasolContainer;

Expand All @@ -21,13 +20,21 @@ class MappedClusterLogsIT {
private static final Path TEMP_DIR = createTempDir();

private static Path createTempDir() {
final File tempDir = Files.createTempDir();
tempDir.deleteOnExit();
return tempDir.toPath();
final Path tempDir = createTempPath();
tempDir.toFile().deleteOnExit();
return tempDir;
}

private static Path createTempPath() {
try {
return Files.createTempDirectory("MappedClusterLogsIT");
} catch (final IOException exception) {
throw new UncheckedIOException(exception);
}
}

@Container
private static final ExasolContainer<? extends ExasolContainer<?>> CONTAINER = new ExasolContainer<>() //
private static final ExasolContainer<? extends ExasolContainer<?>> CONTAINER = new ExasolContainer<>("8.23.0") //
.withClusterLogsPath(TEMP_DIR) //
.withRequiredServices();

Expand All @@ -37,4 +44,4 @@ void testMapClusterLogs() throws InterruptedException, IOException {
final File syslogFile = TEMP_DIR.resolve("syslog").toFile();
assertThat("File " + syslogFile + " exists", syslogFile.exists(), equalTo(true));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void testGetCertificate() {
final Optional<X509Certificate> optionalCertificate = CONTAINER.getTlsCertificate();
final var certificate = optionalCertificate.get();
assertAll(() -> assertThat(certificate, notNullValue()),
() -> assertThat(certificate.getIssuerDN().getName(), equalTo("CN=exacluster.local")),
() -> assertThat(certificate.getSubjectDN().getName(),
() -> assertThat(certificate.getIssuerX500Principal().getName(), equalTo("CN=exacluster.local")),
() -> assertThat(certificate.getSubjectX500Principal().getName(),
either(equalTo("CN=*.exacluster.local")).or(equalTo("CN=srv.exacluster.local"))),
() -> assertThat(certificate.getNotBefore(), lessThan(now)),
() -> assertThat(certificate.getNotAfter(), greaterThan(now)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void testGetCertificateSucceeds() throws ExasolContainerException {
final Optional<X509Certificate> certificate = this.certificateProvider.getCertificate();
assertThat(certificate.isPresent(), is(true));
assertThat(certificate.get(), notNullValue());
assertThat(certificate.get().getIssuerDN().getName(), equalTo("CN=exacluster.local"));
assertThat(certificate.get().getIssuerX500Principal().getName(), equalTo("CN=exacluster.local"));
}

private void simulateTlsCert(final String certContent) throws ExasolContainerException {
Expand Down

0 comments on commit 6ea9de4

Please sign in to comment.