test: Fix test db setup and add lombok annotations (#6)

* Fix test db setup and add lombok annotations

* Formatting
This commit is contained in:
Torge Hamann 2024-11-17 21:30:50 +01:00 committed by GitHub
parent c3da0eff5c
commit a2aea580f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 41 deletions

View file

@ -1,7 +1,5 @@
package de.mlessmann.certassist;
import static org.slf4j.LoggerFactory.getLogger;
import de.mlessmann.certassist.except.UnresolvableCLIDependency;
import java.io.File;
import java.nio.file.Files;
@ -9,22 +7,21 @@ import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class ExecutableResolver {
private static final Logger LOGGER = getLogger(ExecutableResolver.class);
@Value("${openssl.path:#{null}}")
private String opensslPath;
public String getOpenSSLPath() throws UnresolvableCLIDependency {
if (opensslPath == null) {
LOGGER.atDebug().log("No openssl path configured, falling back to resolving by shell.");
log.atDebug().log("No openssl path configured, falling back to resolving by shell.");
var optSSLPath = searchCommandFromPath("openssl");
opensslPath = optSSLPath.orElseThrow(() -> new UnresolvableCLIDependency("openssl", "openssl.path"));
}
@ -51,7 +48,7 @@ public class ExecutableResolver {
}
}
LOGGER.error(
log.error(
"Could not find executable '{}' in PATH. Make sure that it exists on the of the directory and is executable.",
executableName
);