[java] when put an object in plasma store, ignore "object alreay exists" exception (#3687)

* distinct plasma client exception

* Update ObjectStoreProxy.java

* Update and rename PlasmaArrowTest.java to PlasmaStoreTest.java

* store put

* Use testng to replace junit to fix test failure
This commit is contained in:
bibabolynn
2019-02-09 18:03:17 +08:00
committed by Yuhong Guo
parent 29322c7389
commit 728031a972
@@ -0,0 +1,27 @@
package org.ray.api.test;
import org.apache.arrow.plasma.PlasmaClient;
import org.apache.arrow.plasma.exceptions.DuplicateObjectException;
import org.ray.api.Ray;
import org.ray.api.id.UniqueId;
import org.ray.runtime.AbstractRayRuntime;
import org.testng.Assert;
import org.testng.annotations.Test;
public class PlasmaStoreTest extends BaseTest {
@Test
public void testPutWithDuplicateId() {
UniqueId objectId = UniqueId.randomId();
AbstractRayRuntime runtime = (AbstractRayRuntime) Ray.internal();
PlasmaClient store = new PlasmaClient(runtime.getRayConfig().objectStoreSocketName, "", 0);
store.put(objectId.getBytes(), new byte[]{}, new byte[]{});
try {
store.put(objectId.getBytes(), new byte[]{}, new byte[]{});
Assert.fail("This line shouldn't be reached.");
} catch (DuplicateObjectException e) {
// Putting 2 objects with duplicate ID should throw DuplicateObjectException.
}
}
}