-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into hotfix/compiler-error
- Loading branch information
Showing
568 changed files
with
43,739 additions
and
5,682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
- name: DeepSource Test Coverage Action | ||
# You may pin to the exact commit or the version. | ||
# uses: DeepSourceCorp/test-coverage-action@e02a039827236fa21a95866e7cd0b1c52ca61e76 | ||
uses: DeepSourceCorp/test-coverage-action@v1.1.2 | ||
with: | ||
# Programming language shortcode for which coverage is reported. Allowed values are — python, go, javascript, ruby, java, kotlin, scala, php, csharp, cxx, rust, swift | ||
key: | ||
# Path to the coverage data file. e.g. ./coverage.xml | ||
coverage-file: | ||
# DeepSource DSN of this repository. It is available under Settings → Reporting tab of the repository page on DeepSource. | ||
dsn: | ||
# Should the CI build fail if there is an error while uploading the report to DeepSource? Allowed values are — true, false | ||
fail-ci-on-error: # optional | ||
# HEAD commit for which the Test Coverage report is being sent | ||
commit-sha: # optional, default is ${{ github.event.pull_request.head.sha }} | ||
|
||
name: Java CI with Maven | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] # 触发分支 | ||
pull_request: | ||
branches: [ "main" ] # 触发分支 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' # 选择一个Java发行版 | ||
cache: maven # 缓存m2仓库以加速构建 | ||
- name: Build with Maven | ||
run: mvn -B clean package --file pom.xml | ||
- name: Run JUnit tests | ||
run: mvn -B verify --file pom.xml | ||
- name: Archive test results | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-results | ||
path: target/surefire-reports/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...rationx-common/src/main/java/com/aliyun/migrationx/common/context/TransformerContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.aliyun.migrationx.common.context; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
|
||
import com.aliyun.migrationx.common.metrics.DolphinMetricsCollector; | ||
import com.aliyun.migrationx.common.metrics.MetricsCollector; | ||
import com.aliyun.migrationx.common.metrics.enums.CollectorType; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public class TransformerContext { | ||
private static final ThreadLocal<TransformerContext> threadLocal = new ThreadLocal<>(); | ||
|
||
private MetricsCollector metricsCollector; | ||
|
||
private File checkpoint; | ||
private File load; | ||
|
||
public File getCheckpoint() { | ||
return checkpoint; | ||
} | ||
|
||
public void setCheckpoint(String checkpoint) throws FileNotFoundException { | ||
if (StringUtils.isNotEmpty(checkpoint)) { | ||
File file = new File(checkpoint); | ||
if (file.exists()) { | ||
this.checkpoint = file; | ||
} else { | ||
throw new FileNotFoundException(checkpoint); | ||
} | ||
} | ||
} | ||
|
||
public File getLoad() { | ||
return load; | ||
} | ||
|
||
public void setLoad(String load) throws FileNotFoundException { | ||
if (StringUtils.isNotEmpty(load)) { | ||
File file = new File(load); | ||
if (file.exists()) { | ||
this.load = file; | ||
} else { | ||
throw new FileNotFoundException(load); | ||
} | ||
} | ||
} | ||
|
||
private TransformerContext() { | ||
} | ||
|
||
public static void init(CollectorType type) { | ||
TransformerContext context = new TransformerContext(); | ||
switch (type) { | ||
case DolphinScheduler: | ||
context.metricsCollector = new DolphinMetricsCollector(); | ||
break; | ||
default: | ||
throw new UnsupportedOperationException(type.name()); | ||
} | ||
threadLocal.set(context); | ||
} | ||
|
||
public static TransformerContext getContext() { | ||
return threadLocal.get(); | ||
} | ||
|
||
public static MetricsCollector getCollector() { | ||
return threadLocal.get().metricsCollector; | ||
} | ||
|
||
public static void clear() { | ||
threadLocal.remove(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...common/src/main/java/com/aliyun/migrationx/common/exception/UnSupportedTypeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.aliyun.migrationx.common.exception; | ||
|
||
public class UnSupportedTypeException extends RuntimeException { | ||
private String type; | ||
|
||
public UnSupportedTypeException(String type) { | ||
super("unsupported converter task type: " + type); | ||
this.type = type; | ||
} | ||
} |
Oops, something went wrong.