Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFCORE-3720] Update ServiceModuleLoader to use non-deprecated JBoss Modules APIs #6247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lvydra
Copy link
Contributor

@lvydra lvydra commented Nov 20, 2024

@wildfly-ci
Copy link

Core -> Full Integration Build 14045 outcome was FAILURE using a merge of 070bc6a
Summary: Compilation error: Compiler (new) Build time: 00:04:35

@wildfly-ci
Copy link

Core -> WildFly Preview Integration Build 14122 outcome was FAILURE using a merge of 070bc6a
Summary: Compilation error: Compiler (new) Build time: 00:05:27

@wildfly-ci
Copy link

Core -> Full Integration Build 14341 outcome was FAILURE using a merge of 070bc6a
Summary: Tests passed: 934, ignored: 19; compilation error: Compiler (new) Build time: 00:08:39

@bstansberry
Copy link
Contributor

In general ModuleIdentifier.getName() is not a safe replacement for ModuleIdentifier. It does not include any slot value. ModuleIdentifier.toString() provides the String variant of the module id.

@@ -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.getName()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes like this need to be updated to use toString(), not getName().

return name.startsWith(MODULE_PREFIX);
}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add forRemoval=true and add javadoc @deprecated pointing to the new method.

@lvydra
Copy link
Contributor Author

lvydra commented Nov 27, 2024

Hi @bstansberry, thank you for the review, change requests should be addressed now.

Comment on lines +133 to +144
public ModuleSpec findModule(String name) throws ModuleLoadException {
ServiceController<ModuleDefinition> controller = (ServiceController<ModuleDefinition>) serviceContainer.getService(moduleSpecServiceName(name));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method should have been deprecated for removal calling internally to the one using the String as an argument. Otherwise, any caller currently using the old one will now be using the one provided by the parent class.

public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
public static ServiceName moduleResolvedServiceName(String name) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This falls into the same category as what was done with ServiceName moduleServiceName(ModuleIdentifier identifier) and should be deprecated as well, although better to get other feedback since I don't know exactly what was the use case where this can be called from other parties than WildFly

Comment on lines +234 to +271
public static boolean isDynamicModule(String name) {
return name.startsWith(MODULE_PREFIX);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This falls into the same category as what was done with ServiceName moduleServiceName(ModuleIdentifier identifier) and should be deprecated as well. Although better to get other feedback since I don't know exactly what was the use case where this can be called from other parties than WildFly

@wildfly-ci
Copy link

Core -> WildFly Preview Integration Build 14145 outcome was FAILURE using a merge of f2cbe06
Summary: Tests failed: 1 (1 new), passed: 5007, ignored: 85 Build time: 03:34:47

Failed tests

TestSuite: org.eclipse.microprofile.rest.client.tck.sse.ReactiveStreamsPublisherTckTest.stochastic_spec103_mustSignalOnMethodsSequentially: java.lang.NullPointerException: Cannot invoke "org.reactivestreams.Publisher.subscribe(org.reactivestreams.Subscriber)" because "pub" is null
	at org.reactivestreams.tck.PublisherVerification$5$1.run(PublisherVerification.java:257)
	at org.reactivestreams.tck.PublisherVerification.activePublisherTest(PublisherVerification.java:1135)
	at org.reactivestreams.tck.PublisherVerification$5.apply(PublisherVerification.java:251)
	at org.reactivestreams.tck.PublisherVerification$5.apply(PublisherVerification.java:248)
	at org.reactivestreams.tck.PublisherVerification.stochasticTest(PublisherVerification.java:1204)
	at org.reactivestreams.tck.PublisherVerification.stochastic_spec103_mustSignalOnMethodsSequentially(PublisherVerification.java:248)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:686)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.testng.TestRunner.privateRun(TestRunner.java:739)
	at org.testng.TestRunner.run(TestRunner.java:614)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
	at org.testng.SuiteRunner.run(SuiteRunner.java:312)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
	at org.testng.TestNG.runSuites(TestNG.java:1112)
	at org.testng.TestNG.run(TestNG.java:1079)
------- Stderr: -------
java.lang.AssertionError: Mock Sse Server did not start as expected expected [true] but found [false]
	at org.testng.Assert.fail(Assert.java:111)
	at org.testng.Assert.failNotEquals(Assert.java:1578)
	at org.testng.Assert.assertTrue(Assert.java:57)
	at org.eclipse.microprofile.rest.client.tck.sse.AbstractSseTest.launchServer(AbstractSseTest.java:62)
	at org.eclipse.microprofile.rest.client.tck.sse.ReactiveStreamsPublisherTckTest.createPublisher(ReactiveStreamsPublisherTckTest.java:106)
	at org.reactivestreams.tck.PublisherVerification.activePublisherTest(PublisherVerification.java:1134)
	at org.reactivestreams.tck.PublisherVerification$5.apply(PublisherVerification.java:251)
	at org.reactivestreams.tck.PublisherVerification$5.apply(PublisherVerification.java:248)
	at org.reactivestreams.tck.PublisherVerification.stochasticTest(PublisherVerification.java:1204)
	at org.reactivestreams.tck.PublisherVerification.stochastic_spec103_mustSignalOnMethodsSequentially(PublisherVerification.java:248)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
	at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:686)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
	at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
	at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
	at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
	at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
	at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)


@lvydra
Copy link
Contributor Author

lvydra commented Nov 28, 2024

Thanks @yersan, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants