diff --git a/core/common/connector-core/src/test/java/org/eclipse/edc/connector/core/LocalPublicKeyDefaultExtensionTest.java b/core/common/connector-core/src/test/java/org/eclipse/edc/connector/core/LocalPublicKeyDefaultExtensionTest.java index 2fa61df87..63e0198c8 100644 --- a/core/common/connector-core/src/test/java/org/eclipse/edc/connector/core/LocalPublicKeyDefaultExtensionTest.java +++ b/core/common/connector-core/src/test/java/org/eclipse/edc/connector/core/LocalPublicKeyDefaultExtensionTest.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.BeforeEach; 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; @@ -73,7 +74,7 @@ class LocalPublicKeyDefaultExtensionTest { 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)); diff --git a/core/common/junit/src/main/java/org/eclipse/edc/junit/extensions/ClasspathReader.java b/core/common/junit/src/main/java/org/eclipse/edc/junit/extensions/ClasspathReader.java index 97e6b72fb..e3e6638fc 100644 --- a/core/common/junit/src/main/java/org/eclipse/edc/junit/extensions/ClasspathReader.java +++ b/core/common/junit/src/main/java/org/eclipse/edc/junit/extensions/ClasspathReader.java @@ -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"); diff --git a/core/common/lib/keys-lib/src/main/java/org/eclipse/edc/keys/VaultCertificateResolver.java b/core/common/lib/keys-lib/src/main/java/org/eclipse/edc/keys/VaultCertificateResolver.java index 3615fc1ec..ca311c06b 100644 --- a/core/common/lib/keys-lib/src/main/java/org/eclipse/edc/keys/VaultCertificateResolver.java +++ b/core/common/lib/keys-lib/src/main/java/org/eclipse/edc/keys/VaultCertificateResolver.java @@ -47,7 +47,7 @@ public class VaultCertificateResolver implements CertificateResolver { } 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) { diff --git a/core/common/lib/keys-lib/src/test/java/org/eclipse/edc/keys/VaultCertificateResolverTest.java b/core/common/lib/keys-lib/src/test/java/org/eclipse/edc/keys/VaultCertificateResolverTest.java index 58c077444..55ad474e3 100644 --- a/core/common/lib/keys-lib/src/test/java/org/eclipse/edc/keys/VaultCertificateResolverTest.java +++ b/core/common/lib/keys-lib/src/test/java/org/eclipse/edc/keys/VaultCertificateResolverTest.java @@ -17,6 +17,7 @@ package org.eclipse.edc.keys; import org.eclipse.edc.spi.EdcException; import org.eclipse.edc.spi.security.Vault; import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -58,7 +59,7 @@ class VaultCertificateResolverTest { var pemReceived = convertCertificateToPem(certificate); verify(vault, times(1)).resolveSecret(KEY); - assertThat(pemReceived).isEqualTo(pemExpected); + Assertions.assertArrayEquals(pemExpected.split("\\R"), pemReceived.split("\\R")); } @Test diff --git a/extensions/common/iam/oauth2/oauth2-core/src/test/java/org/eclipse/edc/iam/oauth2/jwt/X509CertificateDecoratorTest.java b/extensions/common/iam/oauth2/oauth2-core/src/test/java/org/eclipse/edc/iam/oauth2/jwt/X509CertificateDecoratorTest.java index ccb3ae7fe..7fcba868f 100644 --- a/extensions/common/iam/oauth2/oauth2-core/src/test/java/org/eclipse/edc/iam/oauth2/jwt/X509CertificateDecoratorTest.java +++ b/extensions/common/iam/oauth2/oauth2-core/src/test/java/org/eclipse/edc/iam/oauth2/jwt/X509CertificateDecoratorTest.java @@ -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()))); }