From 7f11dc9318dee464642e7abd906390daf5b9a24c Mon Sep 17 00:00:00 2001 From: Martin Simka Date: Fri, 6 Sep 2024 18:06:24 +0200 Subject: [PATCH] make PatchingOperation unavailable on WildFly 29+ --- .../commands/patching/PatchingOperations.java | 9 +++++++++ .../commands/patching/PatchingOperationsTest.java | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/commands/src/main/java/org/wildfly/extras/creaper/commands/patching/PatchingOperations.java b/commands/src/main/java/org/wildfly/extras/creaper/commands/patching/PatchingOperations.java index a56b73be..b9728f4c 100644 --- a/commands/src/main/java/org/wildfly/extras/creaper/commands/patching/PatchingOperations.java +++ b/commands/src/main/java/org/wildfly/extras/creaper/commands/patching/PatchingOperations.java @@ -1,6 +1,7 @@ package org.wildfly.extras.creaper.commands.patching; import org.jboss.dmr.ModelNode; +import org.wildfly.extras.creaper.core.ServerVersion; import org.wildfly.extras.creaper.core.online.ModelNodeResult; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; import org.wildfly.extras.creaper.core.online.operations.Address; @@ -17,6 +18,14 @@ public final class PatchingOperations { private final Address patchingAddress; public PatchingOperations(OnlineManagementClient client) { + try { + if (client.version().greaterThan(ServerVersion.VERSION_21_0_0)) { + // https://issues.redhat.com/browse/WFCORE-6206 + throw new AssertionError("Patching subsystem has been removed in WildFly 29."); + } + } catch (IOException ioe) { + throw new IllegalStateException(ioe); + } this.ops = new Operations(client); this.patchingAddress = Address.coreService("patching"); } diff --git a/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/patching/PatchingOperationsTest.java b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/patching/PatchingOperationsTest.java index 691bffdf..2e4d766b 100644 --- a/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/patching/PatchingOperationsTest.java +++ b/testsuite/standalone/src/test/java/org/wildfly/extras/creaper/commands/patching/PatchingOperationsTest.java @@ -1,8 +1,11 @@ package org.wildfly.extras.creaper.commands.patching; import org.jboss.arquillian.junit.Arquillian; +import org.junit.Assume; +import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.wildfly.extras.creaper.core.ManagementClient; +import org.wildfly.extras.creaper.core.ServerVersion; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; import org.wildfly.extras.creaper.core.online.OnlineOptions; import org.junit.After; @@ -22,6 +25,16 @@ public class PatchingOperationsTest { private OnlineManagementClient client; private PatchingOperations patchingOps; + @BeforeClass + public static void checkServerVersionIsSupported() throws Exception { + // check version is supported + ServerVersion serverVersion + = ManagementClient.online(OnlineOptions.standalone().localDefault().build()).version(); + // https://issues.redhat.com/browse/WFCORE-6206 + Assume.assumeFalse("Patching subsystem has been removed in WildFly 29.", + serverVersion.greaterThan(ServerVersion.VERSION_21_0_0)); + } + @Before public void connect() throws IOException { client = ManagementClient.online(OnlineOptions.standalone().localDefault().build());