Support to auto-generate Java files from flatbuffer (#3749)

* auto gen flatbuffers for Java

* Add auto_gen_tool.py

* Refine

* Add a comment

* address comments.

* Address comments.

* Addressed

* Refine

* Address comments

* Fix typo

* Add exception

* Address comments.

* Refine

* Fix lint

* Fix

* Fix lint and address comment.

* Fix lint error
This commit is contained in:
Wang Qing
2019-01-14 03:39:23 +08:00
committed by Philipp Moritz
parent d2cf8561f2
commit 8674606e26
17 changed files with 213 additions and 392 deletions
@@ -2,6 +2,7 @@ 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;
@@ -79,4 +80,20 @@ public class UniqueIdTest {
Assert.assertEquals("FCFCFDFE123456789ABCDEF123456789ABCDEF00".toLowerCase(), putId.toString());
}
@Test
public void testUniqueIdsAndByteBufferInterConversion() {
final int len = 5;
UniqueId[] ids = new UniqueId[len];
for (int i = 0; i < len; ++i) {
ids[i] = UniqueId.randomId();
}
ByteBuffer temp = UniqueIdUtil.concatUniqueIds(ids);
UniqueId[] res = UniqueIdUtil.getUniqueIdsFromByteBuffer(temp);
for (int i = 0; i < len; ++i) {
Assert.assertEquals(ids[i], res[i]);
}
}
}