Quellcode durchsuchen

fix testBuildDataxJobContentJson

simon824 vor 4 Jahren
Ursprung
Commit
65953fe257

+ 1 - 1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java

@@ -305,7 +305,7 @@ public class DataxTask extends AbstractTask {
         List<ObjectNode> 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;

+ 2 - 4
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();