Skip to content

Commit

Permalink
Merge pull request #38 from aliyun/feature/release-v1.1.7-2-fix-ut
Browse files Browse the repository at this point in the history
update to release version 1.1.7-2 fix ut
  • Loading branch information
Garfier authored Sep 12, 2024
2 parents 407a704 + 1e8af20 commit 7247d55
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import java.io.File;
import java.io.FileNotFoundException;

import com.aliyun.migrationx.common.metrics.DefaultMetricCollector;
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 static final ThreadLocal<TransformerContext> threadLocal = ThreadLocal.withInitial(() -> {
TransformerContext ctx = new TransformerContext();
ctx.metricsCollector = new DefaultMetricCollector();
return ctx;
});

private MetricsCollector metricsCollector;

Expand Down Expand Up @@ -57,7 +62,7 @@ public static void init(CollectorType type) {
context.metricsCollector = new DolphinMetricsCollector();
break;
default:
throw new UnsupportedOperationException(type.name());
context.metricsCollector = new DefaultMetricCollector();
}
threadLocal.set(context);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.aliyun.migrationx.common.metrics;

import java.util.function.Consumer;

import com.aliyun.migrationx.common.metrics.DolphinMetricsCollector.Summary;

/**
* default implement
* @author 聿剑
* @date 2024/9/12
*/
public class DefaultMetricCollector implements MetricsCollector{
@Override
public void setMetricsConsumer(Consumer<Metrics> consumer) {

}

@Override
public void setTransformerType(String type) {

}

@Override
public void setTotalTasks(int total) {

}

@Override
public void markSuccessMiddleProcess(Metrics metrics) {

}

@Override
public void markFailedSpecProcess(String workflowName, String nodeName) {

}

@Override
public void markFailedMiddleProcess(Metrics metrics) {

}

@Override
public void markSkippedProcess(Metrics metrics) {

}

@Override
public void markTempSpecProcess(String workflowName, String nodeName) {

}

@Override
public void markTempSpecProcess(Metrics metrics) {

}

@Override
public void markSuccessSpecProcess(String workflowName, String nodeName) {

}

@Override
public void markSuccessSpecProcess(Metrics metrics) {

}

@Override
public void markSuccessSpecProcess(Metrics tmp, Consumer<Metrics> c) {

}

@Override
public void markFailedSpecProcess(Metrics metrics) {

}

@Override
public void finishCollector() {

}

@Override
public void finishCollector(Consumer<Summary> c) {

}

@Override
public Progress progress() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import com.aliyun.dataworks.migrationx.domain.dataworks.objects.types.WorkflowType;
import com.aliyun.dataworks.migrationx.domain.dataworks.service.impl.DataWorksSpecPackageFileService;

import com.aliyun.migrationx.common.context.TransformerContext;
import com.aliyun.migrationx.common.metrics.enums.CollectorType;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
4 changes: 4 additions & 0 deletions client/migrationx-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@
<skipAssembly>true</skipAssembly>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
4 changes: 4 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
41 changes: 41 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@
<dom4j.version>1.6.1</dom4j.version>
<powermock.version>2.0.9</powermock.version>
<druid.version>1.2.4</druid.version>
<powermock.jdk11.argLine>
--add-opens java.base/java.text=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--add-modules java.xml
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.base/sun.nio.cs=ALL-UNNAMED
--add-exports java.base/sun.security.ssl=ALL-UNNAMED
--add-exports java.base/sun.security.util=ALL-UNNAMED
--add-exports java.base/sun.security.provider=ALL-UNNAMED
--add-exports java.base/sun.security.action=ALL-UNNAMED
--add-exports java.base/sun.security.jca=ALL-UNNAMED
--add-exports java.base/sun.security.x509=ALL-UNNAMED
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED
--add-exports java.base/sun.security.rsa=ALL-UNNAMED
--add-exports java.base/sun.security.tools=ALL-UNNAMED
--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED
--add-exports java.base/sun.security.tools.jarsigner=ALL-UNNAMED
--add-exports java.base/sun.security.tools.policytool=ALL-UNNAMED
--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED
--add-exports java.base/sun.security.tools.policytool=ALL-UNNAMED
--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED
--add-exports java.base/sun.security.tools.policytool=ALL-UNNAMED
--add-exports java.xml/jdk.xml.internal=ALL-UNNAMED
</powermock.jdk11.argLine>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -306,6 +331,22 @@
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<argLine>${powermock.jdk11.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<argLine>${powermock.jdk11.argLine}</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

0 comments on commit 7247d55

Please sign in to comment.