diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-02-21 20:30:34 (GMT) |
commit | 51b8c63864c72de9a7b40c00673fe07510fec27e (patch) | |
tree | 298e9a2584860a24f55d2bce1fc60faed2bef2dd /java/test/TestH5VL.java | |
parent | c4f785bc93c5f4e8677b325c321e0f9ed41c3baa (diff) | |
parent | c5ab2285639a801f87a77987db1a0b609a020314 (diff) | |
download | hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.zip hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.gz hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.bz2 |
Merge develop
Diffstat (limited to 'java/test/TestH5VL.java')
-rw-r--r-- | java/test/TestH5VL.java | 74 |
1 files changed, 65 insertions, 9 deletions
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 0397be1..bd660d3 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -55,28 +55,76 @@ public class TestH5VL { try { boolean is_registered; - is_registered = H5.H5VLis_connector_registered(HDF5Constants.H5VL_NATIVE_NAME); - assertTrue("H5.H5VLis_connector_registered H5VL_NATIVE_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLis_connector_registered_by_name H5VL_NATIVE_NAME", is_registered); - is_registered = H5.H5VLis_connector_registered("FAKE_VOL_NAME"); - assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered); + is_registered = H5.H5VLis_connector_registered_by_name("FAKE_VOL_NAME"); + assertFalse("H5.H5VLis_connector_registered_by_name FAKE_VOL_NAME", is_registered); + + is_registered = H5.H5VLis_connector_registered_by_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLis_connector_registered_by_value H5VL_NATIVE_VALUE", is_registered); } catch (Throwable err) { err.printStackTrace(); - fail("H5.H5VLis_connector_registered " + err); + fail("testH5VLnative_init(): " + err); } } @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_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_by_name " + err); + } + } + + @Test + public void testH5VLget_connector_id_by_value() { 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_value(HDF5Constants.H5VL_NATIVE_VALUE); + assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", 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_value " + err); } } @@ -90,7 +138,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(); |