Skip to content

Commit

Permalink
make PatchingOperation unavailable on WildFly 29+
Browse files Browse the repository at this point in the history
  • Loading branch information
simkam committed Sep 6, 2024
1 parent 73a525f commit 7f11dc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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());
Expand Down

0 comments on commit 7f11dc9

Please sign in to comment.