Skip to content

Commit ae71c48

Browse files
authored
Merge branch 'master' into hotfix/compiler-error
2 parents a76ff31 + 76a0135 commit ae71c48

File tree

568 files changed

+43739
-5682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

568 files changed

+43739
-5682
lines changed

.github/workflows/main.yml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
1-
- name: DeepSource Test Coverage Action
2-
# You may pin to the exact commit or the version.
3-
# uses: DeepSourceCorp/test-coverage-action@e02a039827236fa21a95866e7cd0b1c52ca61e76
4-
uses: DeepSourceCorp/test-coverage-action@v1.1.2
5-
with:
6-
# Programming language shortcode for which coverage is reported. Allowed values are — python, go, javascript, ruby, java, kotlin, scala, php, csharp, cxx, rust, swift
7-
key:
8-
# Path to the coverage data file. e.g. ./coverage.xml
9-
coverage-file:
10-
# DeepSource DSN of this repository. It is available under Settings → Reporting tab of the repository page on DeepSource.
11-
dsn:
12-
# Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are — true, false
13-
fail-ci-on-error: # optional
14-
# HEAD commit for which the Test Coverage report is being sent
15-
commit-sha: # optional, default is ${{ github.event.pull_request.head.sha }}
16-
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: [ "main" ] # 触发分支
6+
pull_request:
7+
branches: [ "main" ] # 触发分支
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up JDK 11
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: '11'
20+
distribution: 'temurin' # 选择一个Java发行版
21+
cache: maven # 缓存m2仓库以加速构建
22+
- name: Build with Maven
23+
run: mvn -B clean package --file pom.xml
24+
- name: Run JUnit tests
25+
run: mvn -B verify --file pom.xml
26+
- name: Archive test results
27+
if: always()
28+
uses: actions/upload-artifact@v3
29+
with:
30+
name: test-results
31+
path: target/surefire-reports/

README_zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ MigrationX 是一款基于 FlowSpec 规范的工作流迁移工具,它可以
429429

430430
## 整体架构
431431

432-
![image](docs/images/architecture.jpg)
432+
![image](docs/images/architecture-cn.jpg)
433433

434434
### 领域模型
435435

client/migrationx-common/pom.xml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@
2222
<parent>
2323
<artifactId>migrationx</artifactId>
2424
<groupId>com.aliyun.dataworks</groupId>
25-
<version>1.1.5</version>
25+
<version>1.1.7-workflow-preview3</version>
26+
<relativePath>../pom.xml</relativePath>
2627
</parent>
2728

2829
<artifactId>migrationx-common</artifactId>
29-
<version>1.1.5</version>
3030

31-
<properties>
32-
<maven.compiler.source>8</maven.compiler.source>
33-
<maven.compiler.target>8</maven.compiler.target>
34-
</properties>
3531

3632
<dependencies>
3733
<dependency>
@@ -42,13 +38,9 @@
4238
<groupId>com.google.guava</groupId>
4339
<artifactId>guava</artifactId>
4440
</dependency>
45-
<dependency>
46-
<groupId>org.apache.tomcat.embed</groupId>
47-
<artifactId>tomcat-embed-core</artifactId>
48-
</dependency>
4941
<dependency>
5042
<groupId>org.springframework</groupId>
51-
<artifactId>spring-web</artifactId>
43+
<artifactId>spring-core</artifactId>
5244
</dependency>
5345
<dependency>
5446
<groupId>org.hibernate.validator</groupId>
@@ -95,10 +87,35 @@
9587
<groupId>org.apache.commons</groupId>
9688
<artifactId>commons-lang3</artifactId>
9789
</dependency>
90+
<dependency>
91+
<groupId>com.fasterxml.jackson.core</groupId>
92+
<artifactId>jackson-core</artifactId>
93+
</dependency>
94+
<dependency>
95+
<groupId>com.fasterxml.jackson.core</groupId>
96+
<artifactId>jackson-annotations</artifactId>
97+
</dependency>
98+
<dependency>
99+
<groupId>com.fasterxml.jackson.core</groupId>
100+
<artifactId>jackson-databind</artifactId>
101+
</dependency>
98102
</dependencies>
99103

100104
<build>
101105
<plugins>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-source-plugin</artifactId>
109+
<version>3.0.1</version>
110+
<executions>
111+
<execution>
112+
<id>attach-sources</id>
113+
<goals>
114+
<goal>jar</goal>
115+
</goals>
116+
</execution>
117+
</executions>
118+
</plugin>
102119
<plugin>
103120
<groupId>org.apache.maven.plugins</groupId>
104121
<artifactId>maven-dependency-plugin</artifactId>

client/migrationx-common/src/main/java/com/aliyun/migrationx/common/command/appbase/CommandAppEntrance.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,27 @@
1515

1616
package com.aliyun.migrationx.common.command.appbase;
1717

18+
import java.io.File;
19+
import java.io.IOException;
20+
import java.nio.charset.StandardCharsets;
21+
import java.util.Map;
22+
1823
import com.aliyun.migrationx.common.exception.BizException;
1924
import com.aliyun.migrationx.common.exception.ErrorCode;
2025
import com.aliyun.migrationx.common.utils.GsonUtils;
26+
2127
import com.google.common.base.Joiner;
2228
import com.google.gson.reflect.TypeToken;
2329
import lombok.extern.slf4j.Slf4j;
24-
import org.apache.commons.cli.*;
30+
import org.apache.commons.cli.CommandLine;
31+
import org.apache.commons.cli.CommandLineParser;
32+
import org.apache.commons.cli.DefaultParser;
33+
import org.apache.commons.cli.HelpFormatter;
34+
import org.apache.commons.cli.Options;
35+
import org.apache.commons.cli.ParseException;
2536
import org.apache.commons.collections4.MapUtils;
2637
import org.apache.commons.io.FileUtils;
2738

28-
import java.io.File;
29-
import java.io.IOException;
30-
import java.nio.charset.StandardCharsets;
31-
import java.util.Map;
32-
3339
/**
3440
* @author 聿剑
3541
* @date 2022/10/20
@@ -85,10 +91,10 @@ private static Map<AppType, Map<String, AppMeta>> loadApps(String conf) throws I
8591
appMeta.setName(appName);
8692
appMeta.setType(appType);
8793
log.info("register command app type: {}, name: {}, class: {}", appType, appName, appMeta.getAppClass());
88-
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>)Class.forName(appMeta.getAppClass()));
94+
CommandAppFactory.register(appType, appName, (Class<? extends CommandApp>) Class.forName(appMeta.getAppClass()));
8995
} catch (ClassNotFoundException e) {
9096
log.info("register command app failed, appType: {}, appName: {}, class: {}, error: {}",
91-
appType, appName, appMeta.getAppClass(), e.getMessage());
97+
appType, appName, appMeta.getAppClass(), e);
9298
}
9399
}));
94100

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.aliyun.migrationx.common.context;
2+
3+
import java.io.File;
4+
import java.io.FileNotFoundException;
5+
6+
import com.aliyun.migrationx.common.metrics.DolphinMetricsCollector;
7+
import com.aliyun.migrationx.common.metrics.MetricsCollector;
8+
import com.aliyun.migrationx.common.metrics.enums.CollectorType;
9+
10+
import org.apache.commons.lang3.StringUtils;
11+
12+
public class TransformerContext {
13+
private static final ThreadLocal<TransformerContext> threadLocal = new ThreadLocal<>();
14+
15+
private MetricsCollector metricsCollector;
16+
17+
private File checkpoint;
18+
private File load;
19+
20+
public File getCheckpoint() {
21+
return checkpoint;
22+
}
23+
24+
public void setCheckpoint(String checkpoint) throws FileNotFoundException {
25+
if (StringUtils.isNotEmpty(checkpoint)) {
26+
File file = new File(checkpoint);
27+
if (file.exists()) {
28+
this.checkpoint = file;
29+
} else {
30+
throw new FileNotFoundException(checkpoint);
31+
}
32+
}
33+
}
34+
35+
public File getLoad() {
36+
return load;
37+
}
38+
39+
public void setLoad(String load) throws FileNotFoundException {
40+
if (StringUtils.isNotEmpty(load)) {
41+
File file = new File(load);
42+
if (file.exists()) {
43+
this.load = file;
44+
} else {
45+
throw new FileNotFoundException(load);
46+
}
47+
}
48+
}
49+
50+
private TransformerContext() {
51+
}
52+
53+
public static void init(CollectorType type) {
54+
TransformerContext context = new TransformerContext();
55+
switch (type) {
56+
case DolphinScheduler:
57+
context.metricsCollector = new DolphinMetricsCollector();
58+
break;
59+
default:
60+
throw new UnsupportedOperationException(type.name());
61+
}
62+
threadLocal.set(context);
63+
}
64+
65+
public static TransformerContext getContext() {
66+
return threadLocal.get();
67+
}
68+
69+
public static MetricsCollector getCollector() {
70+
return threadLocal.get().metricsCollector;
71+
}
72+
73+
public static void clear() {
74+
threadLocal.remove();
75+
}
76+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.aliyun.migrationx.common.exception;
2+
3+
public class UnSupportedTypeException extends RuntimeException {
4+
private String type;
5+
6+
public UnSupportedTypeException(String type) {
7+
super("unsupported converter task type: " + type);
8+
this.type = type;
9+
}
10+
}

0 commit comments

Comments
 (0)