diff --git a/CHANGELOG.md b/CHANGELOG.md index c0500cb..3028216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,9 @@ SPDX-License-Identifier: Apache-2.0 # Changelog -## 10.1.1 +## 10.1.1-SNAPSHOT - Prepare jar files for use in native images, e.g. using GraalVM by generating and including configuration files for reflection, resources and dynamic proxies. -- gradle: Make use of jvmToolchain functionality -- gradle: Improve reproducibility -- gradle: Bump animalsniffer to `2.0.0` ## 10.1.0 - `sop-java`: diff --git a/build.gradle b/build.gradle index 1bff704..c73b60c 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { } plugins { - id 'ru.vyarus.animalsniffer' version '2.0.0' + id 'ru.vyarus.animalsniffer' version '1.5.3' id 'org.jetbrains.kotlin.jvm' version "1.9.21" id 'com.diffplug.spotless' version '6.22.0' apply false } diff --git a/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOption.java b/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOption.java deleted file mode 100644 index cbd0746..0000000 --- a/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOption.java +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop.testsuite; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -public @interface AbortOnUnsupportedOption { - -} diff --git a/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOptionExtension.java b/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOptionExtension.java deleted file mode 100644 index 0bf366d..0000000 --- a/sop-java-testfixtures/src/main/java/sop/testsuite/AbortOnUnsupportedOptionExtension.java +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop.testsuite; - -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.TestExecutionExceptionHandler; -import sop.exception.SOPGPException; - -import java.lang.annotation.Annotation; - -import static org.junit.jupiter.api.Assumptions.assumeTrue; - -public class AbortOnUnsupportedOptionExtension implements TestExecutionExceptionHandler { - - @Override - public void handleTestExecutionException(ExtensionContext extensionContext, Throwable throwable) throws Throwable { - Class testClass = extensionContext.getRequiredTestClass(); - Annotation annotation = testClass.getAnnotation(AbortOnUnsupportedOption.class); - if (annotation != null && throwable instanceof SOPGPException.UnsupportedOption) { - assumeTrue(false, "Test aborted due to: " + throwable.getMessage()); - } - throw throwable; - } -} diff --git a/sop-java-testfixtures/src/main/java/sop/testsuite/operation/MergeCertsTest.java b/sop-java-testfixtures/src/main/java/sop/testsuite/operation/MergeCertsTest.java deleted file mode 100644 index 3d40a99..0000000 --- a/sop-java-testfixtures/src/main/java/sop/testsuite/operation/MergeCertsTest.java +++ /dev/null @@ -1,101 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Paul Schaub -// -// SPDX-License-Identifier: Apache-2.0 - -package sop.testsuite.operation; - -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import sop.SOP; - -import java.io.IOException; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; - -public class MergeCertsTest extends AbstractSOPTest { - - static Stream provideInstances() { - return provideBackends(); - } - - @ParameterizedTest - @MethodSource("provideInstances") - public void testMergeWithItself(SOP sop) throws IOException { - byte[] key = sop.generateKey() - .noArmor() - .userId("Alice ") - .generate() - .getBytes(); - - byte[] cert = sop.extractCert() - .noArmor() - .key(key) - .getBytes(); - - byte[] merged = sop.mergeCerts() - .noArmor() - .updates(cert) - .baseCertificates(cert) - .getBytes(); - - assertArrayEquals(cert, merged); - } - - @ParameterizedTest - @MethodSource("provideInstances") - public void testApplyBaseToUpdate(SOP sop) throws IOException { - byte[] key = sop.generateKey() - .noArmor() - .userId("Alice ") - .generate() - .getBytes(); - - byte[] cert = sop.extractCert() - .noArmor() - .key(key) - .getBytes(); - - byte[] update = sop.revokeKey() - .noArmor() - .keys(key) - .getBytes(); - - byte[] merged = sop.mergeCerts() - .noArmor() - .updates(cert) - .baseCertificates(update) - .getBytes(); - - assertArrayEquals(update, merged); - } - - @ParameterizedTest - @MethodSource("provideInstances") - public void testApplyUpdateToBase(SOP sop) throws IOException { - byte[] key = sop.generateKey() - .noArmor() - .userId("Alice ") - .generate() - .getBytes(); - - byte[] cert = sop.extractCert() - .noArmor() - .key(key) - .getBytes(); - - byte[] update = sop.revokeKey() - .noArmor() - .keys(key) - .getBytes(); - - byte[] merged = sop.mergeCerts() - .noArmor() - .updates(update) - .baseCertificates(cert) - .getBytes(); - - assertArrayEquals(update, merged); - } -} diff --git a/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOption.kt b/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOption.kt new file mode 100644 index 0000000..cf99671 --- /dev/null +++ b/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOption.kt @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2024 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package sop.testsuite + +import java.lang.annotation.Inherited + +@Target(AnnotationTarget.TYPE) +@Retention(AnnotationRetention.RUNTIME) +@Inherited +annotation class AbortOnUnsupportedOption diff --git a/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOptionExtension.kt b/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOptionExtension.kt new file mode 100644 index 0000000..809c78f --- /dev/null +++ b/sop-java-testfixtures/src/main/kotlin/sop/testsuite/AbortOnUnsupportedOptionExtension.kt @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: 2024 Paul Schaub +// +// SPDX-License-Identifier: Apache-2.0 + +package sop.testsuite + +import org.junit.jupiter.api.Assumptions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.api.extension.TestExecutionExceptionHandler +import sop.exception.SOPGPException + +class AbortOnUnsupportedOptionExtension : TestExecutionExceptionHandler { + override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable) { + val testClass = context.requiredTestClass + val annotation = testClass.getAnnotation(AbortOnUnsupportedOption::class.java) + if (annotation != null && SOPGPException.UnsupportedOption::class.isInstance(throwable)) { + Assumptions.assumeTrue(false, "Test aborted due to: " + throwable.message) + } + throw throwable + } +}