Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build failing on Windows (#4484) #4504

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import java.nio.file.Paths;
import java.security.PublicKey;
import java.util.Map;

Expand Down Expand Up @@ -73,7 +74,7 @@ void localPublicKeyService_withPathConfig(LocalPublicKeyDefaultExtension extensi
var value = TestUtils.getResourceFileContentAsString("rsa_2048.pem");
var keys = Map.of(
"key1.id", "key1",
"key1.path", path.getPath());
"key1.path", Paths.get(path).toString());

when(keyParserRegistry.parsePublic(value)).thenReturn(Result.success(mock(PublicKey.class)));
when(context.getConfig(EDC_PUBLIC_KEYS_PREFIX)).thenReturn(ConfigFactory.fromMap(keys));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class ClasspathReader {
*/
public static URL[] classpathFor(String... modules) {
try {
if (modules.length == 0) {
return new URL[0];
}
// Run a Gradle custom task to determine the runtime classpath of the module to run
var printClasspath = Arrays.stream(modules).map(it -> it + ":printClasspath");
var commandStream = Stream.of(GRADLE_WRAPPER.getCanonicalPath(), "-q");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public VaultCertificateResolver(@NotNull Vault vault) {
}

try {
var encoded = certificateRepresentation.replace(HEADER, "").replaceAll(System.lineSeparator(), "").replace(FOOTER, "");
var encoded = certificateRepresentation.replace(HEADER, "").replaceAll("\\R", "").replace(FOOTER, "");
CertificateFactory fact = CertificateFactory.getInstance("X.509");
return (X509Certificate) fact.generateCertificate(new ByteArrayInputStream(Base64.getDecoder().decode(encoded.getBytes())));
} catch (GeneralSecurityException | IllegalArgumentException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void resolveCertificate() throws RuntimeException, IOException {
var pemReceived = convertCertificateToPem(certificate);

verify(vault, times(1)).resolveSecret(KEY);
assertThat(pemReceived).isEqualTo(pemExpected);
assertThat(pemReceived.split("\\R")).isEqualTo(pemExpected.split("\\R"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class X509CertificateDecoratorTest {
private static X509Certificate createCertificate() throws CertificateException, IOException {
var classloader = Thread.currentThread().getContextClassLoader();
var pem = new String(Objects.requireNonNull(classloader.getResourceAsStream(TEST_CERT_FILE)).readAllBytes());
var encoded = pem.replace(HEADER, "").replaceAll(System.lineSeparator(), "").replace(FOOTER, "");
var encoded = pem.replace(HEADER, "").replaceAll("\\R", "").replace(FOOTER, "");
CertificateFactory fact = CertificateFactory.getInstance("X.509");
return (X509Certificate) fact.generateCertificate(new ByteArrayInputStream(Base64.getDecoder().decode(encoded.getBytes())));
}
Expand Down
Loading