From ead4e7b23f4687bfaa8d64bc6e8a74727ba05929 Mon Sep 17 00:00:00 2001 From: Petr Aubrecht Date: Fri, 8 Jul 2022 11:38:17 +0200 Subject: [PATCH 1/2] disable challeged testContextualFunction https://github.com/jakartaee/concurrency/issues/253 --- .../contextPropagate/ContextPropagationTests.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java index 961ded9f..351f813e 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java @@ -259,8 +259,12 @@ public void testContextualConsumer() throws Throwable { * A ContextService contextualizes a Function, which can be supplied as a dependent stage action * to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of * the thread that contextualizes the Function, per the configuration of the ContextServiceDefinition. + * + * Assertions on results[0] and results[1] are both invalid because treating those two UNCHANGED context types as + * though they were CLEARED. + * TCK challenge: https://github.com/jakartaee/concurrency/issues/253 */ - @Test + @Test(enabled = false) public void testContextualFunction() throws Throwable { URLBuilder requestURL = URLBuilder.get().withBaseURL(contextURL).withPaths("ContextServiceDefinitionServlet").withTestName(testName); runTest(requestURL); From c61f89725a3da3835922ed5c0fe0f3a3d4605d2d Mon Sep 17 00:00:00 2001 From: Petr Aubrecht Date: Mon, 11 Jul 2022 12:11:41 +0200 Subject: [PATCH 2/2] fix tck, setup application to be cleared in ContextB --- .../contextPropagate/ContextPropagationTests.java | 2 +- .../contextPropagate/ContextServiceDefinitionServlet.java | 6 +++--- .../resourcedef/ManagedExecutorDefinitionTests.java | 2 +- .../ManagedScheduledExecutorDefinitionServlet.java | 2 +- .../ManagedScheduledExecutorDefinitionTests.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java index 351f813e..6d9dbf7f 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextPropagationTests.java @@ -264,7 +264,7 @@ public void testContextualConsumer() throws Throwable { * though they were CLEARED. * TCK challenge: https://github.com/jakartaee/concurrency/issues/253 */ - @Test(enabled = false) + @Test public void testContextualFunction() throws Throwable { URLBuilder requestURL = URLBuilder.get().withBaseURL(contextURL).withPaths("ContextServiceDefinitionServlet").withTestName(testName); runTest(requestURL); diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextServiceDefinitionServlet.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextServiceDefinitionServlet.java index 280baf90..eabd829f 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextServiceDefinitionServlet.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ContextService/contextPropagate/ContextServiceDefinitionServlet.java @@ -60,8 +60,8 @@ cleared = StringContext.NAME, unchanged = TRANSACTION) @ContextServiceDefinition(name = "java:module/concurrent/ContextB", - cleared = TRANSACTION, - unchanged = { APPLICATION, IntContext.NAME }, + cleared = {TRANSACTION, APPLICATION}, + unchanged = { IntContext.NAME }, propagated = ALL_REMAINING) @ContextServiceDefinition(name = "java:comp/concurrent/ContextC") @WebServlet("/ContextServiceDefinitionServlet") @@ -407,7 +407,7 @@ public void testContextualFunction() throws Throwable { Object[] results = future.get(MAX_WAIT_SECONDS, TimeUnit.SECONDS); assertTrue(results[0] instanceof NamingException, - "Application context must remain unchanged on contextual Function " + + "Application context must be cleared on contextual Function " + "per java:module/concurrent/ContextB configuration. Result: " + results[0]); assertEquals(results[1], Integer.valueOf(0), "Third-party context type IntContext must remain unchanged on contextual Function " + diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedExecutorService/resourcedef/ManagedExecutorDefinitionTests.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedExecutorService/resourcedef/ManagedExecutorDefinitionTests.java index 199b7874..6a080447 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedExecutorService/resourcedef/ManagedExecutorDefinitionTests.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedExecutorService/resourcedef/ManagedExecutorDefinitionTests.java @@ -100,7 +100,7 @@ public void testAsynchronousMethodVoidReturnType() { } // TCK Accepted Challenge: https://github.com/jakartaee/concurrency/issues/224 - @Test(enabled = false) + @Test public void testCompletedFuture() { runTest(baseURL); } diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionServlet.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionServlet.java index a3908a13..8273730a 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionServlet.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionServlet.java @@ -222,7 +222,7 @@ public void testCompletedFutureMSE() throws Throwable { try { String result = stage2.join(); - throw new AssertionError("Application context must be left unchanged per " + + throw new AssertionError("Application context must be cleared per " + "ManagedExecutorDefinition and ContextServiceDefinition config. " + "Instead, was able to look up " + result); } catch (CompletionException x) { diff --git a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionTests.java b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionTests.java index 38a2d27f..acdb82b6 100644 --- a/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionTests.java +++ b/tck/src/main/java/ee/jakarta/tck/concurrent/spec/ManagedScheduledExecutorService/resourcedef/ManagedScheduledExecutorDefinitionTests.java @@ -96,7 +96,7 @@ public void testAsynchronousMethodWithMaxAsync3() { runTest(baseURL); } // Accepted TCK Challenge: https://github.com/jakartaee/concurrency/issues/224 - @Test(enabled = false) + @Test public void testCompletedFutureMSE() { runTest(baseURL); }