diff --git a/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java index d9af69cc858..3fa3f7ca764 100644 --- a/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java +++ b/inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java @@ -467,7 +467,10 @@ public static boolean onlineScheduleForProcessDef(String scheduleUrl, int schedu JsonObject response = executeHttpRequest(url, POST, new HashMap<>(), header); LOGGER.info("online schedule for process definition success, response data: {}", response); - return response.get(DS_RESPONSE_DATA).getAsBoolean(); + if (response != null && !response.get(DS_RESPONSE_DATA).isJsonNull()) { + return response.get(DS_RESPONSE_DATA).getAsBoolean(); + } + return false; } catch (JsonParseException e) { LOGGER.error("JsonParseException during online schedule", e); diff --git a/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleContainerTestEnv.java b/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleContainerTestEnv.java index 8aa6348f794..c57bd6e783d 100644 --- a/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleContainerTestEnv.java +++ b/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleContainerTestEnv.java @@ -71,10 +71,6 @@ public abstract class DolphinScheduleContainerTestEnv extends BaseScheduleTest { private static final Network NETWORK = Network.newNetwork(); - // DS env generated final url and final token - protected static String DS_URL; - protected static String DS_TOKEN; - protected static final GenericContainer dolphinSchedulerContainer = new GenericContainer<>(DS_IMAGE_NAME + ":" + DS_IMAGE_TAG) .withExposedPorts(12345, 25333) diff --git a/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleEngineTest.java b/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleEngineTest.java index acdb173bedd..f95a5268ee3 100644 --- a/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleEngineTest.java +++ b/inlong-manager/manager-schedule/src/test/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleEngineTest.java @@ -27,10 +27,11 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.Timeout; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.ComponentScan; +import javax.annotation.Resource; + import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -41,7 +42,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DolphinScheduleEngineTest extends DolphinScheduleContainerTestEnv { - @Autowired + @Resource private DolphinScheduleEngine dolphinScheduleEngine; @BeforeAll