This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 6644abd5f7 Fix HdfsStorageOperatorTest NPE (#16178)
6644abd5f7 is described below
commit 6644abd5f7c4ff9049a43a72212cd20d446e97d7
Author: Wenjun Ruan <[email protected]>
AuthorDate: Wed Jun 19 14:32:21 2024 +0800
Fix HdfsStorageOperatorTest NPE (#16178)
---
.../plugin/storage/hdfs/LocalStorageOperatorTest.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/test/java/org/apache/dolphinscheduler/plugin/storage/hdfs/LocalStorageOperatorTest.java
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/test/java/org/apache/dolphinscheduler/plugin/storage/hdfs/LocalStorageOperatorTest.java
index c90500c343..7a277afbce 100644
---
a/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/test/java/org/apache/dolphinscheduler/plugin/storage/hdfs/LocalStorageOperatorTest.java
+++
b/dolphinscheduler-storage-plugin/dolphinscheduler-storage-hdfs/src/test/java/org/apache/dolphinscheduler/plugin/storage/hdfs/LocalStorageOperatorTest.java
@@ -27,9 +27,6 @@ import
org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperator;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.File;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -45,8 +42,8 @@ class LocalStorageOperatorTest {
private StorageOperator storageOperator;
- private static final String resourceBaseDir = StringUtils
-
.substringBeforeLast(FileUtils.getClassPathAbsolutePath(LocalStorageOperatorTest.class),
File.separator);
+ private static final String resourceBaseDir =
+
Paths.get(LocalStorageOperatorTest.class.getResource("/").getFile(),
"localStorage").toString();
private static final String tenantCode = "default";
private static final String baseDir =
Paths.get(resourceBaseDir, tenantCode,
Constants.RESOURCE_TYPE_FILE).toString();
@@ -54,6 +51,7 @@ class LocalStorageOperatorTest {
@SneakyThrows
@BeforeEach
public void setup() {
+ Files.createDirectories(Paths.get(resourceBaseDir));
System.setProperty(Constants.RESOURCE_UPLOAD_PATH, resourceBaseDir);
LocalStorageOperatorFactory localStorageOperatorFactory = new
LocalStorageOperatorFactory();