Skip to content

Commit

Permalink
Add factory method accepting a stability.
Browse files Browse the repository at this point in the history
  • Loading branch information
pferraro committed Dec 16, 2024
1 parent 414cbfa commit c997c15
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,33 @@ 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);
}

/**
* 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 schema a subsystem schema
* @param capabilities the capabilities
* @return the additional initialization
*/
public static <S extends SubsystemSchema<S>> 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 <S extends SubsystemSchema<S>> 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);
Expand Down

0 comments on commit c997c15

Please sign in to comment.