Skip to content

Commit 7d98e9a

Browse files
committed
Apply Namespace parameter
Issue: #2816
1 parent 5d2424f commit 7d98e9a

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ default void publishReportEntry(String value) {
428428
* @since 5.13
429429
*/
430430
@API(status = EXPERIMENTAL, since = "5.13")
431-
Store getSessionLevelStore();
431+
Store getSessionLevelStore(Namespace namespace);
432432

433433
/**
434434
* Returns the store for request-level data.
@@ -439,7 +439,7 @@ default void publishReportEntry(String value) {
439439
* @return the store for request-level data
440440
* @since 5.13
441441
*/
442-
Store getRequestLevelStore();
442+
Store getRequestLevelStore(Namespace namespace);
443443

444444
/**
445445
* Get the {@link ExecutionMode} associated with the current test or container.

junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ public Store getStore(Namespace namespace) {
193193
}
194194

195195
@Override
196-
public Store getSessionLevelStore() {
197-
return getStore(Namespace.create("session"));
196+
public Store getSessionLevelStore(Namespace namespace) {
197+
return getStore(namespace);
198198
}
199199

200200
@Override
201-
public Store getRequestLevelStore() {
202-
return getStore(Namespace.create("request"));
201+
public Store getRequestLevelStore(Namespace namespace) {
202+
return getStore(namespace);
203203
}
204204

205205
@Override

junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public final class LauncherDiscoveryRequestBuilder {
111111
private final Map<String, String> configurationParameters = new HashMap<>();
112112
private final List<String> configurationParametersResources = new ArrayList<>();
113113
private final List<LauncherDiscoveryListener> discoveryListeners = new ArrayList<>();
114-
// TODO[#4252] Use the session-level store as its parent.
115114
private final NamespacedHierarchicalStore<Namespace> store = new NamespacedHierarchicalStore<>(null);
116115
private boolean implicitConfigurationParametersEnabled = true;
117116
private ConfigurationParameters parentConfigurationParameters;

junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.junit.platform.commons.util.Preconditions;
2727
import org.junit.platform.engine.ConfigurationParameters;
2828
import org.junit.platform.engine.TestEngine;
29+
import org.junit.platform.engine.support.store.Namespace;
2930
import org.junit.platform.engine.support.store.NamespacedHierarchicalStore;
3031
import org.junit.platform.launcher.Launcher;
3132
import org.junit.platform.launcher.LauncherDiscoveryListener;
@@ -64,6 +65,8 @@
6465
@API(status = STABLE, since = "1.0")
6566
public class LauncherFactory {
6667

68+
private static final NamespacedHierarchicalStore<Namespace> SESSION_STORE = new NamespacedHierarchicalStore<>(null);
69+
6770
private LauncherFactory() {
6871
/* no-op */
6972
}
@@ -135,9 +138,7 @@ private static DefaultLauncher createDefaultLauncher(LauncherConfig config,
135138
LauncherConfigurationParameters configurationParameters) {
136139
Set<TestEngine> engines = collectTestEngines(config);
137140
List<PostDiscoveryFilter> filters = collectPostDiscoveryFilters(config);
138-
139-
DefaultLauncher launcher = new DefaultLauncher(engines, filters, new NamespacedHierarchicalStore<>(null));
140-
141+
DefaultLauncher launcher = new DefaultLauncher(engines, filters, SESSION_STORE);
141142
registerLauncherDiscoveryListeners(config, launcher);
142143
registerTestExecutionListeners(config, launcher, configurationParameters);
143144

jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java

+10
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ public Store getStore(Namespace namespace) {
302302
return store;
303303
}
304304

305+
@Override
306+
public Store getSessionLevelStore(Namespace namespace) {
307+
return getStore(namespace);
308+
}
309+
310+
@Override
311+
public Store getRequestLevelStore(Namespace namespace) {
312+
return getStore(namespace);
313+
}
314+
305315
@Override
306316
public ExecutionMode getExecutionMode() {
307317
return ExecutionMode.SAME_THREAD;

0 commit comments

Comments
 (0)