From e05436baa4a0649708bba252cc05f2a61cb4d94f Mon Sep 17 00:00:00 2001 From: Paul Ferraro Date: Thu, 17 Oct 2024 20:30:24 +0100 Subject: [PATCH] Add factory method accepting a stability. --- .../test/AdditionalInitialization.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/AdditionalInitialization.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/AdditionalInitialization.java index 023d8a3fbfd..8567353ebea 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/AdditionalInitialization.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/AdditionalInitialization.java @@ -121,14 +121,7 @@ protected ProcessType getProcessType() { * @return the additional initialization */ public static AdditionalInitialization withCapabilities(final String... capabilities) { - return new ManagementAdditionalInitialization() { - - @Override - protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { - super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); - registerCapabilities(capabilityRegistry, capabilities); - } - }; + return withCapabilities(Stability.DEFAULT, capabilities); } /** @@ -136,13 +129,25 @@ protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegis * the given {@link org.jboss.as.controller.capability.RuntimeCapability capabilities} registered, making it * possible for subsystems under test to require them. No runtime API will be available, but that should not * be needed for a {@link org.jboss.as.controller.RunningMode#ADMIN_ONLY} test. - * + * @param schema a subsystem schema * @param capabilities the capabilities * @return the additional initialization */ public static > AdditionalInitialization withCapabilities(S schema, String... capabilities) { - return new ManagementAdditionalInitialization(schema) { + return withCapabilities(schema.getStability(), capabilities); + } + /** + * Creates a {@link org.jboss.as.subsystem.test.AdditionalInitialization.ManagementAdditionalInitialization} with + * the given {@link org.jboss.as.controller.capability.RuntimeCapability capabilities} registered, making it + * possible for subsystems under test to require them. No runtime API will be available, but that should not + * be needed for a {@link org.jboss.as.controller.RunningMode#ADMIN_ONLY} test. + * @param stability the stability level of the test process + * @param capabilities the capabilities + * @return the additional initialization + */ + public static > AdditionalInitialization withCapabilities(Stability stability, String... capabilities) { + return new ManagementAdditionalInitialization(stability) { @Override protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry);