Skip to content

Commit

Permalink
[WFCORE-7064] Do not set SM options in tests on JDK24+
Browse files Browse the repository at this point in the history
  • Loading branch information
ropalka committed Nov 22, 2024
1 parent 6f974db commit ad58216
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ public static void setup() throws Exception {
@Test
public void testStandaloneWithAgent() throws Exception {
final StandaloneCommandBuilder builder = StandaloneCommandBuilder.of(ServerHelper.JBOSS_HOME)
.addJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS)
.setUseSecurityManager(parseProperty("security.manager"))
// Add the test logging agent to the jboss-modules arguments
.addModuleOption("-javaagent:" + ServerHelper.JBOSS_HOME.resolve("logging-agent-tests.jar") + "=" + LoggingAgent.DEBUG_ARG);
.addJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS);
// [WFCORE-7064] Setting SM is not allowed on JDK24+
if (Runtime.version().feature() < 24) {
builder.setUseSecurityManager(parseProperty("security.manager"));
}
// Add the test logging agent to the jboss-modules arguments
builder.addModuleOption("-javaagent:" + ServerHelper.JBOSS_HOME.resolve("logging-agent-tests.jar") + "=" + LoggingAgent.DEBUG_ARG);

final String localRepo = System.getProperty("maven.repo.local");
if (localRepo != null) {
Expand Down Expand Up @@ -85,8 +88,11 @@ public void testStandaloneWithAgent() throws Exception {
@Test
public void testDomainServerWithAgent() throws Exception {
final DomainCommandBuilder builder = DomainCommandBuilder.of(ServerHelper.JBOSS_HOME)
.addHostControllerJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS)
.setUseSecurityManager(parseProperty("security.manager"));
.addHostControllerJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS);
// [WFCORE-7064] Setting SM is not allowed on JDK24+
if (Runtime.version().feature() < 24) {
builder.setUseSecurityManager(parseProperty("security.manager"));
}

final String localRepo = System.getProperty("maven.repo.local");
if (localRepo != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public DomainScriptTestCase() {

@Parameterized.Parameters
public static Collection<Object> data() {
return List.of(Map.of(), Map.of("SECMGR", "true"));
return List.of(Map.of(), Map.of("SECMGR", SECMGR_VALUE));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
*/
public abstract class ScriptTestCase {

// [WFCORE-7064] Setting SM is not allowed on JDK24+
static final String SECMGR_VALUE = Runtime.version().feature() < 24 ? "true" : "false";
static final Map<String, String> MAVEN_JAVA_OPTS = new LinkedHashMap<>();

private final String scriptBaseName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static Collection<Object> data() {
Map.of(),
Map.of("GC_LOG", "true"),
Map.of("MODULE_OPTS", "-javaagent:logging-agent-tests.jar=" + LoggingAgent.DEBUG_ARG),
Map.of("SECMGR", "true")
Map.of("SECMGR", SECMGR_VALUE)
);
}

Expand Down

0 comments on commit ad58216

Please sign in to comment.