Skip to content

Commit

Permalink
Merge pull request #52 from aliyun/feature/release-v1.1.9-10
Browse files Browse the repository at this point in the history
Feature/release v1.1.9 10
  • Loading branch information
Garfier authored Jan 9, 2025
2 parents 72c47a0 + 71e2230 commit a6be5a6
Show file tree
Hide file tree
Showing 33 changed files with 283 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/client-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.aliyun.dataworks</groupId>
<artifactId>client</artifactId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion client/client-spark-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.aliyun.dataworks</groupId>
<artifactId>client</artifactId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion client/client-toolkits/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.aliyun.dataworks</groupId>
<artifactId>client</artifactId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
6 changes: 1 addition & 5 deletions client/migrationx/migrationx-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>migrationx</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -41,10 +41,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.aliyun.dataworks</groupId>
<artifactId>migrationx-domain</artifactId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>com.aliyun.dataworks</groupId>
<artifactId>migrationx-domain</artifactId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -56,18 +56,9 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dataworks_public20240518</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,19 @@ public Specification<DataWorksWorkflowSpec> getNodeSpecObject(DwNodeEntity dwNod
} else {
BasicNodeSpecHandler nodeSpecHandler = (BasicNodeSpecHandler)getHandler(dwNode, context.getLocale());
nodeSpecHandler.setContext(context);
dataWorksWorkflowSpec.setFlow(toFlow(nodeSpecHandler, dwNode, context));
List<SpecNode> nodes = new ArrayList<>();
Optional.ofNullable(nodeSpecHandler.handle(dwNode)).ifPresent(nodes::add);
dataWorksWorkflowSpec.setNodes(nodes);
if (dwNode.getParentNode() == null) {
dataWorksWorkflowSpec.setFlow(toFlow(nodeSpecHandler, dwNode, context));
List<SpecNode> nodes = new ArrayList<>();
Optional.ofNullable(nodeSpecHandler.handle(dwNode)).ifPresent(nodes::add);
dataWorksWorkflowSpec.setNodes(nodes);
} else {
// for inner node
BasicNodeSpecHandler parentNodeHandler = (BasicNodeSpecHandler)getHandler(dwNode.getParentNode(), context.getLocale());
dataWorksWorkflowSpec.setFlow(toFlow(parentNodeHandler, dwNode.getParentNode(), context));
List<SpecNode> nodes = new ArrayList<>();
Optional.ofNullable(parentNodeHandler.handle(dwNode.getParentNode(), Collections.singletonList(dwNode))).ifPresent(nodes::add);
dataWorksWorkflowSpec.setNodes(nodes);
}
}
});
return spec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,15 @@ default Long getParentId() {
return null;
}

/**
* get parent node info
*
* @return parent node
*/
default DwNodeEntity getParentNode() {
return null;
}

/**
* get cu
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@
@Slf4j
public class DwNodeEntityAdapter implements DwNodeEntity {
private final DwNode dwNode;
private DwNode dwParentNode;

public DwNodeEntityAdapter(DwNode dwNode) {
this.dwNode = dwNode;
}

public DwNodeEntityAdapter(DwNode dwNode, DwNode dwParentNode) {
this.dwNode = dwNode;
this.dwParentNode = dwParentNode;
}

@Override
public String getUuid() {
return dwNode.getGlobalUuid();
Expand Down Expand Up @@ -375,6 +381,11 @@ public Long getParentId() {
return null;
}

@Override
public DwNodeEntity getParentNode() {
return Optional.ofNullable(dwParentNode).map(DwNodeEntityAdapter::new).orElse(null);
}

@Override
public String getCu() {
return dwNode.getCu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ protected boolean matchNodeType(DwNodeEntity dwNode, String nodeType) {
.orElse(false);
}

@SuppressWarnings("unchecked")
@Override
public SpecNode handle(DwNodeEntity dmNode) {
Preconditions.checkNotNull(dmNode, "dmNode is null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,24 @@ public SpecNode handle(DwNodeEntity dmNodeBo) {
SpecNode specNode = super.handle(dmNodeBo);

if (support(dmNodeBo)) {
specNode.setDoWhile(buildDoWhile(dmNodeBo, context));
List<DwNodeEntity> innerNodes = getInnerNodes(dmNodeBo);
specNode.setDoWhile(buildDoWhile(dmNodeBo, innerNodes, context));
}
return specNode;
}

private SpecDoWhile buildDoWhile(DwNodeEntity orcNode, SpecHandlerContext context) {
List<DwNodeEntity> innerNodes = getInnerNodes(orcNode);
@Override
public SpecNode handle(DwNodeEntity parentNode, List<DwNodeEntity> innerNodes) {
Preconditions.checkNotNull(parentNode, "node is null");
SpecNode specNode = super.handle(parentNode);

if (support(parentNode)) {
specNode.setDoWhile(buildDoWhile(parentNode, innerNodes, context));
}
return specNode;
}

private SpecDoWhile buildDoWhile(DwNodeEntity orcNode, List<DwNodeEntity> innerNodes, SpecHandlerContext context) {
SpecDoWhile specDoWhile = new SpecDoWhile();
specDoWhile.setMaxIterations(orcNode.getLoopCount());
specDoWhile.setNodes(innerNodes.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,23 @@ public SpecNode handle(DwNodeEntity orcNode) {
Preconditions.checkNotNull(orcNode, "node is null");
SpecNode specNode = super.handle(orcNode);
if (support(orcNode)) {
specNode.setForeach(buildForEach(orcNode, specNode, context));
List<DwNodeEntity> innerNodes = getInnerNodes(orcNode);
specNode.setForeach(buildForEach(orcNode, specNode, innerNodes, context));
}
return specNode;
}

private SpecForEach buildForEach(DwNodeEntity orcNode, SpecNode specNode, SpecHandlerContext context) {
List<DwNodeEntity> innerNodes = getInnerNodes(orcNode);
@Override
public SpecNode handle(DwNodeEntity parentNode, List<DwNodeEntity> innerNodes) {
Preconditions.checkNotNull(parentNode, "node is null");
SpecNode specNode = super.handle(parentNode);
if (support(parentNode)) {
specNode.setForeach(buildForEach(parentNode, specNode, innerNodes, context));
}
return specNode;
}

private SpecForEach buildForEach(DwNodeEntity orcNode, SpecNode specNode, List<DwNodeEntity> innerNodes, SpecHandlerContext context) {
SpecForEach specForEach = new SpecForEach();
specForEach.setNodes(innerNodes.stream()
.map(n -> getSpecAdapter().getHandler(n, context.getLocale()).handle(n))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.aliyun.dataworks.migrationx.domain.dataworks.service.spec;

import java.util.Arrays;
import java.util.Collections;

import javax.validation.constraints.NotNull;

Expand All @@ -27,11 +28,12 @@
import com.aliyun.dataworks.common.spec.domain.ref.SpecNode;
import com.aliyun.dataworks.common.spec.domain.ref.component.SpecComponent;
import com.aliyun.dataworks.migrationx.domain.dataworks.objects.entity.DwNode;
import com.aliyun.dataworks.migrationx.domain.dataworks.objects.entity.DwNodeIo;
import com.aliyun.dataworks.migrationx.domain.dataworks.objects.entity.NodeIo;
import com.aliyun.dataworks.migrationx.domain.dataworks.objects.types.NodeUseType;
import com.aliyun.dataworks.migrationx.domain.dataworks.service.spec.entity.DwNodeEntityAdapter;
import com.aliyun.dataworks.migrationx.domain.dataworks.service.spec.handler.BasicNodeSpecHandler;
import com.aliyun.dataworks.migrationx.domain.dataworks.service.spec.handler.ForeachNodeSpecHandler;

import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
Expand All @@ -49,7 +51,7 @@ public void testGetHandler() {
DwNode dwNode = new DwNode();
dwNode.setType(CodeProgramType.CONTROLLER_TRAVERSE.getName());
@NotNull
BasicNodeSpecHandler handler = (BasicNodeSpecHandler) adapter.getHandler(new DwNodeEntityAdapter(dwNode), null);
BasicNodeSpecHandler handler = (BasicNodeSpecHandler)adapter.getHandler(new DwNodeEntityAdapter(dwNode), null);
Assert.assertNotNull(handler);
Assert.assertEquals(ForeachNodeSpecHandler.class, handler.getClass());
}
Expand All @@ -61,7 +63,7 @@ public void testGetHandlerByDefault() {
DwNode dwNode = new DwNode();
dwNode.setType(CodeProgramType.ODPS_SQL.getName());
@NotNull
BasicNodeSpecHandler handler = (BasicNodeSpecHandler) adapter.getHandler(new DwNodeEntityAdapter(dwNode), null);
BasicNodeSpecHandler handler = (BasicNodeSpecHandler)adapter.getHandler(new DwNodeEntityAdapter(dwNode), null);
Assert.assertNotNull(handler);
Assert.assertEquals(BasicNodeSpecHandler.class, handler.getClass());
}
Expand Down Expand Up @@ -103,6 +105,39 @@ public void testGetNodeSpec() {
Assert.assertEquals(3, foreach.getForeach().getNodes().size());
}

@Test
public void testGetInnerNodeSpec() {
DwNode dwNode = new DwNode();
dwNode.setName("test1");
dwNode.setGlobalUuid("test1Uuid");
dwNode.setType(CodeProgramType.CONTROLLER_TRAVERSE.getName());
dwNode.setNodeUseType(NodeUseType.SCHEDULED);
DwNode sql = new DwNode();
sql.setName("sql");
sql.setGlobalUuid("sqlUuid");
sql.setType(CodeProgramType.ODPS_SQL.getName());
sql.setNodeUseType(NodeUseType.SCHEDULED);
NodeIo sqlInput = new DwNodeIo();
sqlInput.setData("autotest.start");
sql.setInputs(Collections.singletonList(sqlInput));

NodeSpecAdapter adapter = new NodeSpecAdapter();
SpecHandlerContext context = new SpecHandlerContext();
String spec = adapter.getNodeSpec(new DwNodeEntityAdapter(sql, dwNode), context);
log.info("spec: {}", spec);

Specification<DataWorksWorkflowSpec> sp = SpecUtil.parseToDomain(spec);
Assert.assertNotNull(sp);
Assert.assertNotNull(sp.getSpec());
Assert.assertNotNull(sp.getSpec().getNodes());
Assert.assertEquals(1, sp.getSpec().getNodes().size());
SpecNode foreach = sp.getSpec().getNodes().get(0);
Assert.assertNotNull(foreach.getForeach());
Assert.assertNotNull(foreach.getForeach().getNodes());
Assert.assertEquals(1, foreach.getForeach().getNodes().size());
Assert.assertEquals(1, foreach.getForeach().getFlow().size());
}

@Test
public void testComponent() {
DwNode dwNode = new DwNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.aliyun.dataworks.migrationx.domain.dataworks.dolphinscheduler.v1.QueryProcessDefinitionByPaginateRequest;
import com.aliyun.migrationx.common.http.HttpClientUtil;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockedConstruction;
Expand All @@ -34,7 +33,6 @@
* @date 2022/10/20
*/
@RunWith(MockitoJUnitRunner.class)
@Ignore
public class DolphinSchedulerApiServiceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>migrationx-domain</artifactId>
<groupId>com.aliyun.dataworks</groupId>
<version>1.1.9-8</version>
<version>1.1.9-10</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit a6be5a6

Please sign in to comment.