diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorFullTests.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorFullTests.java index a69d1119..408ff668 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorFullTests.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorFullTests.java @@ -50,7 +50,7 @@ public class DeploymentDescriptorFullTests extends TestClient { public static EnterpriseArchive createDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class, "DeploymentDescriptorTests_web.war") - .addClasses(DeploymentDescriptorServlet.class); + .addClasses(DeploymentDescriptorServlet.class, ManagedThreadFactoryProducer.class); JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "DeploymentDescriptorTests_ejb.jar") .addClasses(DeploymentDescriptorTestBean.class, DeploymentDescriptorTestBeanInterface.class) diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorServlet.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorServlet.java index 613fe75e..5a8c22e0 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorServlet.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/DeploymentDescriptorServlet.java @@ -212,15 +212,17 @@ public void testDeploymentDescriptorDefinedManagedThreadFactoryQualifers() throw assertAll("Thread Factory Tests", () -> assertNotNull(injectedDefMTF, - "Default managedThreadFactory was not registered with default qualifier."), - () -> assertEquals(lookupDefMTF.newThread(NOOP_RUNNABLE).getPriority(), injectedDefMTF.newThread(NOOP_RUNNABLE).getPriority(), - "Default managedThreadFactory from injection and lookup did not have the same priority."), + "A managedThreadFactory was not registered with the default qualifier when the application included a producer."), + () -> assertEquals(5, lookupDefMTF.newThread(NOOP_RUNNABLE).getPriority(), + "Default managedThreadFactory from lookup did not have the default priority."), + () -> assertEquals(7, injectedDefMTF.newThread(NOOP_RUNNABLE).getPriority(), + "Default managedThreadFactory from injection did not have the expected priority."), () -> assertNotNull(resourceMTFD, "Deployment Descriptor defined managedThreadFactory with no qualifiers could not be found via @Resource."), () -> assertEquals(lookupMTFD.newThread(NOOP_RUNNABLE).getPriority(), resourceMTFD.newThread(NOOP_RUNNABLE).getPriority(), "The managedThreadFactory from resource injection and lookup did not have the same priority."), () -> assertTrue(CDI.current().select(ManagedThreadFactory.class, CustomQualifier1.Literal.get()).isUnsatisfied(), - "A managedThreadFactory was satisfied with a required qualifier that should have been overriden by the deployment descriptor.") + "A managedThreadFactory was satisfied with a required qualifier that was not configured on the deployment descriptor.") ); } diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/ManagedThreadFactoryProducer.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/ManagedThreadFactoryProducer.java new file mode 100644 index 00000000..39e190c8 --- /dev/null +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/ManagedThreadFactoryProducer.java @@ -0,0 +1,16 @@ +package ee.jakarta.tck.concurrent.spec.Platform.dd; + +import javax.naming.InitialContext; + +import jakarta.enterprise.concurrent.ManagedThreadFactory; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +@ApplicationScoped +public class ManagedThreadFactoryProducer { + + @Produces + public ManagedThreadFactory getDefaultManagedThreadFactory() throws Exception { + return InitialContext.doLookup("java:app/concurrent/ThreadFactoryDefault"); + } +} diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/application.xml b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/application.xml index 65708cbb..6924f662 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/application.xml +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/application.xml @@ -63,5 +63,11 @@ 6 + + + java:app/concurrent/ThreadFactoryDefault + java:comp/DefaultContextService + 7 + diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/web.xml b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/web.xml index 500d4442..41db6ae6 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/web.xml +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/Platform/dd/web.xml @@ -53,5 +53,11 @@ 6 + + + java:app/concurrent/ThreadFactoryDefault + java:comp/DefaultContextService + 7 + \ No newline at end of file