Skip to content

Commit

Permalink
Apply comment
Browse files Browse the repository at this point in the history
  • Loading branch information
YongGoose committed Jan 18, 2025
1 parent e4e60ba commit 234f7ff
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,28 @@ default void publishReportEntry(String value) {
*/
Store getStore(Namespace namespace);

/**
* Returns the store for session-level data.
*
* <p>This store is used to store data that is scoped to the session level.
* The data stored in this store will be available throughout the entire session.
*
* @return the store for session-level data
* @since 5.13
*/
Store getSessionLevelStore();

/**
* Returns the store for request-level data.
*
* <p>This store is used to store data that is scoped to the request level.
* The data stored in this store will be available only for the duration of the current request.
*
* @return the store for request-level data
* @since 5.13
*/
Store getRequestLevelStore();

/**
* Get the {@link ExecutionMode} associated with the current test or container.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ public Store getStore(Namespace namespace) {
return new NamespaceAwareStore(this.valuesStore, namespace);
}

@Override
public Store getSessionLevelStore() {
return getStore(Namespace.create("session"));
}

@Override
public Store getRequestLevelStore() {
return getStore(Namespace.create("request"));
}

@Override
public Set<String> getTags() {
// return modifiable copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2024 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v2.0 which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.Comparator;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -85,6 +86,18 @@ public NamespacedHierarchicalStore<N> newChild() {
return new NamespacedHierarchicalStore<>(this, this.closeAction);
}

/**
* Returns the parent store of this {@code NamespacedHierarchicalStore}.
*
* <p>If this store does not have a parent, an empty {@code Optional} is returned.
*
* @return an {@code Optional} containing the parent store, or an empty {@code Optional} if there is no parent
* @since 5.13
*/
public Optional<NamespacedHierarchicalStore<N>> getParent() {
return Optional.ofNullable(this.parentStore);
}

/**
* Determine if this store has been {@linkplain #close() closed}.
*
Expand Down

0 comments on commit 234f7ff

Please sign in to comment.