diff --git a/oap-formats/oap-tsv/oap-tsv-test/src/test/java/oap/tsv/TsvArrayTest.java b/oap-formats/oap-tsv/oap-tsv-test/src/test/java/oap/tsv/TsvArrayTest.java
index 890fd7297b..147d5ee09c 100644
--- a/oap-formats/oap-tsv/oap-tsv-test/src/test/java/oap/tsv/TsvArrayTest.java
+++ b/oap-formats/oap-tsv/oap-tsv-test/src/test/java/oap/tsv/TsvArrayTest.java
@@ -24,14 +24,13 @@
package oap.tsv;
-import junit.framework.TestCase;
import org.testng.annotations.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
-public class TsvArrayTest extends TestCase {
+public class TsvArrayTest {
@Test
public void testPrint() {
assertThat( TsvArray.print( List.of( 1, 2, 3 ), null ) )
diff --git a/oap-stdlib-test/pom.xml b/oap-stdlib-test/pom.xml
index 9e69773d30..5e46f36c38 100644
--- a/oap-stdlib-test/pom.xml
+++ b/oap-stdlib-test/pom.xml
@@ -43,6 +43,11 @@
oap-stdlib
${parent.version}
+
+ oap
+ oap-teamcity
+ ${oap.deps.oap-teamcity.version}
+
org.testng
diff --git a/oap-stdlib-test/src/main/java/oap/benchmark/AbstractRunner.java b/oap-stdlib-test/src/main/java/oap/benchmark/AbstractRunner.java
index 18eac123c2..3d574a602b 100644
--- a/oap-stdlib-test/src/main/java/oap/benchmark/AbstractRunner.java
+++ b/oap-stdlib-test/src/main/java/oap/benchmark/AbstractRunner.java
@@ -25,7 +25,7 @@
package oap.benchmark;
import lombok.extern.slf4j.Slf4j;
-import oap.testng.Teamcity;
+import oap.teamcity.Teamcity;
import oap.util.Lists;
import oap.util.function.Try;
diff --git a/oap-stdlib-test/src/main/java/oap/testng/Suite.java b/oap-stdlib-test/src/main/java/oap/testng/Suite.java
index 332a68e921..7a9cb9b61c 100644
--- a/oap-stdlib-test/src/main/java/oap/testng/Suite.java
+++ b/oap-stdlib-test/src/main/java/oap/testng/Suite.java
@@ -24,6 +24,8 @@
package oap.testng;
+import oap.teamcity.Teamcity;
+
public class Suite {
private static final String UNIQUE_EXECUTION_ID = Teamcity.buildPrefix() + "_" + System.currentTimeMillis();
diff --git a/oap-stdlib-test/src/main/java/oap/testng/Teamcity.java b/oap-stdlib-test/src/main/java/oap/testng/Teamcity.java
deleted file mode 100644
index 7e3f86728c..0000000000
--- a/oap-stdlib-test/src/main/java/oap/testng/Teamcity.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) Open Application Platform Authors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package oap.testng;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-
-import java.util.function.Supplier;
-
-public class Teamcity {
- public static String escape( String value ) {
- StringBuilder sb = new StringBuilder();
-
- for( int i = 0; i < value.length(); i++ )
- switch( value.charAt( i ) ) {
- case '\'':
- sb.append( "|'" );
- break;
- case '\n':
- sb.append( "|n" );
- break;
- case '\r':
- sb.append( "|r" );
- break;
- case '|':
- sb.append( "||" );
- break;
- case '[':
- sb.append( "|[" );
- break;
- case ']':
- sb.append( "|]" );
- break;
- default:
- sb.append( value.charAt( i ) );
- break;
- }
-
- return sb.toString();
- }
-
- public static void message( MessageStatus status, String text, String errorDetails ) {
- Preconditions.checkArgument( status == MessageStatus.ERROR );
-
- if( isTeamcity() )
- System.out.format( "##teamcity[message text='%s' errorDetails='%s' status='%s']\n",
- escape( text ),
- escape( errorDetails ),
- status.name() );
- }
-
- public static void message( MessageStatus status, String text ) {
- Preconditions.checkArgument( status != MessageStatus.ERROR );
-
- if( isTeamcity() )
- System.out.format( "##teamcity[message text='%s' status='%s']\n",
- escape( text ),
- status.name() );
- }
-
- public static void statistics( String name, Object value ) {
- if( isTeamcity() )
- System.out.format( "##teamcity[buildStatisticValue key='%s' value='%s']\n",
- escape( name ),
- value );
- }
-
- public static T progress( String message, Supplier code ) {
- progressStart( message );
- try {
- return code.get();
- } finally {
- progressEnd( message );
- }
- }
-
- private static void progressStart( String message ) {
- if( isTeamcity() )
- System.out.format( "##teamcity[progressStart '%s']\n", escape( message ) );
- }
-
- private static boolean isTeamcity() {
- return System.getenv( "TEAMCITY_CAPTURE_ENV" ) != null;
- }
-
- private static void progressEnd( String message ) {
- if( isTeamcity() )
- System.out.format( "##teamcity[progressFinish '%s']\n", escape( message ) );
- }
-
- public static void performance( String name, double rate ) {
- statistics( name + ".actions/s", rate );
- }
-
- public static String buildPrefix() {
- String prefix = "";
-
- var teamcityBuildconfName = System.getenv( "TEAMCITY_BUILDCONF_NAME" );
- prefix += "_";
- if( teamcityBuildconfName != null ) prefix += teamcityBuildconfName;
-
- var buildNumber = System.getenv( "BUILD_NUMBER" );
- prefix += "_";
- if( buildNumber != null ) prefix += buildNumber;
-
- return prefix;
- }
-
- public static void testStarted( String testName ) {
- if( isTeamcity() ) {
- System.out.format( "##teamcity[testStarted name='%s' captureStandardOutput='true']\n", escape( testName ) );
- }
- }
-
- public static void testFinished( String testName, long durationMs ) {
- if( isTeamcity() ) {
- System.out.format( "##teamcity[testFinished name='%s' duration='%s']\n", escape( testName ), durationMs );
- }
- }
-
- public static void testIgnored( String testName, String reason ) {
- if( isTeamcity() ) {
- System.out.format( "##teamcity[testIgnored name='%s' message='%s']\n", escape( testName ), escape( reason ) );
- }
- }
-
- public static void testFailed( String testName, Throwable throwable, long durationMs ) {
- if( isTeamcity() ) {
- System.out.format( "##teamcity[testFailed name='%s' message='%s' details='%s']\n",
- escape( testName ), escape( throwable.getMessage() ),
- escape( Throwables.getStackTraceAsString( throwable ) ) );
- }
- testFinished( testName, durationMs );
- }
-
- public enum MessageStatus {
- NORMAL, WARNING, FAILURE, ERROR
- }
-}
diff --git a/oap-stdlib-test/src/main/java/oap/testng/TeamcityTestNGListener.java b/oap-stdlib-test/src/main/java/oap/testng/TeamcityTestNGListener.java
deleted file mode 100644
index 03c747c6bc..0000000000
--- a/oap-stdlib-test/src/main/java/oap/testng/TeamcityTestNGListener.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package oap.testng;
-
-import org.testng.ITestResult;
-import org.testng.internal.IResultListener;
-
-public class TeamcityTestNGListener implements IResultListener {
- @Override
- public void onTestStart( ITestResult result ) {
- Teamcity.testStarted( getTestName( result ) );
- }
-
- @Override
- public void onTestSuccess( ITestResult result ) {
- Teamcity.testFinished( getTestName( result ), result.getStartMillis() - result.getEndMillis() );
- }
-
- @Override
- public void onTestSkipped( ITestResult result ) {
- Teamcity.testIgnored( getTestName( result ), "Skipped" );
- }
-
- @Override
- public void onTestFailure( ITestResult result ) {
- Teamcity.testFailed( getTestName( result ), result.getThrowable(), result.getStartMillis() - result.getEndMillis() );
- }
-
- private String getTestName( ITestResult result ) {
- return result.getTestClass().getRealClass().getSimpleName() + "." + result.getName();
- }
-}
diff --git a/pom.xml b/pom.xml
index 554f85d144..99ca7f5aea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
oap
oap.maven
- 21.0.0
+ 21.1.4
pom
@@ -48,9 +48,10 @@
- 21.6.1
+ 21.6.2
21.0.0
+ 21.0.1
7.8.0
3.24.2