Skip to content
Open
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
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
--add-exports=openjceplus/ibm.jceplus.junit.base.memstress=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.suites=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.tests=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.tests.parameters.resolvers=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.openjceplus=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.openjceplus.integration=ALL-UNNAMED
--add-exports=openjceplus/ibm.jceplus.junit.openjceplus.memstress=ALL-UNNAMED
Expand All @@ -259,6 +260,7 @@
--add-exports=openjceplus/ibm.jceplus.junit.openjceplusfips.multithread=ALL-UNNAMED
--add-opens=openjceplus/ibm.jceplus.junit.base=ALL-UNNAMED
--add-opens=openjceplus/ibm.jceplus.junit.tests=ALL-UNNAMED
--add-opens=openjceplus/ibm.jceplus.junit.tests.parameters.resolvers=ALL-UNNAMED
--patch-module openjceplus="target${file.separator}classes${path.separator}target${file.separator}test-classes"
-Djava.security.auth.debug=${java.security.auth.debug}
</argLine>
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/ibm/jceplus/junit/suites/BaseTestMultiThread.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright IBM Corp. 2025
* Copyright IBM Corp. 2025, 2026
*
* This code is free software; you can redistribute it and/or modify it
* under the terms provided by IBM in the LICENSE file that accompanied
Expand Down Expand Up @@ -45,7 +45,7 @@ public BaseTestMultiThread() {}
* Returns the tag name to filter tests by.
* @return the tag name
*/
protected abstract String getTagName();
protected abstract String getTagExpression();

/**
* Returns the package name to search for tests in.
Expand Down Expand Up @@ -133,7 +133,7 @@ protected List<String> discoverTestClasses() {

LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
.selectors(selectPackage(getPackageName()))
.filters(includeTags(getTagName()))
.filters(includeTags(getTagExpression()))
.build();

Launcher launcher = LauncherFactory.create();
Expand Down Expand Up @@ -170,13 +170,13 @@ protected void collectTestClasses(TestPlan testPlan, TestIdentifier identifier,
@Test
public void testMultithread() {
System.out.println("#threads=" + numThreads + " timeout=" + timeoutSec);
System.out.println("Discovering tests tagged with '" + getTagName() + "' in " + getPackageName() + " package...");
System.out.println("Discovering tests tagged with '" + getTagExpression() + "' in " + getPackageName() + " package...");

List<String> testClasses = discoverTestClasses();
System.out.println("Found " + testClasses.size() + " test classes with " + getTagName() + " tag");
System.out.println("Found " + testClasses.size() + " test classes with " + getTagExpression() + " tag");

if (testClasses.isEmpty()) {
fail("No test classes found with " + getTagName() + " tag");
fail("No test classes found with " + getTagExpression() + " tag");
}

List<String> failedTests = new ArrayList<>();
Expand Down
7 changes: 6 additions & 1 deletion src/test/java/ibm/jceplus/junit/suites/TestAll.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright IBM Corp. 2025
* Copyright IBM Corp. 2025, 2026
*
* This code is free software; you can redistribute it and/or modify it
* under the terms provided by IBM in the LICENSE file that accompanied
Expand All @@ -8,6 +8,9 @@

package ibm.jceplus.junit.suites;

import ibm.jceplus.junit.tests.Tags;
import org.junit.platform.suite.api.ExcludeClassNamePatterns;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;

Expand All @@ -17,5 +20,7 @@
*/
@Suite
@SelectPackages("ibm.jceplus.junit.tests")
@IncludeTags({Tags.OPENJCEPLUS_NAME, Tags.OPENJCEPLUS_FIPS_NAME})
@ExcludeClassNamePatterns("^.*(?i)multithread.*$")
public class TestAll {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public TestMultiThreadOpenJCEPlus() {
}

@Override
protected String getTagName() {
return Tags.OPENJCEPLUS_MULTITHREAD.getTag();
protected String getTagExpression() {
return Tags.OPENJCEPLUS.getTag() + " & " + Tags.MULTITHREAD.getTag();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public TestMultiThreadOpenJCEPlusFIPS() {
}

@Override
protected String getTagName() {
return Tags.OPENJCEPLUS_FIPS_MULTITHREAD.getTag();
protected String getTagExpression() {
return Tags.OPENJCEPLUS_FIPS.getTag() + " & " + Tags.MULTITHREAD.getTag();
}
}
3 changes: 3 additions & 0 deletions src/test/java/ibm/jceplus/junit/tests/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

package ibm.jceplus.junit.tests;

import ibm.jceplus.junit.tests.parameters.resolvers.ProviderListParameterResolver;
import java.security.Provider;
import org.junit.jupiter.api.extension.ExtendWith;

@ExtendWith(ProviderListParameterResolver.class)
abstract public class BaseTest {

private String providerName;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ibm/jceplus/junit/tests/BaseTestRSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void testRSACipher_WithSpec(String md, String mgf1) throws Exception {
@CsvSource({"NoPadding",
"PKCS1Padding",
"OAEPWithSHA1AndMGF1Padding",
"OAEPWithSHA-11AndMGF1Padding",
"OAEPWithSHA-1AndMGF1Padding",
})
public void testDisallowSHA1inFIPS_padding(String padding) throws Exception {
assumeTrue("OpenJCEPlusFIPS".equals(getProviderName()));
Expand Down
6 changes: 2 additions & 4 deletions src/test/java/ibm/jceplus/junit/tests/Tags.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ public enum Tags {

OPENJCEPLUS(TestProvider.OpenJCEPlus.getProviderName()),
OPENJCEPLUS_FIPS(TestProvider.OpenJCEPlusFIPS.getProviderName()),
OPENJCEPLUS_MULTITHREAD("OpenJCEPlusMultithread"),
OPENJCEPLUS_FIPS_MULTITHREAD("OpenJCEPlusFIPSMultithread");
MULTITHREAD("Multithread");

// Constants for tag names (can be used in annotations where compiler couldn't use a runtime method)
public static final String OPENJCEPLUS_NAME = TestProvider.OPENJCEPLUS_NAME;
public static final String OPENJCEPLUS_FIPS_NAME = TestProvider.OPENJCEPLUS_FIPS_NAME;
public static final String OPENJCEPLUS_MULTITHREAD_NAME = "OpenJCEPlusMultithread";
public static final String OPENJCEPLUS_FIPS_MULTITHREAD_NAME = "OpenJCEPlusFIPSMultithread";
public static final String MULTITHREAD_NAME = "Multithread";

private final String tag;

Expand Down
9 changes: 5 additions & 4 deletions src/test/java/ibm/jceplus/junit/tests/TestAES.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package ibm.jceplus.junit.tests;

import ibm.jceplus.junit.tests.parameters.resolvers.AESKeySizeListParameterResolver;
import java.nio.ByteBuffer;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
Expand All @@ -32,6 +33,7 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.Parameter;
import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -40,11 +42,11 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ExtendWith(AESKeySizeListParameterResolver.class)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#aesKeySizesAndJCEPlusProviders")
@MethodSource("ibm.jceplus.junit.tests.TestArguments#keySizesAndProviders")
public class TestAES extends BaseTestCipher {

@Parameter(0)
Expand Down Expand Up @@ -1156,5 +1158,4 @@ private void encodeDataForAES_CBC_PKCS5Padding(ByteBuffer buffer, Cipher cipher)

buffer.flip();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
*/
@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/ibm/jceplus/junit/tests/TestAESCopySafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/ibm/jceplus/junit/tests/TestAESGCM.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package ibm.jceplus.junit.tests;

import ibm.jceplus.junit.tests.parameters.resolvers.AESKeySizeListParameterResolver;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.security.AlgorithmParameters;
Expand All @@ -33,6 +34,7 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.Parameter;
import org.junit.jupiter.params.ParameterizedClass;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -41,11 +43,11 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ExtendWith(AESKeySizeListParameterResolver.class)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#aesKeySizesAndJCEPlusProviders")
@MethodSource("ibm.jceplus.junit.tests.TestArguments#keySizesAndProviders")
public class TestAESGCM extends BaseTest {

@Parameter(0)
Expand Down Expand Up @@ -1140,5 +1142,4 @@ public void ktestCipherStates() throws Exception {
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/ibm/jceplus/junit/tests/TestAESGCMLong.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
*/
@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
*/
@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

@Tag(Tags.OPENJCEPLUS_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_NAME)
@Tag(Tags.OPENJCEPLUS_MULTITHREAD_NAME)
@Tag(Tags.OPENJCEPLUS_FIPS_MULTITHREAD_NAME)
@Tag(Tags.MULTITHREAD_NAME)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ParameterizedClass
@MethodSource("ibm.jceplus.junit.tests.TestArguments#getEnabledProviders")
Expand Down
Loading
Loading