[Java] Replace junit with testNG (#3768)

This commit is contained in:
Wang Qing 2019-01-14 17:49:17 +08:00 committed by Hao Chen
parent 19908c01b8
commit 3cf59855af
25 changed files with 52 additions and 55 deletions

View file

@ -111,9 +111,9 @@
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.9</version>
</dependency>
</dependencies>
</dependencyManagement>

View file

@ -72,8 +72,8 @@
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View file

@ -7,15 +7,14 @@ import java.nio.file.StandardCopyOption;
import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.ray.api.annotation.RayRemote;
import org.ray.api.function.RayFunc0;
import org.ray.api.function.RayFunc1;
import org.ray.api.id.UniqueId;
import org.ray.runtime.functionmanager.FunctionManager.DriverFunctionTable;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests for {@link FunctionManager}

View file

@ -30,8 +30,8 @@
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>

View file

@ -1,10 +1,10 @@
package org.ray.api.benchmark;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.testng.annotations.Test;
public class ActorPressTest extends RayBenchmarkTest {

View file

@ -1,10 +1,10 @@
package org.ray.api.benchmark;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.testng.annotations.Test;
public class MaxPressureTest extends RayBenchmarkTest {

View file

@ -1,10 +1,10 @@
package org.ray.api.benchmark;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.testng.annotations.Test;
public class RateLimiterPressureTest extends RayBenchmarkTest {

View file

@ -6,7 +6,6 @@ import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
@ -14,6 +13,7 @@ import org.ray.api.annotation.RayRemote;
import org.ray.api.test.BaseTest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
public abstract class RayBenchmarkTest<T> extends BaseTest implements Serializable {

View file

@ -1,10 +1,10 @@
package org.ray.api.benchmark;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.testng.annotations.Test;
public class SingleLatencyTest extends RayBenchmarkTest {

View file

@ -5,12 +5,12 @@ import static org.ray.runtime.util.SystemUtil.pid;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.annotation.RayRemote;
import org.ray.api.options.ActorCreationOptions;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ActorReconstructionTest extends BaseTest {

View file

@ -1,7 +1,5 @@
package org.ray.api.test;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
@ -9,6 +7,8 @@ import org.ray.api.annotation.RayRemote;
import org.ray.api.function.RayFunc2;
import org.ray.api.id.UniqueId;
import org.ray.runtime.RayActorImpl;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ActorTest extends BaseTest {

View file

@ -1,20 +1,22 @@
package org.ray.api.test;
import java.io.File;
import org.junit.After;
import org.junit.Before;
import org.ray.api.Ray;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
public class BaseTest {
@Before
@BeforeMethod
public void setUp() {
System.setProperty("ray.home", "../..");
System.setProperty("ray.resources", "CPU:4,RES-A:4");
Ray.init();
}
@After
@AfterMethod
public void tearDown() {
// TODO(qwang): This is double check to check that the socket file is removed actually.
// We could not enable this until `systemInfo` enabled.

View file

@ -1,11 +1,11 @@
package org.ray.api.test;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.exception.RayException;
import org.testng.Assert;
import org.testng.annotations.Test;
public class FailureTest extends BaseTest {

View file

@ -1,10 +1,10 @@
package org.ray.api.test;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Hello world.

View file

@ -9,13 +9,13 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.WaitResult;
import org.ray.api.annotation.RayRemote;
import org.testng.Assert;
import org.testng.annotations.Test;
public class MultiThreadingTest extends BaseTest {

View file

@ -3,12 +3,11 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.id.UniqueId;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Test putting and getting objects.

View file

@ -3,14 +3,13 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.WaitResult;
import org.ray.api.annotation.RayRemote;
import org.ray.api.id.UniqueId;
import org.testng.Assert;
import org.testng.annotations.Test;
public class PlasmaFreeTest extends BaseTest {

View file

@ -2,15 +2,13 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ray.api.Ray;
import org.ray.api.annotation.RayRemote;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Test Ray.call API
@ -87,7 +85,7 @@ public class RayCallTest extends BaseTest {
Assert.assertEquals(1, (long) Ray.call(RayCallTest::testLong, 1L).get());
Assert.assertEquals(1.0, Ray.call(RayCallTest::testDouble, 1.0).get(), 0.0);
Assert.assertEquals(1.0f, Ray.call(RayCallTest::testFloat, 1.0f).get(), 0.0);
Assert.assertEquals(true, Ray.call(RayCallTest::testBool, true).get());
Assert.assertTrue(Ray.call(RayCallTest::testBool, true).get());
Assert.assertEquals("foo", Ray.call(RayCallTest::testString, "foo").get());
List<Integer> list = ImmutableList.of(1, 2, 3);
Assert.assertEquals(list, Ray.call(RayCallTest::testList, list).get());

View file

@ -1,10 +1,10 @@
package org.ray.api.test;
import org.junit.Assert;
import org.junit.Test;
import org.ray.runtime.config.RayConfig;
import org.ray.runtime.config.RunMode;
import org.ray.runtime.config.WorkerMode;
import org.testng.Assert;
import org.testng.annotations.Test;
public class RayConfigTest {

View file

@ -3,11 +3,11 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.WaitResult;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Integration test for Ray.*

View file

@ -2,8 +2,6 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
@ -11,6 +9,8 @@ import org.ray.api.WaitResult;
import org.ray.api.annotation.RayRemote;
import org.ray.api.options.ActorCreationOptions;
import org.ray.api.options.CallOptions;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* Resources Management Test.

View file

@ -3,12 +3,12 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayActor;
import org.ray.api.RayObject;
import org.ray.api.id.UniqueId;
import org.testng.Assert;
import org.testng.annotations.Test;
public class StressTest extends BaseTest {

View file

@ -2,12 +2,11 @@ package org.ray.api.test;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.DatatypeConverter;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.id.UniqueId;
import org.ray.runtime.util.UniqueIdUtil;
import org.testng.Assert;
import org.testng.annotations.Test;
public class UniqueIdTest {

View file

@ -3,12 +3,12 @@ package org.ray.api.test;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.WaitResult;
import org.ray.api.annotation.RayRemote;
import org.testng.Assert;
import org.testng.annotations.Test;
public class WaitTest extends BaseTest {

View file

@ -3,11 +3,12 @@ package org.ray.api.test;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.ray.api.Ray;
import org.ray.api.RayObject;
import org.ray.api.annotation.RayRemote;
import org.ray.runtime.util.FileUtil;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* given a directory of document files on each "machine", we would like to count the appearance of