From 65953fe2573d4358c4bbc023cf8f04f6343345bb Mon Sep 17 00:00:00 2001 From: simon824 Date: Fri, 12 Jun 2020 12:10:17 +0800 Subject: [PATCH] fix testBuildDataxJobContentJson --- .../server/worker/task/datax/DataxTask.java | 2 +- .../server/worker/task/datax/DataxTaskTest.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java index 5a8b8d6706..a14a5d64f5 100755 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java @@ -305,7 +305,7 @@ public class DataxTask extends AbstractTask { List contentList = new ArrayList<>(); ObjectNode content = JSONUtils.createObjectNode(); content.put("reader", reader.toString()); - content.put("writer", reader.toString()); + content.put("writer", writer.toString()); contentList.add(content); return contentList; diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java index 5a9ff568ae..6c3cad5671 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java @@ -25,9 +25,7 @@ import java.util.UUID; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.DbType; -import org.apache.dolphinscheduler.common.task.datax.DataxParameters; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.datasource.BaseDataSource; import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory; @@ -316,13 +314,13 @@ public class DataxTaskTest { Assert.assertNotNull(contentList); ObjectNode content = contentList.get(0); - JsonNode reader = content.path("reader"); + JsonNode reader = JSONUtils.parseObject(content.path("reader").asText()); Assert.assertNotNull(reader); String readerPluginName = reader.path("name").asText(); Assert.assertEquals(DataxUtils.DATAX_READER_PLUGIN_MYSQL, readerPluginName); - JsonNode writer = content.path("writer"); + JsonNode writer = JSONUtils.parseObject(content.path("writer").asText()); Assert.assertNotNull(writer); String writerPluginName = writer.path("name").asText();