mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-10 18:59:43 +02:00
Compare commits
29 commits
7c4b4a4ddb
...
2d9a5646bb
Author | SHA1 | Date | |
---|---|---|---|
2d9a5646bb | |||
f2d40bba17 | |||
9a23ec6bb0 | |||
cc250efc56 | |||
3f1c0fa54f | |||
ebf5866dbd | |||
dd8526a0bc | |||
6a1df7a192 | |||
86ff389388 | |||
9583c03cd1 | |||
7a04783f12 | |||
dd377619a1 | |||
227081f1eb | |||
6eb8883563 | |||
68265671a5 | |||
c311d4106f | |||
bfe2e5f707 | |||
d95e28af00 | |||
dec1908d59 | |||
a8b51d44b9 | |||
e9c2bc8a3b | |||
e7f04584c8 | |||
d9afc3f2a0 | |||
8f7a085911 | |||
c48a17422f | |||
7e9a8f61cb | |||
03cb8d70f9 | |||
b9964339d1 | |||
dc92f0b623 |
7 changed files with 35 additions and 150 deletions
|
@ -6,12 +6,9 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 10.1.1
|
## 10.1.1-SNAPSHOT
|
||||||
- Prepare jar files for use in native images, e.g. using GraalVM by generating and including
|
- Prepare jar files for use in native images, e.g. using GraalVM by generating and including
|
||||||
configuration files for reflection, resources and dynamic proxies.
|
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
|
## 10.1.0
|
||||||
- `sop-java`:
|
- `sop-java`:
|
||||||
|
|
|
@ -18,7 +18,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
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 'org.jetbrains.kotlin.jvm' version "1.9.21"
|
||||||
id 'com.diffplug.spotless' version '6.22.0' apply false
|
id 'com.diffplug.spotless' version '6.22.0' apply false
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// 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 {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2025 Paul Schaub <vanitasvitae@fsfe.org>
|
|
||||||
//
|
|
||||||
// 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<Arguments> provideInstances() {
|
|
||||||
return provideBackends();
|
|
||||||
}
|
|
||||||
|
|
||||||
@ParameterizedTest
|
|
||||||
@MethodSource("provideInstances")
|
|
||||||
public void testMergeWithItself(SOP sop) throws IOException {
|
|
||||||
byte[] key = sop.generateKey()
|
|
||||||
.noArmor()
|
|
||||||
.userId("Alice <alice@pgpainless.org>")
|
|
||||||
.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 <alice@pgpainless.org>")
|
|
||||||
.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 <alice@pgpainless.org>")
|
|
||||||
.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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package sop.testsuite
|
||||||
|
|
||||||
|
import java.lang.annotation.Inherited
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
@Inherited
|
||||||
|
annotation class AbortOnUnsupportedOption
|
|
@ -0,0 +1,21 @@
|
||||||
|
// SPDX-FileCopyrightText: 2024 Paul Schaub <vanitasvitae@fsfe.org>
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue