|
12 | 12 |
|
13 | 13 | import static org.apiguardian.api.API.Status.EXPERIMENTAL;
|
14 | 14 | import static org.apiguardian.api.API.Status.STABLE;
|
| 15 | +import static org.junit.platform.engine.support.hierarchical.ParallelExecutionConfiguration.TestExecutor; |
15 | 16 |
|
16 | 17 | import java.math.BigDecimal;
|
17 | 18 | import java.util.Locale;
|
|
21 | 22 | import org.junit.platform.commons.util.Preconditions;
|
22 | 23 | import org.junit.platform.commons.util.ReflectionUtils;
|
23 | 24 | import org.junit.platform.engine.ConfigurationParameters;
|
| 25 | +import org.junit.platform.engine.TestDescriptor; |
24 | 26 |
|
25 | 27 | /**
|
26 | 28 | * Default implementations of configuration strategies for parallel test
|
@@ -49,8 +51,11 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter
|
49 | 51 | boolean saturate = configurationParameters.get(CONFIG_FIXED_SATURATE_PROPERTY_NAME,
|
50 | 52 | Boolean::valueOf).orElse(true);
|
51 | 53 |
|
| 54 | + TestExecutor testExecutor = configurationParameters.get(CONFIG_FIXED_TEST_EXECUTOR_PROPERTY_NAME, |
| 55 | + (str) -> TestExecutor.valueOf(str.toUpperCase())).orElse(TestExecutor.FORK_JOIN); |
| 56 | + |
52 | 57 | return new DefaultParallelExecutionConfiguration(parallelism, parallelism, maxPoolSize, parallelism,
|
53 |
| - KEEP_ALIVE_SECONDS, __ -> saturate); |
| 58 | + KEEP_ALIVE_SECONDS, __ -> saturate, testExecutor); |
54 | 59 | }
|
55 | 60 | },
|
56 | 61 |
|
@@ -84,8 +89,11 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter
|
84 | 89 | boolean saturate = configurationParameters.get(CONFIG_DYNAMIC_SATURATE_PROPERTY_NAME,
|
85 | 90 | Boolean::valueOf).orElse(true);
|
86 | 91 |
|
| 92 | + TestExecutor testExecutor = configurationParameters.get(CONFIG_DYNAMIC_TEST_EXECUTOR_PROPERTY_NAME, |
| 93 | + (str) -> TestExecutor.valueOf(str.toUpperCase())).orElse(TestExecutor.FORK_JOIN); |
| 94 | + |
87 | 95 | return new DefaultParallelExecutionConfiguration(parallelism, parallelism, maxPoolSize, parallelism,
|
88 |
| - KEEP_ALIVE_SECONDS, __ -> saturate); |
| 96 | + KEEP_ALIVE_SECONDS, __ -> saturate, testExecutor); |
89 | 97 | }
|
90 | 98 | },
|
91 | 99 |
|
@@ -163,6 +171,16 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter
|
163 | 171 | @API(status = EXPERIMENTAL, since = "1.10")
|
164 | 172 | public static final String CONFIG_FIXED_SATURATE_PROPERTY_NAME = "fixed.saturate";
|
165 | 173 |
|
| 174 | + /** |
| 175 | + * Property name used to disable saturation of the underlying thread pool |
| 176 | + * used to execute {@linkplain TestDescriptor.Type#TEST test tasks} |
| 177 | + * for the {@link #FIXED} configuration strategy. |
| 178 | + * |
| 179 | + * @since 1.11 |
| 180 | + */ |
| 181 | + @API(status = EXPERIMENTAL, since = "1.11") |
| 182 | + public static final String CONFIG_FIXED_TEST_EXECUTOR_PROPERTY_NAME = "fixed.test-executor"; |
| 183 | + |
166 | 184 | /**
|
167 | 185 | * Property name of the factor used to determine the desired parallelism for the
|
168 | 186 | * {@link #DYNAMIC} configuration strategy.
|
@@ -207,6 +225,16 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter
|
207 | 225 | @API(status = EXPERIMENTAL, since = "1.10")
|
208 | 226 | public static final String CONFIG_DYNAMIC_SATURATE_PROPERTY_NAME = "dynamic.saturate";
|
209 | 227 |
|
| 228 | + /** |
| 229 | + * Property name used to disable saturation of the underlying thread pool |
| 230 | + * used to execute {@linkplain TestDescriptor.Type#TEST test tasks} |
| 231 | + * for the {@link #DYNAMIC} configuration strategy. |
| 232 | + * |
| 233 | + * @since 1.11 |
| 234 | + */ |
| 235 | + @API(status = EXPERIMENTAL, since = "1.11") |
| 236 | + public static final String CONFIG_DYNAMIC_TEST_EXECUTOR_PROPERTY_NAME = "dynamic.test-executor"; |
| 237 | + |
210 | 238 | /**
|
211 | 239 | * Property name used to specify the fully qualified class name of the
|
212 | 240 | * {@link ParallelExecutionConfigurationStrategy} to be used by the
|
|
0 commit comments