Skip to content

Commit

Permalink
Rename executionContext to extensionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
scordio committed Jul 15, 2023
1 parent 749f115 commit f2aae25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public interface TempDirFactory extends Closeable {
* not be associated with the {@link java.nio.file.FileSystems#getDefault()
* default FileSystem}.
*
* @param elementContext the context of the field or parameter where
* {@code @TempDir} is declared; never {@code null}
* @param elementContext the context of the field or parameter where
* {@code @TempDir} is declared; never {@code null}
* @param extensionContext the current extension context; never {@code null}
* @return the path to the newly created temporary directory; never {@code null}
* @throws Exception in case of failures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ private Object getPathOrFile(AnnotatedElementContext elementContext, Class<?> ty
}

static CloseablePath createTempDir(TempDirFactory factory, CleanupMode cleanupMode,
AnnotatedElementContext elementContext, ExtensionContext executionContext) {
AnnotatedElementContext elementContext, ExtensionContext extensionContext) {
try {
return new CloseablePath(factory, cleanupMode, elementContext, executionContext);
return new CloseablePath(factory, cleanupMode, elementContext, extensionContext);
}
catch (Exception ex) {
throw new ExtensionConfigurationException("Failed to create default temp directory", ex);
Expand All @@ -268,14 +268,14 @@ static class CloseablePath implements CloseableResource {
private final Path dir;
private final TempDirFactory factory;
private final CleanupMode cleanupMode;
private final ExtensionContext executionContext;
private final ExtensionContext extensionContext;

CloseablePath(TempDirFactory factory, CleanupMode cleanupMode, AnnotatedElementContext elementContext,
ExtensionContext executionContext) throws Exception {
this.dir = factory.createTempDirectory(elementContext, executionContext);
ExtensionContext extensionContext) throws Exception {
this.dir = factory.createTempDirectory(elementContext, extensionContext);
this.factory = factory;
this.cleanupMode = cleanupMode;
this.executionContext = executionContext;
this.extensionContext = extensionContext;
}

Path get() {
Expand All @@ -286,12 +286,12 @@ Path get() {
public void close() throws IOException {
try {
if (cleanupMode == NEVER
|| (cleanupMode == ON_SUCCESS && executionContext.getExecutionException().isPresent())) {
|| (cleanupMode == ON_SUCCESS && extensionContext.getExecutionException().isPresent())) {
logger.info(() -> "Skipping cleanup of temp dir " + dir + " due to cleanup mode configuration.");
return;
}

FileOperations fileOperations = executionContext.getStore(NAMESPACE) //
FileOperations fileOperations = extensionContext.getStore(NAMESPACE) //
.getOrDefault(FILE_OPERATIONS_KEY, FileOperations.class, FileOperations.DEFAULT);

SortedMap<Path, IOException> failures = deleteAllFilesAndDirectories(fileOperations);
Expand Down

0 comments on commit f2aae25

Please sign in to comment.