Skip to content

Commit fc59fc2

Browse files
committed
Rename new implementation
1 parent 3ed8f0f commit fc59fc2

File tree

5 files changed

+34
-33
lines changed

5 files changed

+34
-33
lines changed

junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
import org.junit.platform.engine.UniqueId;
3030
import org.junit.platform.engine.support.config.PrefixedConfigurationParameters;
3131
import org.junit.platform.engine.support.discovery.DiscoveryIssueReporter;
32-
import org.junit.platform.engine.support.hierarchical.ConcurrentHierarchicalTestExecutorService;
3332
import org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine;
3433
import org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService;
3534
import org.junit.platform.engine.support.hierarchical.ThrowableCollector;
35+
import org.junit.platform.engine.support.hierarchical.WorkerThreadPoolHierarchicalTestExecutorService;
3636

3737
/**
3838
* The JUnit Jupiter {@link org.junit.platform.engine.TestEngine TestEngine}.
@@ -79,7 +79,7 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId
7979
protected HierarchicalTestExecutorService createExecutorService(ExecutionRequest request) {
8080
JupiterConfiguration configuration = getJupiterConfiguration(request);
8181
if (configuration.isParallelExecutionEnabled()) {
82-
return new ConcurrentHierarchicalTestExecutorService(new PrefixedConfigurationParameters(
82+
return new WorkerThreadPoolHierarchicalTestExecutorService(new PrefixedConfigurationParameters(
8383
request.getConfigurationParameters(), Constants.PARALLEL_CONFIG_PREFIX));
8484
}
8585
return super.createExecutorService(request);
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,25 @@
5959
* @since 6.1
6060
*/
6161
@API(status = EXPERIMENTAL, since = "6.1")
62-
public class ConcurrentHierarchicalTestExecutorService implements HierarchicalTestExecutorService {
62+
public class WorkerThreadPoolHierarchicalTestExecutorService implements HierarchicalTestExecutorService {
6363

64-
private static final Logger LOGGER = LoggerFactory.getLogger(ConcurrentHierarchicalTestExecutorService.class);
64+
private static final Logger LOGGER = LoggerFactory.getLogger(WorkerThreadPoolHierarchicalTestExecutorService.class);
6565

6666
private final WorkQueue workQueue = new WorkQueue();
6767
private final ExecutorService threadPool;
6868
private final int parallelism;
6969
private final WorkerLeaseManager workerLeaseManager;
7070

71-
public ConcurrentHierarchicalTestExecutorService(ConfigurationParameters configurationParameters) {
71+
public WorkerThreadPoolHierarchicalTestExecutorService(ConfigurationParameters configurationParameters) {
7272
this(DefaultParallelExecutionConfigurationStrategy.toConfiguration(configurationParameters));
7373
}
7474

75-
public ConcurrentHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration) {
75+
public WorkerThreadPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration) {
7676
this(configuration, ClassLoaderUtils.getDefaultClassLoader());
7777
}
7878

79-
ConcurrentHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration, ClassLoader classLoader) {
79+
WorkerThreadPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration,
80+
ClassLoader classLoader) {
8081
ThreadFactory threadFactory = new WorkerThreadFactory(classLoader);
8182
parallelism = configuration.getParallelism();
8283
workerLeaseManager = new WorkerLeaseManager(parallelism, this::maybeStartWorker);
@@ -222,8 +223,8 @@ static WorkerThread getOrThrow() {
222223
return workerThread;
223224
}
224225

225-
ConcurrentHierarchicalTestExecutorService executor() {
226-
return ConcurrentHierarchicalTestExecutorService.this;
226+
WorkerThreadPoolHierarchicalTestExecutorService executor() {
227+
return WorkerThreadPoolHierarchicalTestExecutorService.this;
227228
}
228229

229230
void processQueueEntries(WorkerLease workerLease, BooleanSupplier doneCondition) {

platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/WorkerLeaseManagerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.concurrent.atomic.AtomicInteger;
1616

1717
import org.junit.jupiter.api.Test;
18-
import org.junit.platform.engine.support.hierarchical.ConcurrentHierarchicalTestExecutorService.WorkerLeaseManager;
18+
import org.junit.platform.engine.support.hierarchical.WorkerThreadPoolHierarchicalTestExecutorService.WorkerLeaseManager;
1919

2020
class WorkerLeaseManagerTests {
2121

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
*/
6262
@SuppressWarnings("resource")
6363
@Timeout(5)
64-
class ConcurrentHierarchicalTestExecutorServiceTests {
64+
class WorkerThreadPoolHierarchicalTestExecutorServiceTests {
6565

6666
@AutoClose
6767
@Nullable
68-
ConcurrentHierarchicalTestExecutorService service;
68+
WorkerThreadPoolHierarchicalTestExecutorService service;
6969

7070
@ParameterizedTest
7171
@EnumSource(ExecutionMode.class)
@@ -75,7 +75,7 @@ void executesSingleTask(ExecutionMode executionMode) throws Exception {
7575

7676
var customClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader());
7777
try (customClassLoader) {
78-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1), customClassLoader);
78+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1), customClassLoader);
7979
service.submit(task).get();
8080
}
8181

@@ -90,7 +90,7 @@ void executesSingleTask(ExecutionMode executionMode) throws Exception {
9090
@Test
9191
void invokeAllMustBeExecutedFromWithinThreadPool() {
9292
var tasks = List.of(new TestTaskStub(ExecutionMode.CONCURRENT));
93-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1));
93+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1));
9494

9595
assertPreconditionViolationFor(() -> requiredService().invokeAll(tasks)) //
9696
.withMessage("invokeAll() must be called from a worker thread that belongs to this executor");
@@ -100,7 +100,7 @@ void invokeAllMustBeExecutedFromWithinThreadPool() {
100100
@EnumSource(ExecutionMode.class)
101101
void executesSingleChildInSameThreadRegardlessOfItsExecutionMode(ExecutionMode childExecutionMode)
102102
throws Exception {
103-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1));
103+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1));
104104

105105
var child = new TestTaskStub(childExecutionMode);
106106
var root = new TestTaskStub(ExecutionMode.CONCURRENT, () -> requiredService().invokeAll(List.of(child)));
@@ -116,7 +116,7 @@ void executesSingleChildInSameThreadRegardlessOfItsExecutionMode(ExecutionMode c
116116

117117
@Test
118118
void executesTwoChildrenConcurrently() throws Exception {
119-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
119+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
120120

121121
var latch = new CountDownLatch(2);
122122
Executable behavior = () -> {
@@ -136,7 +136,7 @@ void executesTwoChildrenConcurrently() throws Exception {
136136

137137
@Test
138138
void executesTwoChildrenInSameThread() throws Exception {
139-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1));
139+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1));
140140

141141
var children = List.of(new TestTaskStub(ExecutionMode.SAME_THREAD),
142142
new TestTaskStub(ExecutionMode.SAME_THREAD));
@@ -158,7 +158,7 @@ void acquiresResourceLockForRootTask() throws Exception {
158158

159159
var task = new TestTaskStub(ExecutionMode.CONCURRENT).withResourceLock(resourceLock);
160160

161-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1));
161+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1));
162162
service.submit(task).get();
163163

164164
task.assertExecutedSuccessfully();
@@ -171,7 +171,7 @@ void acquiresResourceLockForRootTask() throws Exception {
171171

172172
@Test
173173
void acquiresResourceLockForChildTasks() throws Exception {
174-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
174+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
175175

176176
var resourceLock = mock(ResourceLock.class);
177177
when(resourceLock.tryAcquire()).thenReturn(true, false);
@@ -198,7 +198,7 @@ void acquiresResourceLockForChildTasks() throws Exception {
198198

199199
@Test
200200
void runsTasksWithoutConflictingLocksConcurrently() throws Exception {
201-
service = new ConcurrentHierarchicalTestExecutorService(configuration(3));
201+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(3));
202202

203203
var resourceLock = new SingleLock(exclusiveResource(LockMode.READ_WRITE), new ReentrantLock());
204204

@@ -228,7 +228,7 @@ void runsTasksWithoutConflictingLocksConcurrently() throws Exception {
228228

229229
@Test
230230
void processingQueueEntriesSkipsOverUnavailableResources() throws Exception {
231-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
231+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
232232

233233
var resourceLock = new SingleLock(exclusiveResource(LockMode.READ_WRITE), new ReentrantLock());
234234

@@ -265,7 +265,7 @@ void processingQueueEntriesSkipsOverUnavailableResources() throws Exception {
265265

266266
@Test
267267
void invokeAllQueueEntriesSkipsOverUnavailableResources() throws Exception {
268-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
268+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
269269

270270
var resourceLock = new SingleLock(exclusiveResource(LockMode.READ_WRITE), new ReentrantLock());
271271

@@ -302,7 +302,7 @@ void invokeAllQueueEntriesSkipsOverUnavailableResources() throws Exception {
302302

303303
@Test
304304
void prioritizesChildrenOfStartedContainers() throws Exception {
305-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
305+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
306306

307307
var leavesStarted = new CountDownLatch(2);
308308

@@ -331,7 +331,7 @@ void prioritizesChildrenOfStartedContainers() throws Exception {
331331

332332
@Test
333333
void prioritizesTestsOverContainers() throws Exception {
334-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2));
334+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2));
335335

336336
var leavesStarted = new CountDownLatch(2);
337337
var leaf = new TestTaskStub(ExecutionMode.CONCURRENT, leavesStarted::countDown) //
@@ -358,7 +358,7 @@ void prioritizesTestsOverContainers() throws Exception {
358358

359359
@RepeatedTest(value = 100, failureThreshold = 1)
360360
void limitsWorkerThreadsToMaxPoolSize() throws Exception {
361-
service = new ConcurrentHierarchicalTestExecutorService(configuration(3, 3));
361+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(3, 3));
362362

363363
CountDownLatch latch = new CountDownLatch(3);
364364
Executable behavior = () -> {
@@ -397,7 +397,7 @@ void limitsWorkerThreadsToMaxPoolSize() throws Exception {
397397

398398
@Test
399399
void stealsBlockingChildren() throws Exception {
400-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2, 2));
400+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2, 2));
401401

402402
var child1Started = new CountDownLatch(1);
403403
var leaf2aStarted = new CountDownLatch(1);
@@ -449,7 +449,7 @@ public void release() {
449449

450450
@RepeatedTest(value = 100, failureThreshold = 1)
451451
void executesChildrenInOrder() throws Exception {
452-
service = new ConcurrentHierarchicalTestExecutorService(configuration(1, 1));
452+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(1, 1));
453453

454454
var leaf1a = new TestTaskStub(ExecutionMode.CONCURRENT) //
455455
.withName("leaf1a").withLevel(2);
@@ -476,7 +476,7 @@ void executesChildrenInOrder() throws Exception {
476476

477477
@RepeatedTest(value = 100, failureThreshold = 1)
478478
void workIsStolenInReverseOrder() throws Exception {
479-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2, 2));
479+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2, 2));
480480

481481
// Execute tasks pairwise
482482
CyclicBarrier cyclicBarrier = new CyclicBarrier(2);
@@ -527,7 +527,7 @@ void workIsStolenInReverseOrder() throws Exception {
527527

528528
@RepeatedTest(value = 100, failureThreshold = 1)
529529
void stealsDynamicChildren() throws Exception {
530-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2, 2));
530+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2, 2));
531531

532532
var child1Started = new CountDownLatch(1);
533533
var child2Finished = new CountDownLatch(1);
@@ -557,7 +557,7 @@ void stealsDynamicChildren() throws Exception {
557557

558558
@RepeatedTest(value = 100, failureThreshold = 1)
559559
void stealsNestedDynamicChildren() throws Exception {
560-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2, 2));
560+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2, 2));
561561

562562
var barrier = new CyclicBarrier(2);
563563

@@ -612,7 +612,7 @@ void stealsNestedDynamicChildren() throws Exception {
612612

613613
@RepeatedTest(value = 100, failureThreshold = 1)
614614
void stealsSiblingDynamicChildrenOnly() throws Exception {
615-
service = new ConcurrentHierarchicalTestExecutorService(configuration(2, 3));
615+
service = new WorkerThreadPoolHierarchicalTestExecutorService(configuration(2, 3));
616616

617617
var child1Started = new CountDownLatch(1);
618618
var child2Started = new CountDownLatch(1);
@@ -667,7 +667,7 @@ private static ExclusiveResource exclusiveResource(LockMode lockMode) {
667667
return new ExclusiveResource("key", lockMode);
668668
}
669669

670-
private ConcurrentHierarchicalTestExecutorService requiredService() {
670+
private WorkerThreadPoolHierarchicalTestExecutorService requiredService() {
671671
return requireNonNull(service);
672672
}
673673

platform-tests/src/test/resources/log4j2-test.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<Logger name="org.junit.platform.launcher.core.InternalTestPlan" level="ERROR"/>
2222
<Logger name="org.junit.platform.launcher.core.LauncherConfigurationParameters" level="ERROR"/>
2323
<Logger name="org.junit.platform.launcher.listeners.discovery.LoggingLauncherDiscoveryListener" level="OFF"/>
24-
<Logger name="org.junit.platform.engine.support.hierarchical.ConcurrentHierarchicalTestExecutorService" level="TRACE"/>
24+
<Logger name="org.junit.platform.engine.support.hierarchical.WorkerThreadPoolHierarchicalTestExecutorService" level="TRACE"/>
2525
<Logger name="org.junit.vintage.engine" level="ERROR"/>
2626
<Logger name="org.junit.jupiter.engine" level="ERROR"/>
2727
<Root level="ERROR">

0 commit comments

Comments
 (0)