From 090f687afa8aea4f403314dfc7e1e1672d2e26b1 Mon Sep 17 00:00:00 2001 From: Diana Krepinska Date: Tue, 9 Apr 2024 15:53:22 +0200 Subject: [PATCH 01/11] [WFCORE-6755] Move the org.wildfly.security:wildfly-elytron-dynamic-ssl artifact into its own module --- .../security/elytron-base/main/module.xml | 2 +- .../elytron-dynamic-ssl/main/module.xml | 26 ++++++++++++ .../elytron/DynamicSSLContextHelper.java | 34 +++++++++++++++ .../extension/elytron/SSLDefinitions.java | 21 ++++------ .../elytron/TrivialResourceDefinition.java | 42 ++++++++++++++----- .../_private/ElytronSubsystemMessages.java | 2 + 6 files changed, 104 insertions(+), 23 deletions(-) create mode 100644 core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-dynamic-ssl/main/module.xml create mode 100644 elytron/src/main/java/org/wildfly/extension/elytron/DynamicSSLContextHelper.java diff --git a/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-base/main/module.xml b/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-base/main/module.xml index 8753b51d7e9..5bd16aab8d5 100644 --- a/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-base/main/module.xml +++ b/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-base/main/module.xml @@ -34,7 +34,6 @@ - @@ -112,5 +111,6 @@ modules use the parser, they need to have visibility to this module. --> + diff --git a/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-dynamic-ssl/main/module.xml b/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-dynamic-ssl/main/module.xml new file mode 100644 index 00000000000..aef462f9edd --- /dev/null +++ b/core-feature-pack/common/src/main/resources/modules/system/layers/base/org/wildfly/security/elytron-dynamic-ssl/main/module.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/DynamicSSLContextHelper.java b/elytron/src/main/java/org/wildfly/extension/elytron/DynamicSSLContextHelper.java new file mode 100644 index 00000000000..614e30dba06 --- /dev/null +++ b/elytron/src/main/java/org/wildfly/extension/elytron/DynamicSSLContextHelper.java @@ -0,0 +1,34 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.extension.elytron; + +import org.wildfly.security.auth.client.AuthenticationContext; +import org.wildfly.security.dynamic.ssl.DynamicSSLContext; +import org.wildfly.security.dynamic.ssl.DynamicSSLContextImpl; +import org.wildfly.security.dynamic.ssl.DynamicSSLContextException; + +import javax.net.ssl.SSLContext; +import java.security.GeneralSecurityException; +import static org.wildfly.extension.elytron._private.ElytronSubsystemMessages.ROOT_LOGGER; + +/** + * Helper class for obtaining an instance of DynamicSSLContext created from the provided AuthenticationContext + */ +class DynamicSSLContextHelper { + + /** + * Get DynamicSSLContext instance from the provided authentication context + * @param authenticationContext authentication context to use with the DynamicSSLContext + * @return DynamicSSLContext instance + */ + static SSLContext getDynamicSSLContextInstance(AuthenticationContext authenticationContext) { + try { + return new DynamicSSLContext(new DynamicSSLContextImpl(authenticationContext)); + } catch (DynamicSSLContextException | GeneralSecurityException e) { + throw ROOT_LOGGER.unableToObtainDynamicSSLContext(); + } + } +} diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java b/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java index 16c4aee595c..e332eabbfbd 100644 --- a/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java +++ b/elytron/src/main/java/org/wildfly/extension/elytron/SSLDefinitions.java @@ -116,15 +116,12 @@ import org.wildfly.extension.elytron._private.ElytronSubsystemMessages; import org.wildfly.extension.elytron.capabilities.PrincipalTransformer; import org.wildfly.security.auth.client.AuthenticationContext; -import org.wildfly.security.dynamic.ssl.DynamicSSLContextImpl; import org.wildfly.security.auth.server.MechanismConfiguration; import org.wildfly.security.auth.server.MechanismConfigurationSelector; import org.wildfly.security.auth.server.RealmMapper; import org.wildfly.security.auth.server.SecurityDomain; import org.wildfly.security.credential.PasswordCredential; import org.wildfly.security.credential.source.CredentialSource; -import org.wildfly.security.dynamic.ssl.DynamicSSLContext; -import org.wildfly.security.dynamic.ssl.DynamicSSLContextException; import org.wildfly.security.keystore.AliasFilter; import org.wildfly.security.keystore.FilteringKeyStore; import org.wildfly.security.password.interfaces.ClearPassword; @@ -144,6 +141,7 @@ class SSLDefinitions { private static final BooleanSupplier IS_FIPS = getFipsSupplier(); + private static final String ORG_WILDFLY_SECURITY_ELYTRON_DYNAMIC_SSL = "org.wildfly.security.elytron-dynamic-ssl"; static final ServiceUtil SERVER_SERVICE_UTIL = ServiceUtil.newInstance(SSL_CONTEXT_RUNTIME_CAPABILITY, ElytronDescriptionConstants.SERVER_SSL_CONTEXT, SSLContext.class); static final ServiceUtil CLIENT_SERVICE_UTIL = ServiceUtil.newInstance(SSL_CONTEXT_RUNTIME_CAPABILITY, ElytronDescriptionConstants.CLIENT_SSL_CONTEXT, SSLContext.class); @@ -1226,13 +1224,18 @@ private static ResourceDefinition createSSLContextDefinition(String pathKey, boo } private static ResourceDefinition createSSLContextDefinition(String pathKey, boolean server, AbstractAddStepHandler addHandler, AttributeDefinition[] attributes, boolean serverOrHostController, Stability stability) { + return createSSLContextDefinition(pathKey, server, addHandler, attributes, serverOrHostController, stability, null); + } + + private static ResourceDefinition createSSLContextDefinition(String pathKey, boolean server, AbstractAddStepHandler addHandler, AttributeDefinition[] attributes, boolean serverOrHostController, Stability stability, String dependencyPackageName) { Builder builder = TrivialResourceDefinition.builder() .setPathKey(pathKey) .setAddHandler(addHandler) .setAttributes(attributes) .setRuntimeCapabilities(SSL_CONTEXT_RUNTIME_CAPABILITY) - .setStability(stability); + .setStability(stability) + .setDependencyPackageName(dependencyPackageName); if (serverOrHostController) { builder.addReadOnlyAttribute(ACTIVE_SESSION_COUNT, new SSLContextRuntimeHandler() { @@ -1542,13 +1545,7 @@ protected ValueSupplier getValueSupplier(ServiceBuilder ServiceName acServiceName = context.getCapabilityServiceName(authenticationContextCapability, AuthenticationContext.class); Supplier authenticationContextSupplier = serviceBuilder.requires(acServiceName); - return () -> { - try { - return new DynamicSSLContext(new DynamicSSLContextImpl(authenticationContextSupplier.get())); - } catch (DynamicSSLContextException | GeneralSecurityException e) { - throw new RuntimeException(e); - } - }; + return () -> DynamicSSLContextHelper.getDynamicSSLContextInstance(authenticationContextSupplier.get()); } @Override @@ -1564,7 +1561,7 @@ protected void installedForResource(ServiceController serviceControl } }; - return createSSLContextDefinition(ElytronDescriptionConstants.DYNAMIC_CLIENT_SSL_CONTEXT, false, add, attributes, false, Stability.COMMUNITY); + return createSSLContextDefinition(ElytronDescriptionConstants.DYNAMIC_CLIENT_SSL_CONTEXT, false, add, attributes, false, Stability.COMMUNITY, ORG_WILDFLY_SECURITY_ELYTRON_DYNAMIC_SSL); } private static Provider[] filterProviders(Provider[] all, String provider) { diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/TrivialResourceDefinition.java b/elytron/src/main/java/org/wildfly/extension/elytron/TrivialResourceDefinition.java index 4cb1f4a8a91..c8a9acc4d87 100644 --- a/elytron/src/main/java/org/wildfly/extension/elytron/TrivialResourceDefinition.java +++ b/elytron/src/main/java/org/wildfly/extension/elytron/TrivialResourceDefinition.java @@ -23,6 +23,7 @@ import org.jboss.as.controller.descriptions.ResourceDescriptionResolver; import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.OperationEntry; +import org.jboss.as.controller.registry.RuntimePackageDependency; import org.jboss.as.version.Stability; /** @@ -36,10 +37,25 @@ final class TrivialResourceDefinition extends SimpleResourceDefinition { private final Map operations; private final Map readOnlyAttributes; private final List children; + private final String dependencyPackageName; + + TrivialResourceDefinition(String pathKey, ResourceDescriptionResolver resourceDescriptionResolver, AbstractAddStepHandler add, AttributeDefinition[] attributes, RuntimeCapability ... runtimeCapabilities) { + this(pathKey, resourceDescriptionResolver, add, new TrivialCapabilityServiceRemoveHandler(add, runtimeCapabilities), attributes, null, null, null, runtimeCapabilities, Stability.DEFAULT); + } + + TrivialResourceDefinition(String pathKey, AbstractAddStepHandler add, AttributeDefinition[] attributes, RuntimeCapability ... runtimeCapabilities) { + this(pathKey, ElytronExtension.getResourceDescriptionResolver(pathKey), add, new TrivialCapabilityServiceRemoveHandler(add, runtimeCapabilities), attributes, null, null, null, runtimeCapabilities, Stability.DEFAULT); + } + + private TrivialResourceDefinition(String pathKey, ResourceDescriptionResolver resourceDescriptionResolver, AbstractAddStepHandler add, AbstractRemoveStepHandler remove, AttributeDefinition[] attributes, + Map readOnlyAttributes, Map operations, List children, + RuntimeCapability[] runtimeCapabilities, Stability stability) { + this(pathKey, resourceDescriptionResolver, add, remove, attributes, readOnlyAttributes, operations, children, runtimeCapabilities, stability, null); + } private TrivialResourceDefinition(String pathKey, ResourceDescriptionResolver resourceDescriptionResolver, AbstractAddStepHandler add, AbstractRemoveStepHandler remove, AttributeDefinition[] attributes, Map readOnlyAttributes, Map operations, List children, - RuntimeCapability[] runtimeCapabilities, Stability stability) { + RuntimeCapability[] runtimeCapabilities, Stability stability, String dependencyPackageName) { super(new Parameters(ResourceRegistration.of(PathElement.pathElement(pathKey), stability), resourceDescriptionResolver) .setAddHandler(add) @@ -52,14 +68,7 @@ private TrivialResourceDefinition(String pathKey, ResourceDescriptionResolver re this.readOnlyAttributes = readOnlyAttributes; this.operations = operations; this.children = children; - } - - TrivialResourceDefinition(String pathKey, ResourceDescriptionResolver resourceDescriptionResolver, AbstractAddStepHandler add, AttributeDefinition[] attributes, RuntimeCapability ... runtimeCapabilities) { - this(pathKey, resourceDescriptionResolver, add, new TrivialCapabilityServiceRemoveHandler(add, runtimeCapabilities), attributes, null, null, null, runtimeCapabilities, Stability.DEFAULT); - } - - TrivialResourceDefinition(String pathKey, AbstractAddStepHandler add, AttributeDefinition[] attributes, RuntimeCapability ... runtimeCapabilities) { - this(pathKey, ElytronExtension.getResourceDescriptionResolver(pathKey), add, new TrivialCapabilityServiceRemoveHandler(add, runtimeCapabilities), attributes, null, null, null, runtimeCapabilities, Stability.DEFAULT); + this.dependencyPackageName = dependencyPackageName; } @Override @@ -97,6 +106,13 @@ public void registerChildren(ManagementResourceRegistration resourceRegistration } } + @Override + public void registerAdditionalRuntimePackages(ManagementResourceRegistration resourceRegistration) { + if (dependencyPackageName != null) { + resourceRegistration.registerAdditionalRuntimePackages(RuntimePackageDependency.required(dependencyPackageName)); + } + } + public AttributeDefinition[] getAttributes() { return attributes; } @@ -117,6 +133,7 @@ static class Builder { private RuntimeCapability[] runtimeCapabilities; private List children; private Stability stability = Stability.DEFAULT; + private String dependencyPackageName; Builder() {} @@ -189,11 +206,16 @@ Builder addChild(ResourceDefinition child) { return this; } + Builder setDependencyPackageName(String dependencyPackageName) { + this.dependencyPackageName = dependencyPackageName; + return this; + } + ResourceDefinition build() { ResourceDescriptionResolver resourceDescriptionResolver = this.resourceDescriptionResolver != null ? this.resourceDescriptionResolver : ElytronExtension.getResourceDescriptionResolver(pathKey); return new TrivialResourceDefinition(pathKey, resourceDescriptionResolver, addHandler, removeHandler != null ? removeHandler : new TrivialCapabilityServiceRemoveHandler(addHandler, runtimeCapabilities), - attributes, readOnlyAttributes, operations, children, runtimeCapabilities, stability); + attributes, readOnlyAttributes, operations, children, runtimeCapabilities, stability, dependencyPackageName); } } diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/_private/ElytronSubsystemMessages.java b/elytron/src/main/java/org/wildfly/extension/elytron/_private/ElytronSubsystemMessages.java index ecb12a40f61..cae3bb34a5d 100644 --- a/elytron/src/main/java/org/wildfly/extension/elytron/_private/ElytronSubsystemMessages.java +++ b/elytron/src/main/java/org/wildfly/extension/elytron/_private/ElytronSubsystemMessages.java @@ -728,6 +728,8 @@ public interface ElytronSubsystemMessages extends BasicLogger { "use Elytron Tool command `filesystem-realm-encrypt`") OperationFailedException addSecretKeyToInitializedFilesystemRealm(); + @Message(id = 1221, value = "Unable to obtain DynamicSSLContext from the provided authentication context") + RuntimeException unableToObtainDynamicSSLContext(); /* * Don't just add new errors to the end of the file, there may be an appropriate section above for the resource. * From fdd87e97e2b56c1c85d37c24a02178bd026bb82f Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Tue, 1 Oct 2024 15:19:57 +0100 Subject: [PATCH 02/11] [WFCORE-6755] Do not make Elytron layer depend on elytron-dynamic-ssl if we have provisioned to an stability level above community Jira issue: https://issues.redhat.com/browse/WFCORE-6755 --- .../main/resources/layers/standalone/elytron/layer-spec.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core-feature-pack/galleon-common/src/main/resources/layers/standalone/elytron/layer-spec.xml b/core-feature-pack/galleon-common/src/main/resources/layers/standalone/elytron/layer-spec.xml index 2a951fd1d97..19f08ecde2b 100644 --- a/core-feature-pack/galleon-common/src/main/resources/layers/standalone/elytron/layer-spec.xml +++ b/core-feature-pack/galleon-common/src/main/resources/layers/standalone/elytron/layer-spec.xml @@ -17,5 +17,9 @@ + + From 9ede2158f92bf44a20756581d5a752df0e22ee0a Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Fri, 13 Dec 2024 13:47:02 +0100 Subject: [PATCH 03/11] [WFCORE-7088]: Add a trace when restartRequired is ignored because of booting. * debug trace added. Jira: https://issues.redhat.com/browse/WFCORE-7088 Signed-off-by: Emmanuel Hugonnet --- .../java/org/jboss/as/controller/AbstractOperationContext.java | 1 + 1 file changed, 1 insertion(+) diff --git a/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java b/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java index c04bc69e116..f7a8b403187 100644 --- a/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java +++ b/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java @@ -1242,6 +1242,7 @@ public final void reloadRequired() { @Override public final void restartRequired() { if (isBooting()) { + MGMT_OP_LOGGER.debug("Server is booting so we didn't set the restart required flag"); return; } activeStep.setRestartStamp(processState.setRestartRequired()); From 0651dbeebb091a0388aa798c8011440185b3346a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 23:13:00 +0000 Subject: [PATCH 04/11] Bump org.wildfly.launcher:wildfly-launcher Bumps [org.wildfly.launcher:wildfly-launcher](https://github.com/wildfly/wildfly-launcher) from 1.0.0.Beta3 to 1.0.0.Final. - [Release notes](https://github.com/wildfly/wildfly-launcher/releases) - [Commits](https://github.com/wildfly/wildfly-launcher/compare/v1.0.0.Beta3...v1.0.0.Final) --- updated-dependencies: - dependency-name: org.wildfly.launcher:wildfly-launcher dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e2f5b64c96e..a51ac0a33e7 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ 1.7.0.Final 1.3.0.Final 1.1.1.Final - 1.0.0.Beta3 + 1.0.0.Final 8.0.2.Final 2.2.5.Final 2.2.2.Final From 13264d800adebc762bfcbbb028770b96fbd8cea4 Mon Sep 17 00:00:00 2001 From: "James R. Perkins" Date: Fri, 13 Dec 2024 15:28:48 -0800 Subject: [PATCH 05/11] [WFCORE-7089] When setting a policy in the PolicyDefinitions do not attempt to refresh the policy if it's null. https://issues.redhat.com/browse/WFCORE-7089 Signed-off-by: James R. Perkins --- .../java/org/wildfly/extension/elytron/PolicyDefinitions.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elytron/src/main/java/org/wildfly/extension/elytron/PolicyDefinitions.java b/elytron/src/main/java/org/wildfly/extension/elytron/PolicyDefinitions.java index 3cb99e8e33f..c677606aa03 100644 --- a/elytron/src/main/java/org/wildfly/extension/elytron/PolicyDefinitions.java +++ b/elytron/src/main/java/org/wildfly/extension/elytron/PolicyDefinitions.java @@ -199,7 +199,9 @@ public Policy getValue() throws IllegalStateException, IllegalArgumentException } private void setPolicy(Policy policy) { - policy.refresh(); + if (policy != null) { + policy.refresh(); + } try { if (WildFlySecurityManager.isChecking()) { AccessController.doPrivileged(setPolicyAction(policy)); From 38047776e8ec84a799fc3a4102f79c3e12c12607 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Fri, 13 Dec 2024 23:45:08 +0000 Subject: [PATCH 06/11] [WFCORE-7091] Add model controller constructors for WildFly 31 controllers Jira issue: https://issues.redhat.com/browse/WFCORE-7091 --- .../test/ModelTestModelControllerService.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java b/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java index fe36092aeee..fb8c968bf6d 100644 --- a/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java +++ b/model-test/src/main/java/org/jboss/as/model/test/ModelTestModelControllerService.java @@ -181,6 +181,60 @@ protected ModelTestModelControllerService(final ProcessType processType, final R this.runningModeControl = runningModeControl; } + /** + * This is the constructor to use for WildFly 31.0.0 core model tests + */ + protected ModelTestModelControllerService(final ProcessType processType, Stability stability, final RunningModeControl runningModeControl, final TransformerRegistry transformerRegistry, + final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, + final ResourceDefinition rootResourceDefinition, final ControlledProcessState processState, + final ExpressionResolver expressionResolver, final CapabilityRegistry capabilityRegistry, final Controller31x version) { + super(null, + null, + processType, + stability, + runningModeControl, + persister, + processState == null ? new ControlledProcessState(true) : processState, rootResourceDefinition, + null, + expressionResolver, + AuditLogger.NO_OP_LOGGER, + new DelegatingConfigurableAuthorizer(), + new ManagementSecurityIdentitySupplier(), + capabilityRegistry, + null); + + this.persister = persister; + this.transformerRegistry = transformerRegistry; + this.validateOpsFilter = validateOpsFilter; + this.runningModeControl = runningModeControl; + } + + /** + * This is the constructor to use for WildFly 31.0.0 subsystem tests + */ + protected ModelTestModelControllerService(final ProcessType processType, Stability stability, final RunningModeControl runningModeControl, final TransformerRegistry transformerRegistry, + final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, + final ResourceDefinition resourceDefinition, final ExpressionResolver expressionResolver, final ControlledProcessState processState, + final CapabilityRegistry capabilityRegistry, final Controller31x version) { + super(null, + null, + processType, + stability, + runningModeControl, + persister, + processState == null ? new ControlledProcessState(true) : processState, + resourceDefinition, null, + expressionResolver != null ? expressionResolver : ExpressionResolver.TEST_RESOLVER, + AuditLogger.NO_OP_LOGGER, new DelegatingConfigurableAuthorizer(), + new ManagementSecurityIdentitySupplier(), + capabilityRegistry, + null); + this.persister = persister; + this.transformerRegistry = transformerRegistry; + this.validateOpsFilter = validateOpsFilter; + this.runningModeControl = runningModeControl; + } + /** * This is the constructor to use for current core model tests @@ -481,4 +535,10 @@ public static class Controller29x { private Controller29x() { } } + + public static class Controller31x { + public static Controller31x INSTANCE = new Controller31x(); + private Controller31x() { + } + } } From 1650871df8c32fe49e814dd345a112643866ebb8 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Fri, 13 Dec 2024 23:49:14 +0000 Subject: [PATCH 07/11] [WFCORE-7091] Adapt the test framework to use an stability level when it is preparing the legacy controllers Jira issue: https://issues.redhat.com/browse/WFCORE-7091 --- ...FirstClassLoaderKernelServicesFactory.java | 23 ++++++ .../local/ScopedKernelServicesBootstrap.java | 81 +++++++++++++------ .../model/test/CoreModelTestDelegate.java | 16 ++-- .../test/TestModelControllerService.java | 18 ++++- .../test/util/TransformersTestParameter.java | 2 + .../elytron/SubsystemTransformerTestCase.java | 10 ++- .../test/ModelTestControllerVersion.java | 17 +++- ...FirstClassLoaderKernelServicesFactory.java | 21 +++++ .../local/ScopedKernelServicesBootstrap.java | 70 +++++++++++----- .../test/AdditionalInitialization.java | 36 +++++++++ .../subsystem/test/SubsystemTestDelegate.java | 29 ++++--- .../test/TestModelControllerService.java | 11 ++- .../org/jboss/as/version/ProductConfig.java | 7 +- 13 files changed, 265 insertions(+), 76 deletions(-) diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java index ad5c68caee3..ef665887118 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java @@ -29,6 +29,7 @@ import org.jboss.as.host.controller.HostRunningModeControl; import org.jboss.as.host.controller.RestartMode; import org.jboss.as.model.test.ModelTestOperationValidatorFilter; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; import org.jboss.staxmapper.XMLMapper; @@ -54,6 +55,28 @@ public static KernelServices create(List bootOperations, ModelTestOpe return AbstractKernelServicesImpl.create(ProcessType.HOST_CONTROLLER, runningModeControl, validateOpsFilter, bootOperations, testParser, legacyModelVersion, type, modelInitializer, extensionRegistry, null); } + public static KernelServices create(List bootOperations, ModelTestOperationValidatorFilter validateOpsFilter, ModelVersion legacyModelVersion, + List modelInitializerEntries, String stabilityStr) throws Exception { + + Stability stability = Stability.fromString(stabilityStr); + TestModelType type = TestModelType.DOMAIN; + XMLMapper xmlMapper = XMLMapper.Factory.create(); + TestParser testParser = TestParser.create(stability, null, xmlMapper, type); + ModelInitializer modelInitializer = null; + if (modelInitializerEntries != null && !modelInitializerEntries.isEmpty()) { + modelInitializer = new LegacyModelInitializer(modelInitializerEntries); + } + + RunningModeControl runningModeControl = new HostRunningModeControl(RunningMode.ADMIN_ONLY, RestartMode.HC_ONLY); + + ExtensionRegistry extensionRegistry = ExtensionRegistry.builder(ProcessType.HOST_CONTROLLER) + .withRunningMode(runningModeControl.getRunningMode()) + .withStability(stability) + .build(); + + return AbstractKernelServicesImpl.create(ProcessType.HOST_CONTROLLER, runningModeControl, validateOpsFilter, bootOperations, testParser, legacyModelVersion, type, modelInitializer, extensionRegistry, null); + } + private static class LegacyModelInitializer implements ModelInitializer { private final List entries; diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/local/ScopedKernelServicesBootstrap.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/local/ScopedKernelServicesBootstrap.java index 0177fa41021..6ef83c14914 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/local/ScopedKernelServicesBootstrap.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/bridge/local/ScopedKernelServicesBootstrap.java @@ -14,58 +14,89 @@ import org.jboss.as.core.model.bridge.impl.LegacyControllerKernelServicesProxy; import org.jboss.as.core.model.test.LegacyModelInitializerEntry; import org.jboss.as.model.test.ModelTestOperationValidatorFilter; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; /** - * * @author Kabir Khan */ public class ScopedKernelServicesBootstrap { + Stability stability; ClassLoader legacyChildFirstClassLoader; ClassLoaderObjectConverter objectConverter; - public ScopedKernelServicesBootstrap(ClassLoader legacyChildFirstClassLoader) { + public ScopedKernelServicesBootstrap(ClassLoader legacyChildFirstClassLoader, Stability stability) { this.legacyChildFirstClassLoader = legacyChildFirstClassLoader; this.objectConverter = new ClassLoaderObjectConverterImpl(this.getClass().getClassLoader(), legacyChildFirstClassLoader); + this.stability = stability; } - public LegacyControllerKernelServicesProxy createKernelServices(List bootOperations, ModelTestOperationValidatorFilter validateOpsFilter, ModelVersion legacyModelVersion, List modelInitializerEntries) throws Exception { Object childClassLoaderKernelServices = createChildClassLoaderKernelServices(bootOperations, validateOpsFilter, legacyModelVersion, modelInitializerEntries); return new LegacyControllerKernelServicesProxy(legacyChildFirstClassLoader, childClassLoaderKernelServices, objectConverter); } - private Object createChildClassLoaderKernelServices(List bootOperations, ModelTestOperationValidatorFilter validateOpsFilter, ModelVersion legacyModelVersion, List modelInitializerEntries){ + private Object createChildClassLoaderKernelServices(List bootOperations, ModelTestOperationValidatorFilter validateOpsFilter, ModelVersion legacyModelVersion, List modelInitializerEntries) { try { Class clazz = legacyChildFirstClassLoader.loadClass(ChildFirstClassLoaderKernelServicesFactory.class.getName()); + List convertedBootOps = getConvertedBootOps(bootOperations); + List convertedModelInitializerEntries = convertModelInitializer(modelInitializerEntries); - Method m = clazz.getMethod("create", - List.class, - legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), - legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), - List.class); - - List convertedBootOps = new ArrayList(); - for (int i = 0 ; i < bootOperations.size() ; i++) { - ModelNode node = bootOperations.get(i); - if (node != null) { - convertedBootOps.add(objectConverter.convertModelNodeToChildCl(node)); - } - } + Object convertedValidationFilter = objectConverter.convertValidateOperationsFilterToChildCl(validateOpsFilter); + Object convertedLegacyModelVersion = objectConverter.convertModelVersionToChildCl(legacyModelVersion); - List convertedModelInitializerEntries = null; - if (modelInitializerEntries != null) { - convertedModelInitializerEntries = new ArrayList(); - for (LegacyModelInitializerEntry entry : modelInitializerEntries) { - convertedModelInitializerEntries.add(objectConverter.convertLegacyModelInitializerEntryToChildCl(entry)); - } - } + if (!Stability.DEFAULT.equals(stability)) { + Method m = clazz.getMethod("create", + List.class, + legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), + legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), + List.class, + String.class); - return m.invoke(null, convertedBootOps, objectConverter.convertValidateOperationsFilterToChildCl(validateOpsFilter), objectConverter.convertModelVersionToChildCl(legacyModelVersion), convertedModelInitializerEntries); + return m.invoke(null, + convertedBootOps, + convertedValidationFilter, + convertedLegacyModelVersion, + convertedModelInitializerEntries, + stability.toString()); + } else { + Method m = clazz.getMethod("create", + List.class, + legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), + legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), + List.class); + return m.invoke(null, + convertedBootOps, + convertedValidationFilter, + convertedLegacyModelVersion, + convertedModelInitializerEntries); + } } catch (Exception e) { throw new RuntimeException(e); } } + + private List convertModelInitializer(List modelInitializerEntries) { + List converted = null; + if (modelInitializerEntries != null) { + converted = new ArrayList<>(); + for (LegacyModelInitializerEntry entry : modelInitializerEntries) { + converted.add(objectConverter.convertLegacyModelInitializerEntryToChildCl(entry)); + } + } + return converted; + } + + private List getConvertedBootOps(List bootOperations) { + List converted = new ArrayList<>(); + for (ModelNode node : bootOperations) { + if (node != null) { + converted.add(objectConverter.convertModelNodeToChildCl(node)); + } + } + return converted; + } } + diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java index 10a69799126..b752e9c69ff 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java @@ -446,7 +446,10 @@ private class KernelServicesBuilderImpl implements KernelServicesBuilder, ModelT this.stability = stability; this.processType = type == TestModelType.HOST || type == TestModelType.DOMAIN ? ProcessType.HOST_CONTROLLER : ProcessType.STANDALONE_SERVER; runningModeControl = type == TestModelType.HOST ? new HostRunningModeControl(RunningMode.ADMIN_ONLY, RestartMode.HC_ONLY) : new RunningModeControl(RunningMode.ADMIN_ONLY); - extensionRegistry = ExtensionRegistry.builder(this.processType).withRunningModeControl(this.runningModeControl).withStability(stability).build(); + extensionRegistry = ExtensionRegistry.builder(this.processType) + .withRunningModeControl(this.runningModeControl) + .withStability(stability) + .build(); testParser = TestParser.create(stability, extensionRegistry, xmlMapper, type); } @@ -680,6 +683,7 @@ private class LegacyKernelServicesInitializerImpl implements LegacyKernelService private final ModelVersion modelVersion; private final List modelInitializerEntries = new ArrayList(); private final ModelTestControllerVersion testControllerVersion; + private final Stability stability; private boolean dontUseBootOperations = false; private boolean skipReverseCheck; private ModelFixer reverseCheckMainModelFixer; @@ -690,6 +694,7 @@ private class LegacyKernelServicesInitializerImpl implements LegacyKernelService this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.modelVersion = modelVersion; this.testControllerVersion = version; + this.stability = version.getStability(); } private LegacyControllerKernelServicesProxy install(AbstractKernelServicesImpl mainServices, ModelInitializer modelInitializer, ModelWriteSanitizer modelWriteSanitizer, List contentRepositoryContents, List bootOperations) throws Exception { @@ -698,7 +703,7 @@ private LegacyControllerKernelServicesProxy install(AbstractKernelServicesImpl m } if (!skipReverseCheck) { - bootCurrentVersionWithLegacyBootOperations(bootOperations, modelInitializer, modelWriteSanitizer, contentRepositoryContents, mainServices); + bootCurrentVersionWithLegacyBootOperations(bootOperations, modelInitializer, modelWriteSanitizer, contentRepositoryContents, mainServices, stability); } final ClassLoader legacyCl; @@ -733,7 +738,7 @@ private LegacyControllerKernelServicesProxy install(AbstractKernelServicesImpl m } - ScopedKernelServicesBootstrap scopedBootstrap = new ScopedKernelServicesBootstrap(legacyCl); + ScopedKernelServicesBootstrap scopedBootstrap = new ScopedKernelServicesBootstrap(legacyCl, stability); LegacyControllerKernelServicesProxy legacyServices = scopedBootstrap.createKernelServices(bootOperations, getOperationValidationFilter(), modelVersion, modelInitializerEntries); return legacyServices; @@ -793,8 +798,9 @@ public LegacyKernelServicesInitializer configureReverseControllerCheck(ModelFixe return this; } - private KernelServices bootCurrentVersionWithLegacyBootOperations(List bootOperations, ModelInitializer modelInitializer, ModelWriteSanitizer modelWriteSanitizer, List contentRepositoryHashes, KernelServices mainServices) throws Exception { - KernelServicesBuilder reverseServicesBuilder = createKernelServicesBuilder(TestModelType.DOMAIN, Stability.DEFAULT) + private KernelServices bootCurrentVersionWithLegacyBootOperations(List bootOperations, ModelInitializer modelInitializer, ModelWriteSanitizer modelWriteSanitizer, List contentRepositoryHashes, KernelServices mainServices, Stability stability) throws Exception { + testControllerVersion.getCoreVersion(); + KernelServicesBuilder reverseServicesBuilder = createKernelServicesBuilder(TestModelType.DOMAIN, stability) .setBootOperations(bootOperations) .setModelInitializer(modelInitializer, modelWriteSanitizer); for (String hash : contentRepositoryHashes) { diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java index 876228b3196..b7df6c50f29 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/TestModelControllerService.java @@ -39,6 +39,7 @@ import org.jboss.as.controller.descriptions.ModelDescriptionConstants; import org.jboss.as.controller.descriptions.NonResolvingResourceDescriptionResolver; import org.jboss.as.controller.extension.ExtensionRegistry; +import org.jboss.as.controller.operations.common.ProcessEnvironment; import org.jboss.as.controller.persistence.ExtensibleConfigurationPersister; import org.jboss.as.controller.persistence.NullConfigurationPersister; import org.jboss.as.controller.registry.ManagementResourceRegistration; @@ -80,6 +81,7 @@ import org.jboss.as.server.controller.resources.VersionModelInitializer; import org.jboss.as.server.suspend.SuspendController; import org.jboss.as.version.ProductConfig; +import org.jboss.as.version.Stability; import org.jboss.as.version.Version; import org.jboss.dmr.ModelNode; import org.jboss.msc.service.StartContext; @@ -102,6 +104,7 @@ class TestModelControllerService extends ModelTestModelControllerService { private final ControlledProcessState processState; private final ExtensionRegistry extensionRegistry; private final CapabilityRegistry capabilityRegistry; + private final Stability stability; private volatile Initializer initializer; TestModelControllerService(ProcessType processType, RunningModeControl runningModeControl, StringConfigurationPersister persister, ModelTestOperationValidatorFilter validateOpsFilter, @@ -110,6 +113,7 @@ class TestModelControllerService extends ModelTestModelControllerService { super(processType, extensionRegistry.getStability(), runningModeControl, null, persister, validateOpsFilter, rootResourceDefinition, processState, expressionResolver, capabilityRegistry); this.type = type; + this.stability = extensionRegistry.getStability(); this.runningModeControl = runningModeControl; this.pathManagerService = type == TestModelType.STANDALONE ? new ServerPathManagerService(capabilityRegistry) : new HostPathManagerService(capabilityRegistry); this.modelInitializer = modelInitializer; @@ -191,13 +195,15 @@ private ServerEnvironment createStandaloneServerEnvironment() { throw new RuntimeException(e); } props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml"); - ProductConfig pc = new ProductConfig("Test", Version.AS_VERSION, "main"); - return new ServerEnvironment(null, props, new HashMap(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), pc, false); + props.put(ProcessEnvironment.STABILITY, this.stability.toString()); + + ProductConfig productConfig = new ProductConfig("Standalone-under-test", Version.AS_VERSION, "main", this.stability); + return new ServerEnvironment(null, props, new HashMap<>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), productConfig, false); } private HostControllerEnvironment createHostControllerEnvironment() { try { - Map props = new HashMap(); + Map props = new HashMap<>(); File home = new File("target/jbossas"); delete(home); home.mkdir(); @@ -230,7 +236,11 @@ private HostControllerEnvironment createHostControllerEnvironment() { RunningMode initialRunningMode = runningModeControl.getRunningMode(); boolean backupDomainFiles = false; boolean useCachedDc = false; - ProductConfig productConfig = ProductConfig.fromFilesystemSlot(null, "", props); + + props.put(ProcessEnvironment.STABILITY, this.stability.toString()); + + ProductConfig productConfig = new ProductConfig("HostController-under-test", Version.AS_VERSION, "main", this.stability); + return new HostControllerEnvironment(props, isRestart, modulePath, processControllerAddress, processControllerPort, hostControllerAddress, hostControllerPort, defaultJVM, domainConfig, initialDomainConfig, hostConfig, initialHostConfig, initialRunningMode, backupDomainFiles, useCachedDc, productConfig); diff --git a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/util/TransformersTestParameter.java b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/util/TransformersTestParameter.java index 9c1136da48a..b59c4245124 100644 --- a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/util/TransformersTestParameter.java +++ b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/util/TransformersTestParameter.java @@ -46,6 +46,8 @@ public static List setupVersions(){ //we only test EAP 7.4 and newer data.add(new TransformersTestParameter(ModelVersion.create(16, 0, 0), ModelTestControllerVersion.EAP_7_4_0)); data.add(new TransformersTestParameter(ModelVersion.create(22, 0, 0), ModelTestControllerVersion.EAP_8_0_0)); + // Requires an update of the wildfly legacy test version + // data.add(new TransformersTestParameter(ModelVersion.create(24, 0, 0), ModelTestControllerVersion.WILDFLY_31_0_0)); return data; } diff --git a/elytron/src/test/java/org/wildfly/extension/elytron/SubsystemTransformerTestCase.java b/elytron/src/test/java/org/wildfly/extension/elytron/SubsystemTransformerTestCase.java index 44d327b8ce2..5e0724c5f60 100644 --- a/elytron/src/test/java/org/wildfly/extension/elytron/SubsystemTransformerTestCase.java +++ b/elytron/src/test/java/org/wildfly/extension/elytron/SubsystemTransformerTestCase.java @@ -111,9 +111,11 @@ public void testTransformerEAP800() throws Exception { } private KernelServices buildKernelServices(String xml, ModelTestControllerVersion controllerVersion, ModelVersion version, String... mavenResourceURLs) throws Exception { - KernelServicesBuilder builder = this.createKernelServicesBuilder(AdditionalInitialization.MANAGEMENT).setSubsystemXml(xml); + AdditionalInitialization additionalInitialization = AdditionalInitialization.fromModelTestControllerVersion(controllerVersion); - builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, version) + KernelServicesBuilder builder = this.createKernelServicesBuilder(additionalInitialization).setSubsystemXml(xml); + + builder.createLegacyKernelServicesBuilder(additionalInitialization, controllerVersion, version) .addMavenResourceURL(mavenResourceURLs) .skipReverseControllerCheck() .addParentFirstClassPattern("org.jboss.as.controller.logging.ControllerLogger*") @@ -151,8 +153,8 @@ private void testRejectingTransformers(ModelTestControllerVersion controllerVers ModelVersion elytronVersion = controllerVersion.getSubsystemModelVersion(getMainSubsystemName()); //Boot up empty controllers with the resources needed for the ops coming from the xml to work - KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.withCapabilities( - RuntimeCapability.buildDynamicCapabilityName(Capabilities.DATA_SOURCE_CAPABILITY_NAME, "ExampleDS") + KernelServicesBuilder builder = createKernelServicesBuilder(AdditionalInitialization.withCapabilities(controllerVersion.getStability(), + RuntimeCapability.buildDynamicCapabilityName(Capabilities.DATA_SOURCE_CAPABILITY_NAME, "ExampleDS") )); builder.createLegacyKernelServicesBuilder(AdditionalInitialization.MANAGEMENT, controllerVersion, elytronVersion) .addMavenResourceURL(controllerVersion.getCoreMavenGroupId() + ":wildfly-elytron-integration:" + controllerVersion.getCoreVersion()) diff --git a/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java b/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java index 8919d5cea93..d58f019aa35 100644 --- a/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java +++ b/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java @@ -9,19 +9,25 @@ import java.util.Properties; import org.jboss.as.controller.ModelVersion; +import org.jboss.as.version.Stability; import org.wildfly.legacy.version.LegacyVersions; +/** + * Represents the versions of the legacy controllers that are available for testing. + */ public enum ModelTestControllerVersion { - //AS releases - + // Release version under test MASTER (CurrentVersion.VERSION, false, null, "master" ), //EAP releases EAP_7_4_0("7.4.0.GA-redhat-00005", true, "23.0.0", "15.0.2.Final-redhat-00001", "7.4.0"), EAP_8_0_0("8.0.0.GA-redhat-00011", true, "29.0.0", "21.0.5.Final-redhat-00001", "8.0.0"), EAP_XP_4("4.0.0.GA-redhat-00003", true, "23.0.0", "15.0.26.Final-redhat-00001", "xp4"), - EAP_XP_5("5.0.0.GA-redhat-00005", true, "29.0.0", "21.0.5.Final-redhat-00001", "xp5"); + EAP_XP_5("5.0.0.GA-redhat-00005", true, "29.0.0", "21.0.5.Final-redhat-00001", "xp5"), + + //WildFly releases + WILDFLY_31_0_0("31.0.0.Final", false, "31.0.0", "23.0.1.Final", "wf31"); private final String mavenGavVersion; private final String testControllerVersion; @@ -35,6 +41,7 @@ public enum ModelTestControllerVersion { private final String realVersionName; private final String artifactIdPrefix; private final Map subsystemModelVersions = new LinkedHashMap<>(); + private final Stability stability; ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String realVersionName) { this(mavenGavVersion, eap, testControllerVersion, null, realVersionName); @@ -44,6 +51,7 @@ public enum ModelTestControllerVersion { this.mavenGavVersion = mavenGavVersion; this.testControllerVersion = testControllerVersion; this.eap = eap; + this.stability = eap ? Stability.DEFAULT : Stability.COMMUNITY; this.validLegacyController = testControllerVersion != null; this.coreVersion = coreVersion == null? mavenGavVersion : coreVersion; //full == core this.realVersionName = realVersionName; @@ -159,4 +167,7 @@ public String getMavenGav(String artifactIdPart, boolean coreArtifact) { } + public Stability getStability() { + return stability; + } } diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java index 2c2005c5636..64dd15f86a2 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/impl/ChildFirstClassLoaderKernelServicesFactory.java @@ -5,6 +5,7 @@ package org.jboss.as.subsystem.bridge.impl; import java.util.List; +import java.util.Objects; import org.jboss.as.controller.Extension; import org.jboss.as.controller.ModelVersion; @@ -18,6 +19,7 @@ import org.jboss.as.subsystem.test.AdditionalInitialization; import org.jboss.as.subsystem.test.KernelServices; import org.jboss.as.subsystem.test.TestParser; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; /** @@ -40,4 +42,23 @@ public static KernelServices create(String mainSubsystemName, String extensionCl return AbstractKernelServicesImpl.create(null, mainSubsystemName, additionalInit, validateOpsFilter, extensionRegistry, bootOperations, testParser, extension, legacyModelVersion, false, persistXml); } + + public static KernelServices create(String mainSubsystemName, String extensionClassName, AdditionalInitialization additionalInit, ModelTestOperationValidatorFilter validateOpsFilter, + List bootOperations, ModelVersion legacyModelVersion, boolean persistXml, String stabilityStr) throws Exception { + Objects.requireNonNull(additionalInit,"additionalInit is required"); + Stability stability = Stability.fromString(stabilityStr); + + Extension extension = (Extension) Class.forName(extensionClassName) + .getDeclaredConstructor() + .newInstance(); + + ExtensionRegistry extensionRegistry = ExtensionRegistry.builder(ProcessType.DOMAIN_SERVER) + .withRunningMode(RunningMode.ADMIN_ONLY) + .withStability(stability) + .build(); + + ModelTestParser testParser = new TestParser(mainSubsystemName, extensionRegistry); + return AbstractKernelServicesImpl.create(null, mainSubsystemName, additionalInit, validateOpsFilter, + extensionRegistry, bootOperations, testParser, extension, legacyModelVersion, false, persistXml); + } } diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/local/ScopedKernelServicesBootstrap.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/local/ScopedKernelServicesBootstrap.java index 32f2ff49f49..74b576aaedb 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/local/ScopedKernelServicesBootstrap.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/bridge/local/ScopedKernelServicesBootstrap.java @@ -14,6 +14,7 @@ import org.jboss.as.subsystem.bridge.impl.ClassLoaderObjectConverterImpl; import org.jboss.as.subsystem.bridge.impl.LegacyControllerKernelServicesProxy; import org.jboss.as.subsystem.test.AdditionalInitialization; +import org.jboss.as.version.Stability; import org.jboss.dmr.ModelNode; /** @@ -38,37 +39,68 @@ public LegacyControllerKernelServicesProxy createKernelServices(String mainSubsy } private Object createChildClassLoaderKernelServices(String mainSubsystemName, String extensionClassName, AdditionalInitialization additionalInit, ModelTestOperationValidatorFilter validateOpsFilter, - List bootOperations, ModelVersion legacyModelVersion, boolean persistXml){ + List bootOperations, ModelVersion legacyModelVersion, boolean persistXml) { try { + Stability stability = additionalInit.getStability(); Class clazz = legacyChildFirstClassLoader.loadClass(ChildFirstClassLoaderKernelServicesFactory.class.getName()); - Method m = clazz.getMethod("create", - String.class, - String.class, - legacyChildFirstClassLoader.loadClass(AdditionalInitialization.class.getName()), - legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), - List.class, - legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), - Boolean.TYPE); + List convertedBootOps = getConvertedBootOps(bootOperations); - List convertedBootOps = new ArrayList(); - for (int i = 0 ; i < bootOperations.size() ; i++) { - ModelNode node = bootOperations.get(i); - if (node != null) { - convertedBootOps.add(objectConverter.convertModelNodeToChildCl(node)); - } - } - - //Convert additional Init Object convertedAdditionalInit = objectConverter.convertAdditionalInitializationToChildCl(additionalInit); Object convertedModelVersion = objectConverter.convertModelVersionToChildCl(legacyModelVersion); Object convertedValidateOpsFilter = objectConverter.convertValidateOperationsFilterToChildCl(validateOpsFilter); + if (!Stability.DEFAULT.equals(stability)) { + Method m = clazz.getMethod("create", + String.class, + String.class, + legacyChildFirstClassLoader.loadClass(AdditionalInitialization.class.getName()), + legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), + List.class, + legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), + Boolean.TYPE, + String.class); - return m.invoke(null, mainSubsystemName, extensionClassName, convertedAdditionalInit, convertedValidateOpsFilter, convertedBootOps, convertedModelVersion, persistXml); + return m.invoke(null, + mainSubsystemName, + extensionClassName, + convertedAdditionalInit, + convertedValidateOpsFilter, + convertedBootOps, + convertedModelVersion, + persistXml, + stability.toString()); + } else { + Method m = clazz.getMethod("create", + String.class, + String.class, + legacyChildFirstClassLoader.loadClass(AdditionalInitialization.class.getName()), + legacyChildFirstClassLoader.loadClass(ModelTestOperationValidatorFilter.class.getName()), + List.class, + legacyChildFirstClassLoader.loadClass(ModelVersion.class.getName()), + Boolean.TYPE); + return m.invoke(null, + mainSubsystemName, + extensionClassName, + convertedAdditionalInit, + convertedValidateOpsFilter, + convertedBootOps, + convertedModelVersion, + persistXml); + } } catch (Exception e) { throw new RuntimeException(e); } } + + private List getConvertedBootOps(List bootOperations) { + List convertedBootOps = new ArrayList<>(); + for (ModelNode node : bootOperations) { + if (node != null) { + convertedBootOps.add(objectConverter.convertModelNodeToChildCl(node)); + } + } + return convertedBootOps; + } } 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..7859b31ba3c 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 @@ -18,6 +18,7 @@ import org.jboss.as.controller.extension.ExtensionRegistry; import org.jboss.as.controller.registry.ManagementResourceRegistration; import org.jboss.as.controller.registry.Resource; +import org.jboss.as.model.test.ModelTestControllerVersion; import org.jboss.as.model.test.ModelTestModelDescriptionValidator.AttributeOrParameterArbitraryDescriptorValidator; import org.jboss.as.subsystem.test.ModelDescriptionValidator.ValidationConfiguration; import org.jboss.as.version.Stability; @@ -76,6 +77,10 @@ public > ManagementAdditionalInitialization(S schem this(schema.getStability()); } + public ManagementAdditionalInitialization(ModelTestControllerVersion version) { + this(version.getStability()); + } + public ManagementAdditionalInitialization(Stability stability) { this.stability = stability; } @@ -110,6 +115,16 @@ protected ProcessType getProcessType() { } } + /** + * Creates a {@link org.jboss.as.subsystem.test.AdditionalInitialization.ManagementAdditionalInitialization} with + * the given {@link org.jboss.as.model.test.ModelTestControllerVersion version} stability level. + * + * @param version ModelTestController version + * @return the additional initialization + */ + public static AdditionalInitialization fromModelTestControllerVersion(ModelTestControllerVersion version) { + return new ManagementAdditionalInitialization(version); + } /** * Creates a {@link org.jboss.as.subsystem.test.AdditionalInitialization.ManagementAdditionalInitialization} with @@ -131,6 +146,27 @@ protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegis }; } + /** + * 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 desired stability level of the installed controller + * @param capabilities the capabilities + * @return the additional initialization + */ + public static AdditionalInitialization withCapabilities(final Stability stability, final String... capabilities) { + return new ManagementAdditionalInitialization(stability) { + + @Override + protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) { + super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry); + registerCapabilities(capabilityRegistry, 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 diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java index f684dd98544..cb1cbbd3190 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java @@ -114,7 +114,7 @@ final class SubsystemTestDelegate { private final Class testClass; private final List kernelServices = new ArrayList<>(); - protected final String mainSubsystemName; + private final String mainSubsystemName; private final Extension mainExtension; private final Comparator removeOrderComparator; @@ -222,11 +222,14 @@ String outputModel(ModelNode model) throws Exception { // Use ProcessType.HOST_CONTROLLER for this ExtensionRegistry so we don't need to provide // a PathManager via the ExtensionContext. All we need the Extension to do here is register the xml writers - ExtensionRegistry outputExtensionRegistry = ExtensionRegistry.builder(ProcessType.HOST_CONTROLLER).withStability(this.stability).build(); + ExtensionRegistry outputExtensionRegistry = ExtensionRegistry.builder(ProcessType.HOST_CONTROLLER) + .withStability(this.stability) + .build(); + outputExtensionRegistry.setWriterRegistry(persister); - Extension extension = mainExtension.getClass().newInstance(); - extension.initialize(outputExtensionRegistry.getExtensionContext("Test", MOCK_RESOURCE_REG, ExtensionRegistryType.SLAVE)); + Extension extension = mainExtension.getClass().getDeclaredConstructor().newInstance(); + extension.initialize(outputExtensionRegistry.getExtensionContext("Test", stability, MOCK_RESOURCE_REG, ExtensionRegistryType.SLAVE)); ConfigurationPersister.PersistenceResource resource = persister.store(model, Collections.emptySet()); resource.commit(); @@ -254,7 +257,7 @@ ProcessType getProcessType() { } /** - * Checks that the subystem resources can be removed, i.e. that people have registered + * Checks that the subsystem resources can be removed, i.e. that people have registered * working 'remove' operations for every 'add' level. * * @param kernelServices the kernel services used to access the controller @@ -264,7 +267,7 @@ void assertRemoveSubsystemResources(KernelServices kernelServices) { } /** - * Checks that the subystem resources can be removed, i.e. that people have registered + * Checks that the subsystem resources can be removed, i.e. that people have registered * working 'remove' operations for every 'add' level. * * @param kernelServices the kernel services used to access the controller @@ -430,7 +433,11 @@ void addAdditionalParsers(AdditionalParsers additionalParsers) { } private ExtensionRegistry cloneExtensionRegistry(AdditionalInitialization additionalInit) { - final ExtensionRegistry clone = ExtensionRegistry.builder(additionalInit.getProcessType()).withRunningMode(additionalInit.getExtensionRegistryRunningMode()).withStability(additionalInit.getStability()).build(); + final ExtensionRegistry clone = ExtensionRegistry.builder(additionalInit.getProcessType()) + .withRunningMode(additionalInit.getExtensionRegistryRunningMode()) + .withStability(additionalInit.getStability()) + .build(); + for (String extension : extensionParsingRegistry.getExtensionModuleNames()) { ExtensionParsingContext epc = clone.getExtensionParsingContext(extension, null); for (Map.Entry entry : extensionParsingRegistry.getAvailableSubsystems(extension).entrySet()) { @@ -546,7 +553,7 @@ public KernelServices build() throws Exception { bootOperationBuilder.validateNotAlreadyBuilt(); List bootOperations = bootOperationBuilder.build(); AbstractKernelServicesImpl kernelServices = AbstractKernelServicesImpl.create(testClass, mainSubsystemName, additionalInit, ModelTestOperationValidatorFilter.createValidateAll(), cloneExtensionRegistry(additionalInit), bootOperations, - testParser, mainExtension, null, legacyControllerInitializers.size() > 0, true); + testParser, mainExtension, null, !legacyControllerInitializers.isEmpty(), true); SubsystemTestDelegate.this.kernelServices.add(kernelServices); validateDescriptionProviders(additionalInit, kernelServices); ImmutableManagementResourceRegistration subsystemReg = kernelServices.getRootRegistration().getSubModel(PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, mainSubsystemName))); @@ -559,7 +566,7 @@ public KernelServices build() throws Exception { for (Map.Entry entry : legacyControllerInitializers.entrySet()) { LegacyKernelServiceInitializerImpl legacyInitializer = entry.getValue(); - List transformedBootOperations = new ArrayList(); + List transformedBootOperations = new ArrayList<>(); for (ModelNode op : bootOperations) { TransformedOperation transformedOp = kernelServices.transformOperation(entry.getKey(), op); @@ -619,8 +626,8 @@ private class LegacyKernelServiceInitializerImpl implements LegacyKernelServices private final AdditionalInitialization additionalInit; private final ModelTestControllerVersion testControllerVersion; private String extensionClassName; - private ModelVersion modelVersion; - private ChildFirstClassLoaderBuilder classLoaderBuilder; + private final ModelVersion modelVersion; + private final ChildFirstClassLoaderBuilder classLoaderBuilder; private ModelTestOperationValidatorFilter.Builder operationValidationExcludeBuilder; private boolean persistXml = true; private boolean skipReverseCheck; diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/TestModelControllerService.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/TestModelControllerService.java index bcc0f189cc9..457e3c8283e 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/TestModelControllerService.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/TestModelControllerService.java @@ -44,6 +44,7 @@ import org.jboss.as.server.controller.resources.ServerDeploymentResourceDefinition; import org.jboss.as.subsystem.test.ControllerInitializer.TestControllerAccessor; import org.jboss.as.version.ProductConfig; +import org.jboss.as.version.Version; import org.jboss.dmr.ModelNode; import org.jboss.vfs.VirtualFile; @@ -65,9 +66,11 @@ protected TestModelControllerService(final Extension mainExtension, final Contro final ExtensionRegistry extensionRegistry, final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers, final ExpressionResolver expressionResolver, final CapabilityRegistry capabilityRegistry) { - super(additionalInit.getProcessType(), additionalInit.getStability(), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter, + + super(additionalInit.getProcessType(), additionalInit.getStability(), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter, ResourceDefinition.builder(ResourceRegistration.of(null, additionalInit.getStability()), NonResolvingResourceDescriptionResolver.INSTANCE).build(), expressionResolver, new ControlledProcessState(true),capabilityRegistry); + this.mainExtension = mainExtension; this.additionalInit = additionalInit; this.controllerInitializer = controllerInitializer; @@ -126,7 +129,7 @@ private void initExtraModelInternal(Resource rootResource, ManagementResourceReg @Override protected void preBoot(List bootOperations, boolean rollbackOnRuntimeFailure) { - mainExtension.initialize(extensionRegistry.getExtensionContext("Test", getRootRegistration(), + mainExtension.initialize(extensionRegistry.getExtensionContext("Test", this.stability, getRootRegistration(), registerTransformers ? ExtensionRegistryType.MASTER : ExtensionRegistryType.SLAVE)); } @@ -145,7 +148,6 @@ private void delete(File file) { @Override public ServerEnvironment getServerEnvironment() { - ProductConfig productConfig = new ProductConfig(null, null, null); Properties props = new Properties(); File home = new File("target/jbossas"); delete(home); @@ -167,8 +169,9 @@ public ServerEnvironment getServerEnvironment() { throw new RuntimeException(e); } props.put(ServerEnvironment.JBOSS_SERVER_DEFAULT_CONFIG, "standalone.xml"); - props.put(ProcessEnvironment.STABILITY, this.additionalInit.getStability().toString()); + props.put(ProcessEnvironment.STABILITY, this.stability.toString()); + ProductConfig productConfig = new ProductConfig("Standalone-under-test", Version.AS_VERSION, "main", this.stability); return new ServerEnvironment(null, props, new HashMap<>(), "standalone.xml", null, LaunchType.STANDALONE, runningModeControl.getRunningMode(), productConfig, false); } diff --git a/version/src/main/java/org/jboss/as/version/ProductConfig.java b/version/src/main/java/org/jboss/as/version/ProductConfig.java index 76ee682dde7..b6b53057f57 100644 --- a/version/src/main/java/org/jboss/as/version/ProductConfig.java +++ b/version/src/main/java/org/jboss/as/version/ProductConfig.java @@ -148,10 +148,15 @@ private static ProductConfProps getProductConfProperties(String home) { /** Solely for use in unit testing */ public ProductConfig(final String productName, final String productVersion, final String consoleSlot) { + this(productName, productVersion, consoleSlot, Stability.DEFAULT); + } + + /** Solely for use in unit testing */ + public ProductConfig(final String productName, final String productVersion, final String consoleSlot, final Stability defaultStability) { this.name = productName; this.version = productVersion; this.consoleSlot = consoleSlot; - this.defaultStability = Stability.COMMUNITY; + this.defaultStability = defaultStability; this.stabilities = EnumSet.allOf(Stability.class).stream() .filter(this.defaultStability::enables) .collect(Collectors.toUnmodifiableSet()); From abea9d24cb9e0dbcade312ab50928d2ee96881e5 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Sun, 15 Dec 2024 18:50:11 +0000 Subject: [PATCH 08/11] [WFCORE-7091] Add the ability to ignore tests using the ModelTestControllerVersion --- .../as/core/model/test/CoreModelTestDelegate.java | 2 ++ .../DomainDeploymentTransformersTestCase.java | 11 +++++++++-- .../as/model/test/ModelTestControllerVersion.java | 10 +++++++++- .../as/subsystem/test/SubsystemTestDelegate.java | 3 +++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java index b752e9c69ff..567cb927b22 100644 --- a/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java +++ b/core-model-test/framework/src/main/java/org/jboss/as/core/model/test/CoreModelTestDelegate.java @@ -94,6 +94,7 @@ import org.jboss.dmr.Property; import org.jboss.staxmapper.XMLMapper; import org.junit.Assert; +import org.junit.Assume; import org.wildfly.common.xml.XMLInputFactoryUtil; import org.wildfly.legacy.test.spi.Version; @@ -691,6 +692,7 @@ private class LegacyKernelServicesInitializerImpl implements LegacyKernelService private ModelTestOperationValidatorFilter.Builder operationValidationExcludeFilterBuilder; LegacyKernelServicesInitializerImpl(ModelVersion modelVersion, ModelTestControllerVersion version) { + Assume.assumeFalse("This model controller version is ignored for this server.", version.isIgnored()); this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.modelVersion = modelVersion; this.testControllerVersion = version; diff --git a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/deployment/DomainDeploymentTransformersTestCase.java b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/deployment/DomainDeploymentTransformersTestCase.java index 2683a37bdfc..32c397c3f73 100644 --- a/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/deployment/DomainDeploymentTransformersTestCase.java +++ b/core-model-test/tests/src/test/java/org/jboss/as/core/model/test/deployment/DomainDeploymentTransformersTestCase.java @@ -30,6 +30,7 @@ import org.jboss.as.model.test.ModelTestUtils; import org.jboss.dmr.ModelNode; import org.junit.Assert; +import org.junit.AssumptionViolatedException; import org.junit.Test; import org.junit.runner.RunWith; @@ -66,6 +67,9 @@ public void domainDeployment() throws Exception { KernelServices legacyServices = mainServices.getLegacyServices(modelVersion); Assert.assertTrue("Legacy services didn't boot for version " + modelVersion, legacyServices.isSuccessfulBoot()); checkCoreModelTransformation(mainServices, modelVersion); + } catch (AssumptionViolatedException ex) { + // If the test is ignored, we want to propagate the exception + throw ex; } catch (Exception ex) { throw new RuntimeException("Error for version " + modelVersion + " " + ex.getMessage(), ex); } @@ -86,10 +90,13 @@ public void domainExplodedDeployment() throws Exception { List operations = builder.parseXmlResource("domain-exploded-deployments.xml"); //removing the ading of "management-client-content" => "rollout-plans - operations = operations.subList(0, operations.size() -2); + operations = operations.subList(0, operations.size() - 2); ModelTestUtils.checkFailedTransformedBootOperations(mainServices, modelVersion, operations, getConfig()); + } catch (AssumptionViolatedException ex) { + // If the test is ignored, we want to propagate the exception + throw ex; } catch (Exception ex) { - throw new RuntimeException("Error for version " + modelVersion + " " + ex.getMessage(), ex); + throw new Exception("Error for version " + modelVersion + " " + ex.getMessage(), ex); } } diff --git a/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java b/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java index d58f019aa35..78064b26553 100644 --- a/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java +++ b/model-test/src/main/java/org/jboss/as/model/test/ModelTestControllerVersion.java @@ -42,12 +42,15 @@ public enum ModelTestControllerVersion { private final String artifactIdPrefix; private final Map subsystemModelVersions = new LinkedHashMap<>(); private final Stability stability; + private final boolean ignored; ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String realVersionName) { this(mavenGavVersion, eap, testControllerVersion, null, realVersionName); } - ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String coreVersion, String realVersionName) { + this(mavenGavVersion, eap, testControllerVersion, coreVersion, realVersionName, false); + } + ModelTestControllerVersion(String mavenGavVersion, boolean eap, String testControllerVersion, String coreVersion, String realVersionName, boolean ignored) { this.mavenGavVersion = mavenGavVersion; this.testControllerVersion = testControllerVersion; this.eap = eap; @@ -55,6 +58,7 @@ public enum ModelTestControllerVersion { this.validLegacyController = testControllerVersion != null; this.coreVersion = coreVersion == null? mavenGavVersion : coreVersion; //full == core this.realVersionName = realVersionName; + this.ignored = ignored; if (eap) { if (coreVersion != null) { //eap 7+ has core version defined this.coreMavenGroupId = "org.wildfly.core"; @@ -170,4 +174,8 @@ public String getMavenGav(String artifactIdPart, boolean coreArtifact) { public Stability getStability() { return stability; } + + public boolean isIgnored() { + return ignored; + } } diff --git a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java index cb1cbbd3190..a8e90b7c73c 100644 --- a/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java +++ b/subsystem-test/framework/src/main/java/org/jboss/as/subsystem/test/SubsystemTestDelegate.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.ServiceLoader; import java.util.Set; + import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -550,6 +551,7 @@ public LegacyKernelServicesInitializer createLegacyKernelServicesBuilder(Additio } public KernelServices build() throws Exception { + bootOperationBuilder.validateNotAlreadyBuilt(); List bootOperations = bootOperationBuilder.build(); AbstractKernelServicesImpl kernelServices = AbstractKernelServicesImpl.create(testClass, mainSubsystemName, additionalInit, ModelTestOperationValidatorFilter.createValidateAll(), cloneExtensionRegistry(additionalInit), bootOperations, @@ -636,6 +638,7 @@ private class LegacyKernelServiceInitializerImpl implements LegacyKernelServices private OperationFixer reverseCheckOperationFixer = operation -> operation; public LegacyKernelServiceInitializerImpl(AdditionalInitialization additionalInit, ModelTestControllerVersion version, ModelVersion modelVersion) { + Assume.assumeFalse("This model controller version is ignored for this server.", version.isIgnored()); this.classLoaderBuilder = new ChildFirstClassLoaderBuilder(version.isEap()); this.additionalInit = additionalInit == null ? AdditionalInitialization.MANAGEMENT : additionalInit; this.testControllerVersion = version; From cd0f508662d424ad324eefc812861f31ff50db0c Mon Sep 17 00:00:00 2001 From: lvydra Date: Fri, 13 Dec 2024 12:48:40 +0100 Subject: [PATCH 09/11] [WFCORE-3720] Update ServiceModuleLoader to use non-deprecated JBoss Modules APIs --- .../DeploymentListModulesHandler.java | 2 +- .../module/ManifestDependencyProcessor.java | 2 +- .../module/ModuleExtensionListProcessor.java | 4 +- .../module/ModuleSpecProcessor.java | 6 +- .../DeploymentStructureDescriptorParser.java | 2 +- .../jboss/as/server/logging/ServerLogger.java | 2 +- .../moduleservice/ExtensionIndexService.java | 2 +- .../moduleservice/ExternalModuleService.java | 2 +- .../ExternalModuleSpecService.java | 2 +- .../moduleservice/ModuleLoadService.java | 6 +- .../ModuleResolvePhaseService.java | 10 +-- .../moduleservice/ServiceModuleLoader.java | 87 +++++++++++++++++-- 12 files changed, 101 insertions(+), 26 deletions(-) diff --git a/server/src/main/java/org/jboss/as/server/deployment/DeploymentListModulesHandler.java b/server/src/main/java/org/jboss/as/server/deployment/DeploymentListModulesHandler.java index b6e23b98048..e201677457f 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/DeploymentListModulesHandler.java +++ b/server/src/main/java/org/jboss/as/server/deployment/DeploymentListModulesHandler.java @@ -74,7 +74,7 @@ public void execute(OperationContext context, ModelNode operation) { moduleIdentifier = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER); } - final ServiceController moduleLoadServiceController = sr.getService(ServiceModuleLoader.moduleServiceName(moduleIdentifier)); + final ServiceController moduleLoadServiceController = sr.getService(ServiceModuleLoader.moduleServiceName(moduleIdentifier.toString())); final ModuleLoadService moduleLoadService = (ModuleLoadService) moduleLoadServiceController.getService(); final ModelNode result = new ModelNode(); diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/ManifestDependencyProcessor.java b/server/src/main/java/org/jboss/as/server/deployment/module/ManifestDependencyProcessor.java index e7ad03b1c39..824ab7bff7a 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/ManifestDependencyProcessor.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/ManifestDependencyProcessor.java @@ -100,7 +100,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_ANNOTATION_INDEXES, dependencyId); if(dependencyLoader == deploymentModuleLoader && !additionalModules.contains(dependencyId)) { //additional modules will not be created till much later, a dep on them would fail - phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(dependencyId)); + phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(dependencyId.toString())); } } diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleExtensionListProcessor.java b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleExtensionListProcessor.java index 59f82d70b80..ea39967a3ce 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleExtensionListProcessor.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleExtensionListProcessor.java @@ -88,7 +88,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU dependency.addImportFilter(PathFilters.getMetaInfSubdirectoriesFilter(), true); dependency.addImportFilter(PathFilters.getMetaInfFilter(), true); moduleSpecification.addLocalDependency(dependency); - nextPhaseDeps.add(ServiceModuleLoader.moduleSpecServiceName(extension)); + nextPhaseDeps.add(ServiceModuleLoader.moduleSpecServiceName(extension.toString())); } @@ -107,7 +107,7 @@ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentU if (extension != null) { moduleSpecification.addLocalDependency(new ModuleDependency(moduleLoader, extension, false, false, true, false)); - nextPhaseDeps.add(ServiceModuleLoader.moduleSpecServiceName(extension)); + nextPhaseDeps.add(ServiceModuleLoader.moduleSpecServiceName(extension.toString())); } else { ServerLogger.DEPLOYMENT_LOGGER.cannotFindExtensionListEntry(entry, resourceRoot); } diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java index 0fb3412c7cc..bfa770126f9 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecProcessor.java @@ -123,7 +123,7 @@ private void deployModuleSpec(final DeploymentPhaseContext phaseContext) throws for (final DeploymentUnit subDeployment : deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS)) { ModuleIdentifier moduleId = subDeployment.getAttachment(Attachments.MODULE_IDENTIFIER); if (moduleId != null) { - phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleSpecServiceName(moduleId)); + phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleSpecServiceName(moduleId.toString())); } } @@ -260,7 +260,7 @@ private ServiceName createModuleService(final DeploymentPhaseContext phaseContex specBuilder.setClassFileTransformer(delegatingClassTransformer); deploymentUnit.putAttachment(DelegatingClassTransformer.ATTACHMENT_KEY, delegatingClassTransformer); final ModuleSpec moduleSpec = specBuilder.create(); - final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(moduleIdentifier); + final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(moduleIdentifier.toString()); ModuleDefinition moduleDefinition = new ModuleDefinition(moduleIdentifier, new HashSet<>(moduleSpecification.getAllDependencies()), moduleSpec); @@ -282,7 +282,7 @@ private void installAliases(final ModuleSpecification moduleSpecification, final ModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER); for (final String aliasName : moduleSpecification.getModuleAliases()) { final ModuleIdentifier alias = ModuleIdentifier.fromString(aliasName); - final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(alias); + final ServiceName moduleSpecServiceName = ServiceModuleLoader.moduleSpecServiceName(alias.toString()); final ModuleSpec spec = ModuleSpec.buildAlias(aliasName, moduleIdentifier.getName()).create(); HashSet dependencies = new HashSet<>(moduleSpecification.getAllDependencies()); diff --git a/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java b/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java index cd929f646b6..b636c6558c0 100644 --- a/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java +++ b/server/src/main/java/org/jboss/as/server/deployment/module/descriptor/DeploymentStructureDescriptorParser.java @@ -288,7 +288,7 @@ private void handleDeployment(final DeploymentPhaseContext phaseContext, final D // additional modules will not be created till much later, a dep on them would fail if (identifier.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX) && !(additionalModules.containsKey(identifier) || isSubdeployment(identifier, deploymentUnit))) { - phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(identifier)); + phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, ServiceModuleLoader.moduleServiceName(identifier.toString())); } } moduleSpec.setLocalLast(rootDeploymentSpecification.isLocalLast()); diff --git a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java index ff742703128..8d1394a897d 100644 --- a/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java +++ b/server/src/main/java/org/jboss/as/server/logging/ServerLogger.java @@ -733,7 +733,7 @@ public interface ServerLogger extends BasicLogger { IllegalStateException serviceModuleLoaderAlreadyStopped(); @Message(id = 99, value = "'%s' cannot be loaded from a ServiceModuleLoader as its name does not start with '%s'") - IllegalArgumentException missingModulePrefix(ModuleIdentifier identifier, String prefix); + IllegalArgumentException missingModulePrefix(String name, String prefix); @Message(id = 100, value = "Failed to read '%s'") DeploymentUnitProcessingException failedToReadVirtualFile(VirtualFile file, @Cause IOException cause); diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ExtensionIndexService.java b/server/src/main/java/org/jboss/as/server/moduleservice/ExtensionIndexService.java index 8b06a10a29a..effca26bd4f 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ExtensionIndexService.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ExtensionIndexService.java @@ -95,7 +95,7 @@ public boolean accept(final File file) { // now register a module spec service for this extension // this makes it available for loading ExternalModuleSpecService service = new ExternalModuleSpecService(moduleIdentifier, jar); - ServiceName serviceName = ServiceModuleLoader.moduleSpecServiceName(moduleIdentifier); + ServiceName serviceName = ServiceModuleLoader.moduleSpecServiceName(moduleIdentifier.toString()); ServiceBuilder sb = context.getChildTarget().addService(serviceName, service); sb.requires(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX); sb.setInitialMode(Mode.ON_DEMAND); diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleService.java b/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleService.java index 737d1241ccf..b4568e296c1 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleService.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleService.java @@ -56,7 +56,7 @@ public ModuleIdentifier addExternalModule(String moduleName, ServiceRegistry ser @Override public ModuleIdentifier addExternalModule(String moduleName, String path, ServiceRegistry serviceRegistry, ServiceTarget serviceTarget) { ModuleIdentifier identifier = ModuleIdentifier.fromString(EXTERNAL_MODULE_PREFIX + moduleName); - ServiceName serviceName = ServiceModuleLoader.moduleSpecServiceName(identifier); + ServiceName serviceName = ServiceModuleLoader.moduleSpecServiceName(identifier.toString()); ServiceController controller = serviceRegistry.getService(serviceName); if (controller == null) { ExternalModuleSpecService service = new ExternalModuleSpecService(identifier, new File(path)); diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleSpecService.java b/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleSpecService.java index 638ad17a01e..e7a2e143251 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleSpecService.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ExternalModuleSpecService.java @@ -112,7 +112,7 @@ public synchronized void start(StartContext context) throws StartException { this.moduleDefinition = new ModuleDefinition(moduleIdentifier, Collections.emptySet(), moduleSpec); - ServiceModuleLoader.installModuleResolvedService(context.getChildTarget(), moduleIdentifier); + ServiceModuleLoader.installModuleResolvedService(context.getChildTarget(), moduleIdentifier.toString()); } @Override diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ModuleLoadService.java b/server/src/main/java/org/jboss/as/server/moduleservice/ModuleLoadService.java index 75ec2772b63..d42778c542a 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ModuleLoadService.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ModuleLoadService.java @@ -113,12 +113,12 @@ public Module getValue() throws IllegalStateException, IllegalArgumentException } private static ServiceName install(final ServiceTarget target, final ModuleIdentifier identifier, ModuleLoadService service) { - final ServiceName serviceName = ServiceModuleLoader.moduleServiceName(identifier); + final ServiceName serviceName = ServiceModuleLoader.moduleServiceName(identifier.toString()); final ServiceBuilder builder = target.addService(serviceName, service); builder.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ServiceModuleLoader.class, service.getServiceModuleLoader()); - builder.addDependency(ServiceModuleLoader.moduleSpecServiceName(identifier), ModuleDefinition.class, service.getModuleDefinitionInjectedValue()); - builder.requires(ServiceModuleLoader.moduleResolvedServiceName(identifier)); //don't attempt to load until all dependent module specs are up, even transitive ones + builder.addDependency(ServiceModuleLoader.moduleSpecServiceName(identifier.toString()), ModuleDefinition.class, service.getModuleDefinitionInjectedValue()); + builder.requires(ServiceModuleLoader.moduleResolvedServiceName(identifier.toString())); //don't attempt to load until all dependent module specs are up, even transitive ones builder.setInitialMode(Mode.ON_DEMAND); builder.install(); diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ModuleResolvePhaseService.java b/server/src/main/java/org/jboss/as/server/moduleservice/ModuleResolvePhaseService.java index cc40c63da90..4a5c72a771d 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ModuleResolvePhaseService.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ModuleResolvePhaseService.java @@ -65,7 +65,7 @@ public void start(final StartContext startContext) throws StartException { if (spec != null) { //this can happen for optional dependencies for (ModuleDependency dep : spec.getDependencies()) { if (dep.isOptional()) continue; // we don't care about optional dependencies - if (ServiceModuleLoader.isDynamicModule(dep.getIdentifier())) { + if (ServiceModuleLoader.isDynamicModule(dep.getIdentifier().toString())) { if (!alreadyResolvedModules.contains(dep.getIdentifier())) { nextAlreadySeen.add(dep.getIdentifier()); nextPhaseIdentifiers.add(dep); @@ -75,7 +75,7 @@ public void start(final StartContext startContext) throws StartException { } } if (nextPhaseIdentifiers.isEmpty()) { - ServiceModuleLoader.installModuleResolvedService(startContext.getChildTarget(), moduleIdentifier); + ServiceModuleLoader.installModuleResolvedService(startContext.getChildTarget(), moduleIdentifier.toString()); } else { installService(startContext.getChildTarget(), moduleIdentifier, phaseNumber + 1, nextPhaseIdentifiers, nextAlreadySeen); } @@ -92,7 +92,7 @@ private static void installService(final ServiceTarget serviceTarget, final Modu final ModuleResolvePhaseService nextPhaseService = new ModuleResolvePhaseService(moduleIdentifier, nextAlreadySeen, phaseNumber); ServiceBuilder builder = serviceTarget.addService(moduleSpecServiceName(moduleIdentifier, phaseNumber), nextPhaseService); for (ModuleDependency module : nextPhaseIdentifiers) { - builder.addDependency(ServiceModuleLoader.moduleSpecServiceName(module.getIdentifier()), ModuleDefinition.class, new Injector() { + builder.addDependency(ServiceModuleLoader.moduleSpecServiceName(module.getIdentifier().toString()), ModuleDefinition.class, new Injector() { ModuleDefinition definition; @@ -127,8 +127,8 @@ public Set getModuleSpecs() { } public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier, int phase) { - if (!ServiceModuleLoader.isDynamicModule(identifier)) { - throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, ServiceModuleLoader.MODULE_PREFIX); + if (!ServiceModuleLoader.isDynamicModule(identifier.toString())) { + throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier.toString(), ServiceModuleLoader.MODULE_PREFIX); } return SERVICE_NAME.append(identifier.getName()).append(identifier.getSlot()).append("" + phase); } diff --git a/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java b/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java index b5ba25ad026..ca0fbfad531 100644 --- a/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java +++ b/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java @@ -128,9 +128,19 @@ protected Module preloadModule(final String name) throws ModuleLoadException { } } + /** + * @deprecated Will be made protected in line with this method in the parent class Use {@link ServiceModuleLoader#findModule(String)} + */ + @Deprecated(forRemoval = true, since = "27.0.0") @SuppressWarnings("unchecked") @Override public ModuleSpec findModule(ModuleIdentifier identifier) throws ModuleLoadException { + return findModule(identifier.toString()); + } + + @SuppressWarnings("unchecked") + @Override + protected ModuleSpec findModule(String identifier) throws ModuleLoadException { ServiceController controller = (ServiceController) serviceContainer.getService(moduleSpecServiceName(identifier)); if (controller == null) { ServerLogger.MODULE_SERVICE_LOGGER.debugf("Could not load module '%s' as corresponding module spec service '%s' was not found", identifier, identifier); @@ -193,18 +203,42 @@ public static void addService(final ServiceTarget serviceTarget, final Bootstrap * * @param identifier The module identifier * @return The service name of the ModuleSpec service + * @deprecated Use {@link ServiceModuleLoader#moduleSpecServiceName(String)} */ + @Deprecated(forRemoval = true, since = "27.0.0") public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) { + return moduleSpecServiceName(identifier.toString()); + } + + /** + * Returns the corresponding ModuleSpec service name for the given module. + * + * @param identifier The module identifier string, method does not support non-canonized identifiers + * @return The service name of the ModuleSpec service + */ + public static ServiceName moduleSpecServiceName(String identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } - return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); + return MODULE_SPEC_SERVICE_PREFIX.append(identifier); } + /** + * @deprecated Use {@link ServiceModuleLoader#installModuleResolvedService(ServiceTarget, String)} + */ + @Deprecated(forRemoval = true, since = "27.0.0") public static void installModuleResolvedService(ServiceTarget serviceTarget, ModuleIdentifier identifier) { + installModuleResolvedService(serviceTarget, identifier.toString()); + } + + /** + * @param serviceTarget service target to use to install the service. Cannot be {@code null}. + * @param identifier The module identifier string, method does not support non-canonized identifiers + */ + public static void installModuleResolvedService(ServiceTarget serviceTarget, String identifier) { final ServiceName sn = ServiceModuleLoader.moduleResolvedServiceName(identifier); final ServiceBuilder sb = serviceTarget.addService(sn); - final Consumer moduleIdConsumer = sb.provides(sn); + final Consumer moduleIdConsumer = sb.provides(sn); sb.requires(moduleSpecServiceName(identifier)); final org.jboss.msc.Service resolvedService = org.jboss.msc.Service.newInstance(moduleIdConsumer, identifier); sb.setInstance(resolvedService); @@ -220,19 +254,48 @@ public static void installModuleResolvedService(ServiceTarget serviceTarget, Mod * * @param identifier The module identifier * @return The service name of the ModuleSpec service + * @deprecated Use {@link ServiceModuleLoader#moduleResolvedServiceName(String)} */ + @Deprecated(forRemoval = true, since = "27.0.0") public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) { + return moduleResolvedServiceName(identifier.toString()); + } + + /** + * Returns the corresponding module resolved service name for the given module. + * + * The module resolved service is basically a latch that prevents the module from being loaded + * until all the transitive dependencies that it depends upon have have their module spec services + * come up. + * + * @param identifier The module identifier string, method does not support non-canonized identifiers + * @return The service name of the ModuleSpec service + */ + public static ServiceName moduleResolvedServiceName(String identifier) { if (!isDynamicModule(identifier)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } - return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); + return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier); } /** * Returns true if the module identifier is a dynamic module that will be loaded by this module loader + * + * @deprecated Use {@link ServiceModuleLoader#isDynamicModule(String)} */ + @Deprecated(forRemoval = true, since = "27.0.0") public static boolean isDynamicModule(ModuleIdentifier identifier) { - return identifier.getName().startsWith(MODULE_PREFIX); + return isDynamicModule(identifier.toString()); + } + + /** + * Returns true if the module identifier is a dynamic module that will be loaded by this module loader + * + * @param identifier The module identifier string, method does not support non-canonized identifiers + * @return Whether the module identifier is a dynamic module + */ + public static boolean isDynamicModule(String identifier) { + return identifier.startsWith(MODULE_PREFIX); } /** @@ -240,11 +303,23 @@ public static boolean isDynamicModule(ModuleIdentifier identifier) { * * @param identifier The module identifier * @return The service name of the ModuleLoadService service + * @deprecated Use {@link ServiceModuleLoader#moduleServiceName(String)} */ + @Deprecated(forRemoval = true, since = "27.0.0") public static ServiceName moduleServiceName(ModuleIdentifier identifier) { - if (!identifier.getName().startsWith(MODULE_PREFIX)) { + return moduleServiceName(identifier.toString()); + } + + /** + * Returns the corresponding ModuleLoadService service name for the given module. + * + * @param identifier The module identifier string, method does not support non-canonized identifiers + * @return The service name of the ModuleLoadService service + */ + public static ServiceName moduleServiceName(String identifier) { + if (!identifier.startsWith(MODULE_PREFIX)) { throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX); } - return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot()); + return MODULE_SERVICE_PREFIX.append(identifier); } } From 8cbac037fa38438218f55be56ca5beb8870ba248 Mon Sep 17 00:00:00 2001 From: Yeray Borges Date: Mon, 16 Dec 2024 16:07:44 +0000 Subject: [PATCH 10/11] Prepare for the 27.0.0.Beta6 release --- bootable-jar/boot/pom.xml | 2 +- bootable-jar/pom.xml | 2 +- bootable-jar/runtime/pom.xml | 2 +- build/pom.xml | 2 +- cli/pom.xml | 2 +- component-matrix-builder/pom.xml | 2 +- controller-client/pom.xml | 2 +- controller/pom.xml | 2 +- core-feature-pack/channel/pom.xml | 2 +- core-feature-pack/common/pom.xml | 2 +- core-feature-pack/ee-10-api/pom.xml | 2 +- core-feature-pack/galleon-common/pom.xml | 2 +- core-feature-pack/galleon-feature-pack/pom.xml | 2 +- core-feature-pack/manifest/pom.xml | 2 +- core-feature-pack/pom.xml | 2 +- core-management/core-management-client/pom.xml | 2 +- core-management/core-management-subsystem/pom.xml | 2 +- core-management/pom.xml | 2 +- core-model-test/framework/pom.xml | 2 +- core-model-test/pom.xml | 2 +- core-model-test/test-controller-optional/pom.xml | 2 +- core-model-test/tests/pom.xml | 2 +- core-security/pom.xml | 2 +- deployment-repository/pom.xml | 2 +- deployment-scanner/pom.xml | 2 +- discovery/pom.xml | 2 +- dist/pom.xml | 2 +- domain-http/error-context/pom.xml | 2 +- domain-http/interface/pom.xml | 2 +- domain-http/pom.xml | 2 +- domain-management/pom.xml | 2 +- elytron-tool-wrapper/pom.xml | 2 +- elytron/pom.xml | 2 +- embedded/pom.xml | 2 +- event-logger/pom.xml | 2 +- host-controller/pom.xml | 2 +- installation-manager/pom.xml | 2 +- io/pom.xml | 2 +- io/spi/pom.xml | 2 +- io/subsystem/pom.xml | 2 +- io/tests/pom.xml | 2 +- jmx/pom.xml | 2 +- logging/pom.xml | 2 +- management-client-content/pom.xml | 2 +- model-test/pom.xml | 2 +- network/pom.xml | 2 +- patching/pom.xml | 2 +- platform-mbean/pom.xml | 2 +- pom.xml | 2 +- process-controller/pom.xml | 2 +- protocol/pom.xml | 2 +- remoting/pom.xml | 2 +- remoting/subsystem/pom.xml | 2 +- remoting/tests/pom.xml | 2 +- request-controller/pom.xml | 2 +- security-manager/pom.xml | 2 +- server/pom.xml | 2 +- service/pom.xml | 2 +- subsystem-test/framework/pom.xml | 2 +- subsystem-test/pom.xml | 2 +- subsystem-test/test-controller-optional/pom.xml | 2 +- subsystem-test/tests/pom.xml | 2 +- subsystem/pom.xml | 2 +- testbom/pom.xml | 2 +- testsuite/client-old-server/pom.xml | 2 +- testsuite/domain/pom.xml | 2 +- testsuite/elytron/pom.xml | 2 +- testsuite/embedded/pom.xml | 2 +- testsuite/layers/pom.xml | 2 +- testsuite/manualmode/pom.xml | 2 +- testsuite/pom.xml | 2 +- testsuite/rbac/pom.xml | 2 +- testsuite/scripts/pom.xml | 2 +- testsuite/shared/pom.xml | 2 +- testsuite/standalone/pom.xml | 2 +- testsuite/test-runner/pom.xml | 2 +- .../unstable-api-annotation/feature-pack/feature-pack/pom.xml | 2 +- testsuite/unstable-api-annotation/feature-pack/pom.xml | 2 +- .../unstable-api-annotation/feature-pack/subsystem/pom.xml | 2 +- testsuite/unstable-api-annotation/pom.xml | 2 +- testsuite/unstable-api-annotation/tests/pom.xml | 2 +- threads/pom.xml | 2 +- version/pom.xml | 2 +- 83 files changed, 83 insertions(+), 83 deletions(-) diff --git a/bootable-jar/boot/pom.xml b/bootable-jar/boot/pom.xml index f64435e84e6..047e9dc489e 100644 --- a/bootable-jar/boot/pom.xml +++ b/bootable-jar/boot/pom.xml @@ -9,7 +9,7 @@ org.wildfly.core wildfly-jar-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-jar-boot diff --git a/bootable-jar/pom.xml b/bootable-jar/pom.xml index 8e9c6111cb3..0cc263ca076 100644 --- a/bootable-jar/pom.xml +++ b/bootable-jar/pom.xml @@ -10,7 +10,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-jar-parent diff --git a/bootable-jar/runtime/pom.xml b/bootable-jar/runtime/pom.xml index 7b31d9e95a3..800e6826a76 100644 --- a/bootable-jar/runtime/pom.xml +++ b/bootable-jar/runtime/pom.xml @@ -9,7 +9,7 @@ org.wildfly.core wildfly-jar-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-jar-runtime diff --git a/build/pom.xml b/build/pom.xml index 0bfe63af884..cc02a7d8a0a 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-build diff --git a/cli/pom.xml b/cli/pom.xml index 36bb3fd3096..9c7ae7f9d0e 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-cli diff --git a/component-matrix-builder/pom.xml b/component-matrix-builder/pom.xml index 7a781778332..188fb01c015 100644 --- a/component-matrix-builder/pom.xml +++ b/component-matrix-builder/pom.xml @@ -13,7 +13,7 @@ Maintain separation between the artifact id and the version to help prevent merge conflicts between commits changing the GA and those changing the V. --> - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 org.wildfly.core diff --git a/controller-client/pom.xml b/controller-client/pom.xml index 3e78f807279..0b143c52c08 100644 --- a/controller-client/pom.xml +++ b/controller-client/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-controller-client diff --git a/controller/pom.xml b/controller/pom.xml index fc85a1d516b..4c33860afa1 100644 --- a/controller/pom.xml +++ b/controller/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-controller diff --git a/core-feature-pack/channel/pom.xml b/core-feature-pack/channel/pom.xml index ac3109af58f..0aaeef1525b 100644 --- a/core-feature-pack/channel/pom.xml +++ b/core-feature-pack/channel/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-channel diff --git a/core-feature-pack/common/pom.xml b/core-feature-pack/common/pom.xml index 8c7967ed545..67908a2ba81 100644 --- a/core-feature-pack/common/pom.xml +++ b/core-feature-pack/common/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-feature-pack-common diff --git a/core-feature-pack/ee-10-api/pom.xml b/core-feature-pack/ee-10-api/pom.xml index 5abc290338a..a02130932a8 100644 --- a/core-feature-pack/ee-10-api/pom.xml +++ b/core-feature-pack/ee-10-api/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-feature-pack-ee-10-api diff --git a/core-feature-pack/galleon-common/pom.xml b/core-feature-pack/galleon-common/pom.xml index aa1defb6320..1050cfc233e 100644 --- a/core-feature-pack/galleon-common/pom.xml +++ b/core-feature-pack/galleon-common/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-feature-pack-galleon-common diff --git a/core-feature-pack/galleon-feature-pack/pom.xml b/core-feature-pack/galleon-feature-pack/pom.xml index ebcd804cced..d0ac8859059 100644 --- a/core-feature-pack/galleon-feature-pack/pom.xml +++ b/core-feature-pack/galleon-feature-pack/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-galleon-pack diff --git a/core-feature-pack/manifest/pom.xml b/core-feature-pack/manifest/pom.xml index 92466a7d6f7..cda5352f2dc 100644 --- a/core-feature-pack/manifest/pom.xml +++ b/core-feature-pack/manifest/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-manifest diff --git a/core-feature-pack/pom.xml b/core-feature-pack/pom.xml index 35a318a2007..b7e3cc04d9b 100644 --- a/core-feature-pack/pom.xml +++ b/core-feature-pack/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-feature-pack-parent diff --git a/core-management/core-management-client/pom.xml b/core-management/core-management-client/pom.xml index 9cc75057bec..7a8f34dc8f1 100644 --- a/core-management/core-management-client/pom.xml +++ b/core-management/core-management-client/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-management - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-management-client diff --git a/core-management/core-management-subsystem/pom.xml b/core-management/core-management-subsystem/pom.xml index 24ebe26e54b..a42531d11d0 100644 --- a/core-management/core-management-subsystem/pom.xml +++ b/core-management/core-management-subsystem/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-management - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-management-subsystem diff --git a/core-management/pom.xml b/core-management/pom.xml index 7898e3cc157..1736390ff6e 100644 --- a/core-management/pom.xml +++ b/core-management/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-management diff --git a/core-model-test/framework/pom.xml b/core-model-test/framework/pom.xml index 649a91d0154..78c0ed95596 100644 --- a/core-model-test/framework/pom.xml +++ b/core-model-test/framework/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-model-test - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-model-test-framework diff --git a/core-model-test/pom.xml b/core-model-test/pom.xml index 97d8eccafa2..d917bb9c3b8 100644 --- a/core-model-test/pom.xml +++ b/core-model-test/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 wildfly-core-model-test diff --git a/core-model-test/test-controller-optional/pom.xml b/core-model-test/test-controller-optional/pom.xml index 5660bf79509..e29c9cc6c24 100644 --- a/core-model-test/test-controller-optional/pom.xml +++ b/core-model-test/test-controller-optional/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-model-test - 27.0.0.Beta6-SNAPSHOT + 27.0.0.Beta6 - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT org.wildfly.core diff --git a/controller-client/pom.xml b/controller-client/pom.xml index 0b143c52c08..6b195c30f7a 100644 --- a/controller-client/pom.xml +++ b/controller-client/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-controller-client diff --git a/controller/pom.xml b/controller/pom.xml index 4c33860afa1..0abc3995bba 100644 --- a/controller/pom.xml +++ b/controller/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-controller diff --git a/core-feature-pack/channel/pom.xml b/core-feature-pack/channel/pom.xml index 0aaeef1525b..b6739d3e4b2 100644 --- a/core-feature-pack/channel/pom.xml +++ b/core-feature-pack/channel/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-channel diff --git a/core-feature-pack/common/pom.xml b/core-feature-pack/common/pom.xml index 67908a2ba81..ebf434be33e 100644 --- a/core-feature-pack/common/pom.xml +++ b/core-feature-pack/common/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-feature-pack-common diff --git a/core-feature-pack/ee-10-api/pom.xml b/core-feature-pack/ee-10-api/pom.xml index a02130932a8..00e7399fda6 100644 --- a/core-feature-pack/ee-10-api/pom.xml +++ b/core-feature-pack/ee-10-api/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-feature-pack-ee-10-api diff --git a/core-feature-pack/galleon-common/pom.xml b/core-feature-pack/galleon-common/pom.xml index 1050cfc233e..80ca576ba11 100644 --- a/core-feature-pack/galleon-common/pom.xml +++ b/core-feature-pack/galleon-common/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-feature-pack-galleon-common diff --git a/core-feature-pack/galleon-feature-pack/pom.xml b/core-feature-pack/galleon-feature-pack/pom.xml index d0ac8859059..3d432d94bb7 100644 --- a/core-feature-pack/galleon-feature-pack/pom.xml +++ b/core-feature-pack/galleon-feature-pack/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-galleon-pack diff --git a/core-feature-pack/manifest/pom.xml b/core-feature-pack/manifest/pom.xml index cda5352f2dc..38ecb0e2aca 100644 --- a/core-feature-pack/manifest/pom.xml +++ b/core-feature-pack/manifest/pom.xml @@ -13,7 +13,7 @@ org.wildfly.core wildfly-core-feature-pack-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-manifest diff --git a/core-feature-pack/pom.xml b/core-feature-pack/pom.xml index b7e3cc04d9b..2fd1fd6ae85 100644 --- a/core-feature-pack/pom.xml +++ b/core-feature-pack/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-feature-pack-parent diff --git a/core-management/core-management-client/pom.xml b/core-management/core-management-client/pom.xml index 7a8f34dc8f1..e45f46b9a5c 100644 --- a/core-management/core-management-client/pom.xml +++ b/core-management/core-management-client/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-management - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-management-client diff --git a/core-management/core-management-subsystem/pom.xml b/core-management/core-management-subsystem/pom.xml index a42531d11d0..af8ed3a956a 100644 --- a/core-management/core-management-subsystem/pom.xml +++ b/core-management/core-management-subsystem/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-management - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-management-subsystem diff --git a/core-management/pom.xml b/core-management/pom.xml index 1736390ff6e..3aeb7eb63e9 100644 --- a/core-management/pom.xml +++ b/core-management/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-management diff --git a/core-model-test/framework/pom.xml b/core-model-test/framework/pom.xml index 78c0ed95596..1e3bc2ffad5 100644 --- a/core-model-test/framework/pom.xml +++ b/core-model-test/framework/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-model-test - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-model-test-framework diff --git a/core-model-test/pom.xml b/core-model-test/pom.xml index d917bb9c3b8..45f294e0151 100644 --- a/core-model-test/pom.xml +++ b/core-model-test/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-parent - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT wildfly-core-model-test diff --git a/core-model-test/test-controller-optional/pom.xml b/core-model-test/test-controller-optional/pom.xml index e29c9cc6c24..e6a13976362 100644 --- a/core-model-test/test-controller-optional/pom.xml +++ b/core-model-test/test-controller-optional/pom.xml @@ -12,7 +12,7 @@ org.wildfly.core wildfly-core-model-test - 27.0.0.Beta6 + 27.0.0.Final-SNAPSHOT