Browse Source

fix testBuildDataxJobContentJson

pull/2/head
simon824 4 years ago
parent
commit
65953fe257
  1. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java
  2. 6
      dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTaskTest.java

2
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<>(); List<ObjectNode> contentList = new ArrayList<>();
ObjectNode content = JSONUtils.createObjectNode(); ObjectNode content = JSONUtils.createObjectNode();
content.put("reader", reader.toString()); content.put("reader", reader.toString());
content.put("writer", reader.toString()); content.put("writer", writer.toString());
contentList.add(content); contentList.add(content);
return contentList; return contentList;

6
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.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode; 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.enums.DbType;
import org.apache.dolphinscheduler.common.task.datax.DataxParameters;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource; import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory; import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
@ -316,13 +314,13 @@ public class DataxTaskTest {
Assert.assertNotNull(contentList); Assert.assertNotNull(contentList);
ObjectNode content = contentList.get(0); ObjectNode content = contentList.get(0);
JsonNode reader = content.path("reader"); JsonNode reader = JSONUtils.parseObject(content.path("reader").asText());
Assert.assertNotNull(reader); Assert.assertNotNull(reader);
String readerPluginName = reader.path("name").asText(); String readerPluginName = reader.path("name").asText();
Assert.assertEquals(DataxUtils.DATAX_READER_PLUGIN_MYSQL, readerPluginName); Assert.assertEquals(DataxUtils.DATAX_READER_PLUGIN_MYSQL, readerPluginName);
JsonNode writer = content.path("writer"); JsonNode writer = JSONUtils.parseObject(content.path("writer").asText());
Assert.assertNotNull(writer); Assert.assertNotNull(writer);
String writerPluginName = writer.path("name").asText(); String writerPluginName = writer.path("name").asText();

Loading…
Cancel
Save