summaryrefslogtreecommitdiffstats
path: root/java/test
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-16 21:29:34 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-19 04:02:16 (GMT)
commit2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7 (patch)
tree995755018d754f98b7ecf4c53452d7aaebba34e1 /java/test
parentdbb0ccc31db5d6a2b87ce859380043a0e7e66bd7 (diff)
downloadhdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.zip
hdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.tar.gz
hdf5-2b1709f6ff9a8fcfc1e6d5128b24501d927e21a7.tar.bz2
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'java/test')
-rw-r--r--java/test/TestH5E.java23
-rw-r--r--java/test/TestH5Edefault.java71
-rw-r--r--java/test/TestH5G.java27
-rw-r--r--java/test/TestH5Giterate.java5
-rw-r--r--java/test/TestH5Lbasic.java53
-rw-r--r--java/test/TestH5Lcreate.java34
-rw-r--r--java/test/TestH5Obasic.java328
-rw-r--r--java/test/TestH5Ocreate.java20
-rw-r--r--java/test/TestH5Oparams.java25
-rw-r--r--java/test/TestH5VL.java48
-rw-r--r--java/test/testfiles/JUnit-TestH5Edefault.txt48
-rw-r--r--java/test/testfiles/JUnit-TestH5Obasic.txt20
-rw-r--r--java/test/testfiles/JUnit-TestH5Oparams.txt7
-rw-r--r--java/test/testfiles/JUnit-TestH5VL.txt3
14 files changed, 524 insertions, 188 deletions
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index fd015c0..6f4f473 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -74,7 +74,6 @@ public class TestH5E {
@Test
public void testH5Eget_msg_major() {
-
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
@@ -90,8 +89,17 @@ public class TestH5E {
fail("H5.H5Eget_msg(Throwable): " + err);
}
assertNotNull("H5.H5Eget_msg: " + msg, msg);
- assertEquals("H5.H5Eget_msg: ", "File accessibility", msg);
assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertEquals("H5.H5Eget_msg: ", "File accessibility", msg);
}
catch (Throwable err) {
err.printStackTrace();
@@ -116,8 +124,17 @@ public class TestH5E {
fail("H5.H5Eget_msg: " + err);
}
assertNotNull("H5.H5Eget_msg: " + msg, msg);
- assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg);
assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertEquals("H5.H5Eget_msg: ", "Unable to open file", msg);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 6f968b1..0e55bcc 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -24,6 +24,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.rules.TestName;
public class TestH5Edefault {
@@ -55,20 +56,29 @@ public class TestH5Edefault {
H5.H5Eprint2(-1, null);
}
- @Test
+ @Ignore
public void testH5Eprint() {
- try {
- H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eprint: " + err);
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eprint: " + err);
+ }
+ }
}
@Test
@@ -427,20 +437,29 @@ public class TestH5Edefault {
H5.H5Eprint2(-1, null);
}
- @Test
+ @Ignore
public void testH5EprintInt() {
- try {
- H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5EprintInt: " + err);
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5EprintInt: " + err);
+ }
+ }
}
@Test
diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java
index 6c30187..4b6d470 100644
--- a/java/test/TestH5G.java
+++ b/java/test/TestH5G.java
@@ -24,6 +24,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5G_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
import org.junit.After;
import org.junit.Before;
@@ -286,12 +287,12 @@ public class TestH5G {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -317,14 +318,14 @@ public class TestH5G {
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0);
String objNames[] = new String[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -358,14 +359,14 @@ public class TestH5G {
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0);
String objNames[] = new String[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -395,12 +396,12 @@ public class TestH5G {
String objNames[] = new String[(int)groups_max_size];
int objTypes[] = new int[(int)groups_max_size];
int lnkTypes[] = new int[(int)groups_max_size];
- long objRefs[] = new long[(int)groups_max_size];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objRefs, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
@@ -426,12 +427,12 @@ public class TestH5G {
String objNames[] = new String[(int)groups_max_size];
int objTypes[] = new int[(int)groups_max_size];
int lnkTypes[] = new int[(int)groups_max_size];
- long objRefs[] = new long[(int)groups_max_size];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objRefs, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
@@ -471,11 +472,11 @@ public class TestH5G {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
try {
H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER);
}
catch (Throwable err) {
err.printStackTrace();
@@ -488,7 +489,7 @@ public class TestH5G {
try {
H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index 06c59e7..9514837 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -20,6 +20,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5G_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
import org.junit.After;
import org.junit.Before;
@@ -93,12 +94,12 @@ public class TestH5Giterate {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java
index 0a836c1..3bea1ee 100644
--- a/java/test/TestH5Lbasic.java
+++ b/java/test/TestH5Lbasic.java
@@ -21,8 +21,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -119,9 +119,8 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ",link_info==null);
+ assertFalse("H5Lget_info",link_info==null);
assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
- assertTrue("Link Address ",link_info.address_val_size>0);
}
@Test(expected = HDF5LibraryException.class)
@@ -155,7 +154,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ",link_info==null);
+ assertFalse("H5Lget_info_by_idx",link_info==null);
assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -164,7 +163,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size);
+ assertTrue("Link Value Size", link_info.val_size == link_info2.val_size);
}
@Test
@@ -178,7 +177,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ",link_info==null);
+ assertFalse("H5Lget_info_by_idx",link_info==null);
assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -187,7 +186,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size);
+ assertTrue("Link Value Size", link_info.val_size == link_info2.val_size);
}
@Test(expected = HDF5LibraryException.class)
@@ -233,18 +232,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -271,18 +270,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
@@ -305,18 +304,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data);
}
@@ -342,18 +341,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java
index 06c4ac1..c8f2348 100644
--- a/java/test/TestH5Lcreate.java
+++ b/java/test/TestH5Lcreate.java
@@ -22,8 +22,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -320,9 +320,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -383,9 +383,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -431,9 +431,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -740,18 +740,18 @@ public class TestH5Lcreate {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -792,18 +792,18 @@ public class TestH5Lcreate {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data);
}
diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java
index 8c6689f..20ffc41 100644
--- a/java/test/TestH5Obasic.java
+++ b/java/test/TestH5Obasic.java
@@ -21,10 +21,14 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5O_info_t;
+import hdf.hdf5lib.structs.H5O_native_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
+import hdf.hdf5lib.structs.H5O_hdr_info_t;
+import hdf.hdf5lib.structs.H5_ih_info_t;
import org.junit.After;
import org.junit.Before;
@@ -35,10 +39,8 @@ import org.junit.rules.TestName;
public class TestH5Obasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterateO1.hdf";
- private static long H5la_ds1 = -1;
- private static long H5la_l1 = -1;
- private static long H5la_dt1 = -1;
- private static long H5la_g1 = -1;
+ private static H5O_token_t H5la_ds1 = null;
+ private static H5O_token_t H5la_l1 = null;
long H5fid = -1;
@Before
@@ -242,7 +244,7 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
@@ -253,7 +255,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1);
+ assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1));
}
@Test
@@ -268,7 +270,7 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err);
}
- H5la_l1 = obj_info.addr;
+ H5la_l1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
@@ -279,7 +281,263 @@ public class TestH5Obasic {
}
assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1);
+ assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
+ }
+
+ @Test
+ public void testH5Oget_native_info_dataset() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_hardlink() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_group() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_datatype() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_not_exists() throws Throwable {
+ H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_dataset() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_hardlink() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_group() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_datatype() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_idx_n0() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+ H5O_hdr_info_t ohdr;
+ H5_ih_info_t oinfo;
+ H5_ih_info_t ainfo;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err);
+ }
+
+ ohdr = native_info.hdr_info;
+ oinfo = native_info.obj_info;
+ ainfo = native_info.attr_info;
+
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+
+ try {
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info_by_idx: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_idx ", native_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null);
+ assertTrue("testH5Oget_native_info_by_idx_n0:Object Header Info", native_info.hdr_info.equals(ohdr));
+ assertTrue("testH5Oget_native_info_by_idx_n0:Object Info", native_info.obj_info.equals(oinfo));
+ assertTrue("testH5Oget_native_info_by_idx_n0:Attribute Info", native_info.attr_info.equals(ainfo));
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_idx_n3() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+ H5O_hdr_info_t ohdr;
+ H5_ih_info_t oinfo;
+ H5_ih_info_t ainfo;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err);
+ }
+
+ ohdr = native_info.hdr_info;
+ oinfo = native_info.obj_info;
+ ainfo = native_info.attr_info;
+
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+
+ try {
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info_by_idx: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_idx ", native_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null);
+ assertTrue("testH5Oget_native_info_by_idx_n3:Object Header Info", native_info.hdr_info.equals(ohdr));
+ assertTrue("testH5Oget_native_info_by_idx_n3:Object Info", native_info.obj_info.equals(oinfo));
+ assertTrue("testH5Oget_native_info_by_idx_n3:Attribute Info", native_info.attr_info.equals(ainfo));
}
@Test
@@ -292,18 +550,18 @@ public class TestH5Obasic {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -331,18 +589,18 @@ public class TestH5Obasic {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
@@ -371,7 +629,7 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oopen_by_addr() {
+ public void testH5Oopen_by_token() {
long oid = -1;
H5O_info_t obj_info = null;
try {
@@ -381,32 +639,32 @@ public class TestH5Obasic {
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1);
+ oid = H5.H5Oopen_by_token(H5fid, H5la_ds1);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oopen_by_token: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
- assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1);
+ assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null);
+ assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
}
- }
+ }
@Test
public void testH5Oopen_by_idx_n0() {
@@ -421,14 +679,14 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_idx_n0: H5.H5Oopen_by_idx: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
@@ -439,7 +697,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1);
+ assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
@@ -459,14 +717,14 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err);
}
- H5la_l1 = obj_info.addr;
+ H5la_l1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_idx_n3: H5.H5Oopen_by_idx: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
@@ -477,7 +735,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1);
+ assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java
index de17d8b..5e9fdf2 100644
--- a/java/test/TestH5Ocreate.java
+++ b/java/test/TestH5Ocreate.java
@@ -22,8 +22,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5O_info_t;
@@ -264,9 +264,9 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ", obj_info==null);
+ assertFalse("H5Oget_info", obj_info==null);
assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("Link Address ", obj_info.addr>0);
+ assertTrue("Link Object Token", obj_info.token != null);
}
@Test(expected = HDF5LibraryException.class)
@@ -286,9 +286,9 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ", obj_info==null);
+ assertFalse("H5Oget_info", obj_info==null);
assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
- assertTrue("Link Address ", obj_info.addr>0);
+ assertTrue("Link Object Token", obj_info.token != null);
}
@Test
@@ -351,18 +351,18 @@ public class TestH5Ocreate {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java
index cac3dcd..1f379d3 100644
--- a/java/test/TestH5Oparams.java
+++ b/java/test/TestH5Oparams.java
@@ -95,6 +95,31 @@ public class TestH5Oparams {
}
@Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_invalid() throws Throwable {
+ H5.H5Oget_native_info(-1, 0);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Oget_native_info_by_name_null() throws Throwable {
+ H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_invalid() throws Throwable {
+ H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_invalid() throws Throwable {
+ H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Oget_native_info_by_idx_null() throws Throwable {
+ H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
public void testH5Olink_invalid() throws Throwable {
H5.H5Olink(-1, -1, "Bogus", -1, -1);
}
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java
index 0397be1..d774dbb 100644
--- a/java/test/TestH5VL.java
+++ b/java/test/TestH5VL.java
@@ -69,14 +69,46 @@ public class TestH5VL {
@Test
public void testH5VLget_connector_id() {
+ String H5_FILE = "testFvl.h5";
+
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+
+ try {
+ long native_id = H5.H5VLget_connector_id(H5fid);
+ assertTrue("H5.H5VLget_connector_id", native_id >= 0);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_id " + err);
+ }
+ finally {
+ if (H5fid > 0) {
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ }
+ _deleteFile(H5_FILE);
+ }
+ }
+
+ @Test
+ public void testH5VLget_connector_id_by_name() {
try {
- long native_id = H5.H5VLget_connector_id(HDF5Constants.H5VL_NATIVE_NAME);
- assertTrue("H5.H5VLget_connector_id H5VL_NATIVE_NAME", native_id >= 0);
+ long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME);
+ assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0);
assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5VLget_connector_id " + err);
+ fail("H5.H5VLget_connector_id_by_name " + err);
}
}
@@ -90,7 +122,15 @@ public class TestH5VL {
try {
String native_name = H5.H5VLget_connector_name(H5fid);
- assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt
index 48c6254..bb43c64 100644
--- a/java/test/testfiles/JUnit-TestH5Edefault.txt
+++ b/java/test/testfiles/JUnit-TestH5Edefault.txt
@@ -1,10 +1,8 @@
JUnit version 4.11
-.testH5EprintInt
.testH5Eset_current_stack_invalid_stkid
.testH5Eset_current_stack
.testH5Eget_num
.testH5Eclear
-.testH5Eprint
.testH5Epush_null_name
.testH5Eget_num_with_msg
.testH5Eclear2_with_msg
@@ -30,49 +28,5 @@ JUnit version 4.11
Time: XXXX
-OK (28 tests)
+OK (26 tests)
-HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Fopen(): unable to open file
- major: File accessibility
- minor: Unable to open file
- #001: (file name) line (number) in H5VL_file_open(): open failed
- major: Virtual Object Layer
- minor: Can't open object
- #002: (file name) line (number) in H5VL__file_open(): open failed
- major: Virtual Object Layer
- minor: Can't open object
- #003: (file name) line (number) in H5VL__native_file_open(): unable to open file
- major: File accessibility
- minor: Unable to open file
- #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
- major: File accessibility
- minor: Unable to open file
- #005: (file name) line (number) in H5FD_open(): open failed
- major: Virtual File Layer
- minor: Unable to initialize object
- #006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
- major: File accessibility
- minor: Unable to open file
-HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Fopen(): unable to open file
- major: File accessibility
- minor: Unable to open file
- #001: (file name) line (number) in H5VL_file_open(): open failed
- major: Virtual Object Layer
- minor: Can't open object
- #002: (file name) line (number) in H5VL__file_open(): open failed
- major: Virtual Object Layer
- minor: Can't open object
- #003: (file name) line (number) in H5VL__native_file_open(): unable to open file
- major: File accessibility
- minor: Unable to open file
- #004: (file name) line (number) in H5F_open(): unable to open file: name = 'test', tent_flags = 1
- major: File accessibility
- minor: Unable to open file
- #005: (file name) line (number) in H5FD_open(): open failed
- major: Virtual File Layer
- minor: Unable to initialize object
- #006: (file name) line (number) in H5FD_sec2_open(): unable to open file: name = 'test', errno = 2, error message = 'No such file or directory', flags = 1, o_flags = 2
- major: File accessibility
- minor: Unable to open file
diff --git a/java/test/testfiles/JUnit-TestH5Obasic.txt b/java/test/testfiles/JUnit-TestH5Obasic.txt
index d015bdd..c39c01d 100644
--- a/java/test/testfiles/JUnit-TestH5Obasic.txt
+++ b/java/test/testfiles/JUnit-TestH5Obasic.txt
@@ -1,29 +1,45 @@
JUnit version 4.11
.testH5Oexists_by_name
+.testH5Oget_native_info_dataset
+.testH5Oopen_by_token
.testH5Oget_info_by_idx_n0
.testH5Oget_info_by_idx_n3
+.testH5Oget_native_info_datatype
.testH5Oget_info_by_name_not_exist_name
.testH5Ovisit_by_name
+.testH5Oget_native_info_by_name_datatype
.testH5Oget_info_by_idx_name_not_exist_name
.testH5Oget_info_datatype
.testH5Oget_info_by_idx_not_exist_name
.testH5Oopen_by_idx_n0
.testH5Oopen_by_idx_n3
+.testH5Oget_native_info_by_name_not_exist_name
.testH5Oopen_not_exists
.testH5Ovisit
.testH5Oget_info_by_idx_not_exist_create
+.testH5Oget_native_info_by_idx_not_exist_name
.testH5Oget_info_by_name_hardlink
.testH5Oget_info_by_name_group
-.testH5Oopen_by_addr
.testH5Oget_info_by_name_not_exists
+.testH5Oget_native_info_by_idx_not_exist_create
.testH5Oget_info_by_name_dataset
.testH5Oget_info_group
+.testH5Oget_native_info_hardlink
+.testH5Oget_native_info_by_name_hardlink
+.testH5Oget_native_info_by_idx_name_not_exist_name
.testH5Oget_info_by_name_datatype
.testH5Oget_info_hardlink
+.testH5Oget_native_info_group
+.testH5Oget_native_info_by_name_not_exists
+.testH5Oget_native_info_by_name_dataset
.testH5Oget_info_by_idx_name_not_exist_create
+.testH5Oget_native_info_by_idx_n0
+.testH5Oget_native_info_by_idx_n3
.testH5Oget_info_dataset
+.testH5Oget_native_info_by_name_group
+.testH5Oget_native_info_by_idx_name_not_exist_create
Time: XXXX
-OK (23 tests)
+OK (39 tests)
diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt
index bc23695..b756bcf 100644
--- a/java/test/testfiles/JUnit-TestH5Oparams.txt
+++ b/java/test/testfiles/JUnit-TestH5Oparams.txt
@@ -1,22 +1,27 @@
JUnit version 4.11
.testH5Oget_comment_by_name_null
+.testH5Oget_native_info_by_name_invalid
.testH5Ovisit_by_name_nullname
.testH5Oget_info_invalid
.testH5Ovisit_by_name_null
.testH5Odisable_mdc_flushes
.testH5Oget_comment_invalid
+.testH5Oget_native_info_invalid
.testH5Oset_comment_by_name_invalid
.testH5Oare_mdc_flushes_disabled
.testH5Oopen_null
.testH5Oclose_invalid
.testH5Oflush_invalid
+.testH5Oget_native_info_by_name_null
.testH5Oget_comment_by_name_invalid
.testH5Orefresh_invalid
.testH5Ocopy_null_dest
+.testH5Oget_native_info_by_idx_null
.testH5Olink_invalid
.testH5Oget_info_by_idx_invalid
.testH5Oget_info_by_idx_null
.testH5Olink_null_dest
+.testH5Oget_native_info_by_idx_invalid
.testH5Oget_info_by_name_invalid
.testH5Oget_info_by_name_null
.testH5Ocopy_invalid
@@ -29,5 +34,5 @@ JUnit version 4.11
Time: XXXX
-OK (27 tests)
+OK (32 tests)
diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt
index caadf26..f646009 100644
--- a/java/test/testfiles/JUnit-TestH5VL.txt
+++ b/java/test/testfiles/JUnit-TestH5VL.txt
@@ -1,4 +1,5 @@
JUnit version 4.11
+.testH5VLget_connector_id_by_name
.testH5VLget_connector_id
.testH5VLnative_init
.testH5VLget_connector_name
@@ -7,5 +8,5 @@ JUnit version 4.11
Time: XXXX
-OK (5 tests)
+OK (6 tests)