diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-12-19 18:58:51 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-12-19 18:59:05 (GMT) |
commit | f9e9c1ad0eeabce09b2f8613427b83daebbf8cb0 (patch) | |
tree | 72453927d8e767e342d1b1b1129c66e0bb98cac3 | |
parent | fc7f4e59aa233e06e8ca7c3c334bb539c62079e5 (diff) | |
download | hdf5-f9e9c1ad0eeabce09b2f8613427b83daebbf8cb0.zip hdf5-f9e9c1ad0eeabce09b2f8613427b83daebbf8cb0.tar.gz hdf5-f9e9c1ad0eeabce09b2f8613427b83daebbf8cb0.tar.bz2 |
HDFFV-10664 Add new functions and constants to java interface
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 158 | ||||
-rw-r--r-- | java/src/hdf/hdf5lib/HDF5Constants.java | 54 | ||||
-rw-r--r-- | java/src/jni/CMakeLists.txt | 2 | ||||
-rw-r--r-- | java/src/jni/Makefile.am | 2 | ||||
-rw-r--r-- | java/src/jni/h5Constants.c | 41 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.c | 206 | ||||
-rw-r--r-- | java/src/jni/h5vlImp.h | 91 | ||||
-rw-r--r-- | java/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | java/test/Makefile.am | 1 | ||||
-rw-r--r-- | java/test/TestH5VL.java | 117 | ||||
-rw-r--r-- | java/test/junit.sh.in | 21 | ||||
-rw-r--r-- | java/test/testfiles/JUnit-TestH5VL.txt | 11 |
13 files changed, 655 insertions, 54 deletions
@@ -2884,6 +2884,8 @@ ./java/src/jni/h5sImp.h ./java/src/jni/h5tImp.c ./java/src/jni/h5tImp.h +./java/src/jni/h5vlImp.c +./java/src/jni/h5vlImp.h ./java/src/jni/h5zImp.c ./java/src/jni/h5zImp.h @@ -3122,6 +3124,7 @@ ./java/test/testfiles/JUnit-TestH5Tparams.txt ./java/test/testfiles/JUnit-TestH5Tbasic.txt ./java/test/testfiles/JUnit-TestH5T.txt +./java/test/testfiles/JUnit-TestH5VL.txt ./java/test/testfiles/JUnit-TestH5Z.txt ./java/test/h5ex_g_iterate.orig ./java/test/TestH5.java @@ -3159,6 +3162,7 @@ ./java/test/TestH5Tparams.java ./java/test/TestH5Tbasic.java ./java/test/TestH5T.java +./java/test/TestH5VL.java ./java/test/TestH5Z.java ./java/test/TestAll.java diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index bce0034..e354207 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -499,9 +499,9 @@ public class H5 implements java.io.Serializable { private synchronized static native boolean H5is_library_threadsafe(); // /////// unimplemented //////// - // H5_DLL herr_t H5free_memory(void *mem); - // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); - // H5_DLL void *H5resize_memory(void *mem, size_t size); + // herr_t H5free_memory(void *mem); + // void *H5allocate_memory(size_t size, hbool_t clear); + // void *H5resize_memory(void *mem, size_t size); // //////////////////////////////////////////////////////////// // // @@ -2402,10 +2402,10 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException; // /////// unimplemented //////// - // H5_DLL herr_t H5Ddebug(hid_t dset_id); - // H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); - // H5_DLL herr_t H5Dformat_convert(hid_t dset_id); - // H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); + // herr_t H5Ddebug(hid_t dset_id); + // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); + // herr_t H5Dformat_convert(hid_t dset_id); + // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); // herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, // size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); @@ -3230,20 +3230,20 @@ public class H5 implements java.io.Serializable { throws HDF5LibraryException, NullPointerException; // /////// unimplemented //////// - // H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); - // H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); + // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); + // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); // herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info); // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); - // H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); - // H5_DLL herr_t H5Fformat_convert(hid_t fid); - // H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id); - // H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], + // herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high); + // herr_t H5Fformat_convert(hid_t fid); + // herr_t H5Freset_page_buffering_stats(hid_t file_id); + // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], // unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]); - // H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size); + // herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size); // #ifdef H5_HAVE_PARALLEL - // H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); - // H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); + // herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); + // herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); // #endif /* H5_HAVE_PARALLEL */ // /** @@ -3303,25 +3303,25 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // /////// unimplemented //////// - // H5_DLL hid_t H5FDregister(const H5FD_class_t *cls); - // H5_DLL herr_t H5FDunregister(hid_t driver_id); - // H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); - // H5_DLL herr_t H5FDclose(H5FD_t *file); - // H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); - // H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags); - // H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); - // H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); - // H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); - // H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); - // H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); - // H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); - // H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); - // H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); - // H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); - // H5_DLL herr_t H5FDunlock(H5FD_t *file); - // H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/); + // hid_t H5FDregister(const H5FD_class_t *cls); + // herr_t H5FDunregister(hid_t driver_id); + // H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); + // herr_t H5FDclose(H5FD_t *file); + // int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2); + // int H5FDquery(const H5FD_t *f, unsigned long *flags); + // haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); + // herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); + // haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); + // herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); + // haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); + // herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); + // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); + // herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); + // herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + // herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); + // herr_t H5FDlock(H5FD_t *file, hbool_t rw); + // herr_t H5FDunlock(H5FD_t *file); + // herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/); // //////////////////////////////////////////////////////////// // // @@ -3794,7 +3794,7 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // // - // H5I: HDF5 1.8 Identifier Interface API Functions // + // H5I: HDF5 Identifier Interface API Functions // // // // //////////////////////////////////////////////////////////// @@ -3950,12 +3950,20 @@ public class H5 implements java.io.Serializable { // hid_t H5Iregister(H5I_type_t type, const void *object); + // typedef herr_t (*H5I_free_t)(void *); // H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); // void *H5Iremove_verify(hid_t id, H5I_type_t id_type); + // Type of the function to compare objects & keys + // typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); // void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); + // Type of the H5Iiterate callback function + // typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); + // herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); + + // ////////////////////////////////////////////////////////////////// // H5L: Link Interface Functions // // ////////////////////////////////////////////////////////////////// @@ -4983,9 +4991,9 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; // /////// unimplemented //////// - // H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); - // H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); - // H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); + // herr_t H5Odisable_mdc_flushes(hid_t object_id); + // herr_t H5Oenable_mdc_flushes(hid_t object_id); + // herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); // //////////////////////////////////////////////////////////// // // @@ -5270,6 +5278,27 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException; + // Define property list class callback function pointer types + // typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); + // typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); + // typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); + + // Define property list callback function pointer types + // typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value); + // typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value); + // typedef H5P_prp_cb1_t H5P_prp_create_func_t; + // typedef H5P_prp_cb2_t H5P_prp_set_func_t; + // typedef H5P_prp_cb2_t H5P_prp_get_func_t; + // typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size); + // typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); + // typedef H5P_prp_cb2_t H5P_prp_delete_func_t; + // typedef H5P_prp_cb1_t H5P_prp_copy_func_t; + // typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); + // typedef H5P_prp_cb1_t H5P_prp_close_func_t; + + // Define property list iteration function type + // typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); + public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException { long id = _H5Pcreate_class_nocb(parent_class, name); if (id > 0) { @@ -6433,6 +6462,11 @@ public class H5 implements java.io.Serializable { public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) throws HDF5LibraryException; + // ///// unimplemented ///// + // herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); + // herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); + // herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); + // Dataset creation property list (DCPL) routines // /** @@ -7811,13 +7845,13 @@ public class H5 implements java.io.Serializable { // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); // #ifdef H5_HAVE_PARALLEL // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective); - // H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); + // herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective); // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective); // #endif /* H5_HAVE_PARALLEL */ - // H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); - // H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); - // H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); + // herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); + // herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); + // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); @@ -7840,9 +7874,9 @@ public class H5 implements java.io.Serializable { // herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) // herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data) // #ifdef H5_HAVE_PARALLEL - // H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); - // H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); - // H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); + // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); + // herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); + // herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); // #endif /* H5_HAVE_PARALLEL */ // Link creation property list (LCPL) routines // @@ -8785,16 +8819,17 @@ public class H5 implements java.io.Serializable { // /////// unimplemented //////// // #ifdef NEW_HYPERSLAB_API - // H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, + // hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, // const hsize_t start[], // const hsize_t _stride[], // const hsize_t count[], // const hsize_t _block[]); - // H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, + // herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op, // hid_t space2_id); - // H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, + // hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, // hid_t space2_id); // #endif /* NEW_HYPERSLAB_API */ + // herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); @@ -10273,6 +10308,25 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// // // + // H5VL: VOL Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /// VOL Connector Functionality + public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id); + public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id); + public synchronized static native boolean H5VLis_connector_registered(String name); + public synchronized static native long H5VLget_connector_id(String name); + public synchronized static native String H5VLget_connector_name(long object_id); + public synchronized static native void H5VLclose(long connector_id); + public synchronized static native void H5VLunregister_connector(long connector_id); + + // /////// unimplemented //////// + // hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); + + + // //////////////////////////////////////////////////////////// + // // // H5Z: Filter Interface Functions // // // // //////////////////////////////////////////////////////////// @@ -10283,9 +10337,9 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException; -} + // /////// unimplemented //////// -// /////// unimplemented //////// + // herr_t H5Zregister(const void *cls); -// herr_t H5Zregister(const void *cls); +} diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 0760e7f..a0c2ed6 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -195,6 +195,11 @@ public class HDF5Constants { public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); public static final long H5E_WRITEERROR = H5E_WRITEERROR(); + private static final int H5ES_STATUS_IN_PROGRESS = H5ES_STATUS_IN_PROGRESS(); + private static final int H5ES_STATUS_SUCCEED = H5ES_STATUS_SUCCEED(); + private static final int H5ES_STATUS_FAIL = H5ES_STATUS_FAIL(); + private static final int H5ES_STATUS_CANCELED = H5ES_STATUS_CANCELED(); + public static final int H5F_ACC_CREAT = H5F_ACC_CREAT(); public static final int H5F_ACC_EXCL = H5F_ACC_EXCL(); public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY(); @@ -389,7 +394,10 @@ public class HDF5Constants { public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR(); public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER(); + public static final int H5PL_TYPE_VOL = H5PL_TYPE_VOL(); + public static final int H5PL_TYPE_NONE = H5PL_TYPE_NONE(); public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN(); + public static final int H5PL_VOL_PLUGIN = H5PL_VOL_PLUGIN(); public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN(); public static final int H5R_BADTYPE = H5R_BADTYPE(); @@ -625,6 +633,18 @@ public class HDF5Constants { public static final long H5T_VARIABLE = H5T_VARIABLE(); public static final int H5T_VLEN = H5T_VLEN(); public static final int H5T_VL_T = H5T_VL_T(); + + public static final int H5VL_CAP_FLAG_NONE = H5VL_CAP_FLAG_NONE(); + public static final int H5VL_CAP_FLAG_THREADSAFE = H5VL_CAP_FLAG_THREADSAFE(); + public static final long H5VL_NATIVE = H5VL_NATIVE(); + public static final String H5VL_NATIVE_NAME = H5VL_NATIVE_NAME(); + public static final int H5VL_NATIVE_VALUE = H5VL_NATIVE_VALUE(); + public static final int H5VL_NATIVE_VERSION = H5VL_NATIVE_VERSION(); + public static final int H5_VOL_INVALID = H5_VOL_INVALID(); + public static final int H5_VOL_NATIVE = H5_VOL_NATIVE(); + public static final int H5_VOL_RESERVED = H5_VOL_RESERVED(); + public static final int H5_VOL_MAX = H5_VOL_MAX(); + public static final int H5Z_CB_CONT = H5Z_CB_CONT(); public static final int H5Z_CB_ERROR = H5Z_CB_ERROR(); public static final int H5Z_CB_FAIL = H5Z_CB_FAIL(); @@ -989,6 +1009,14 @@ public class HDF5Constants { private static native final long H5E_WRITEERROR(); + private static native final int H5ES_STATUS_IN_PROGRESS(); + + private static native final int H5ES_STATUS_SUCCEED(); + + private static native final int H5ES_STATUS_FAIL(); + + private static native final int H5ES_STATUS_CANCELED(); + private static native final int H5F_ACC_CREAT(); private static native final int H5F_ACC_EXCL(); @@ -1361,10 +1389,16 @@ public class HDF5Constants { private static native final int H5PL_TYPE_FILTER(); + private static native final int H5PL_TYPE_VOL(); + + private static native final int H5PL_TYPE_NONE(); + private static native final int H5PL_FILTER_PLUGIN(); private static native final int H5PL_ALL_PLUGIN(); + private static native final int H5PL_VOL_PLUGIN(); + private static native final int H5R_BADTYPE(); private static native final int H5R_DATASET_REGION(); @@ -1831,6 +1865,26 @@ public class HDF5Constants { private static native final int H5T_VL_T(); + private static native final int H5VL_CAP_FLAG_NONE(); + + private static native final int H5VL_CAP_FLAG_THREADSAFE(); + + private static native final long H5VL_NATIVE(); + + private static native final String H5VL_NATIVE_NAME(); + + private static native final int H5VL_NATIVE_VALUE(); + + private static native final int H5VL_NATIVE_VERSION(); + + private static native final int H5_VOL_INVALID(); + + private static native final int H5_VOL_NATIVE(); + + private static native final int H5_VOL_RESERVED(); + + private static native final int H5_VOL_MAX(); + private static native final int H5Z_CB_CONT(); private static native final int H5Z_CB_ERROR(); diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 50e76e1..00c2b34 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -19,6 +19,7 @@ set (HDF5_JAVA_JNI_CSRCS ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.c ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c ) @@ -40,6 +41,7 @@ set (HDF5_JAVA_JNI_CHDRS ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h ) diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am index 6ded371..370b08b 100644 --- a/java/src/jni/Makefile.am +++ b/java/src/jni/Makefile.am @@ -34,7 +34,7 @@ libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $ # Source files for the library libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \ h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \ - h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c + h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5vlImp.c h5zImp.c # HDF5 Java (JNI) library depends on HDF5 Library. libhdf5_java_la_LIBADD=$(LIBHDF5) diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index b13dc76..e88fa55 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -21,8 +21,10 @@ extern "C" { #endif /* __cplusplus */ -#include <jni.h> #include "hdf5.h" +#include <jni.h> +#include <stdlib.h> +#include "h5jni.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-prototypes" @@ -352,6 +354,15 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { retu JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1IN_1PROGRESS(JNIEnv *env, jclass cls) { return H5ES_STATUS_IN_PROGRESS; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1SUCCEED(JNIEnv *env, jclass cls) { return H5ES_STATUS_SUCCEED; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls) { return H5ES_STATUS_FAIL; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls) { return H5ES_STATUS_CANCELED; } + /* Java does not have unsigned native types */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-conversion" @@ -761,8 +772,14 @@ Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { retu JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1VOL(JNIEnv *env, jclass cls) { return H5PL_TYPE_VOL; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1NONE(JNIEnv *env, jclass cls) { return H5PL_TYPE_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5PL_1VOL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_VOL_PLUGIN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; } JNIEXPORT jint JNICALL @@ -1237,6 +1254,28 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls) { return sizeof(hvl_t); } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1NONE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_NONE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_THREADSAFE; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls) { return H5VL_NATIVE; } +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVPAR H5VL_NATIVE_NAME); } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VALUE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VERSION(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VERSION; } + +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1INVALID(JNIEnv *env, jclass cls) { return H5_VOL_INVALID; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1NATIVE(JNIEnv *env, jclass cls) { return H5_VOL_NATIVE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1RESERVED(JNIEnv *env, jclass cls) { return H5_VOL_RESERVED; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1MAX(JNIEnv *env, jclass cls) { return H5_VOL_MAX; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls) { return H5Z_CB_ERROR; } diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c new file mode 100644 index 0000000..89ea703 --- /dev/null +++ b/java/src/jni/h5vlImp.c @@ -0,0 +1,206 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include <jni.h> +#include <stdlib.h> +#include "h5jni.h" +#include "h5vlImp.h" + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLregister_connector_by_name + * Signature: (Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name + (JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id) +{ + hid_t status = -1; + const char *vlName; + + PIN_JAVA_STRING(connector_name, vlName); + if (vlName != NULL) { + status = H5VLregister_connector_by_name(vlName, (hid_t)vipl_id); + + UNPIN_JAVA_STRING(connector_name, vlName); + + if (status < 0) + h5libraryError(env); + } + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLregister_connector_by_value + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value + (JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id) +{ + hid_t status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered + (JNIEnv *env, jclass clss, jobject connector_name) +{ + htri_t bval = JNI_FALSE; + const char *vlName; + + PIN_JAVA_STRING(connector_name, vlName); + if (vlName != NULL) { + bval = H5VLis_connector_registered(vlName); + + UNPIN_JAVA_STRING(connector_name, vlName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + } + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id + (JNIEnv *env, jclass clss, jobject connector_name) +{ + hid_t status = -1; + const char *vlName; + + PIN_JAVA_STRING(connector_name, vlName); + if (vlName != NULL) { + status = H5VLget_connector_id(vlName); + + UNPIN_JAVA_STRING(connector_name, vlName); + + if (status < 0) + h5libraryError(env); + } + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_name + * Signature: (J)Ljava/lang/String; + */ + +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1name + (JNIEnv *env, jclass clss, jlong object_id) +{ + char *vlName; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the comment */ + buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0); + if (buf_size < 0) { + H5Eprint2(H5E_DEFAULT, NULL); + + h5badArgument(env, "H5VLget_connector_name: buf_size < 0"); + } /* end if */ + else if (buf_size > 0) { + buf_size++; /* add extra space for the null terminator */ + vlName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (vlName == NULL) { + /* exception -- out of memory */ + h5outOfMemory(env, "H5VLget_connector_name: malloc failed"); + } /* end if */ + else { + status = H5VLget_connector_name((hid_t)object_id, vlName, (size_t)buf_size); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + /* may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR vlName); + if (str == NULL) { + h5JNIFatalError(env, "H5VLget_connector_name: return string not allocated"); + } /* end if */ + } /* end else */ + HDfree(vlName); + } + } /* end else if */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLclose + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5VLclose + (JNIEnv *env, jclass clss, jlong connector_id) +{ + herr_t retValue = H5VLclose((hid_t)connector_id); + + if (retValue < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5VLclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLunregister_connector + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5VLunregister_1connector + (JNIEnv *env, jclass clss, jlong connector_id) +{ + herr_t retValue = H5VLunregister_connector((hid_t)connector_id); + + if (retValue < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h new file mode 100644 index 0000000..af824a9 --- /dev/null +++ b/java/src/jni/h5vlImp.h @@ -0,0 +1,91 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include <jni.h> +/* Header for class hdf_hdf5lib_H5_H5VL */ + +#ifndef _Included_hdf_hdf5lib_H5_H5VL +#define _Included_hdf_hdf5lib_H5_H5VL + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLregister_connector_by_name + * Signature: (Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name + (JNIEnv *, jclass, jobject, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLregister_connector_by_value + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value + (JNIEnv *, jclass, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLis_connector_registered + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5VLis_connector_registered + (JNIEnv *, jclass, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_id + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1id + (JNIEnv *, jclass, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLget_connector_name + * Signature: (J)Ljava/lang/String; + */ + +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5VLget_1connector_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLclose + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5VLclose + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5VLunregister_connector + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5VLunregister_1connector + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5VL */ diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b76f572..937b129 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -38,6 +38,7 @@ set (HDF5_JAVA_TEST_SOURCES TestH5Ocreate TestH5Ocopy TestH5PL + TestH5VL TestH5Z ) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index 6635ef7..af99d92 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -69,6 +69,7 @@ noinst_JAVA = \ TestH5Ocreate.java \ TestH5Ocopy.java \ TestH5PL.java \ + TestH5VL.java \ TestH5Z.java \ TestH5E.java \ TestH5Edefault.java \ diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java new file mode 100644 index 0000000..0397be1 --- /dev/null +++ b/java/test/TestH5VL.java @@ -0,0 +1,117 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import java.io.File; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5VL { + @Rule public TestName testname = new TestName(); + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void testH5VLnative_init() { + 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("FAKE_VOL_NAME"); + assertFalse("H5.H5VLis_connector_registered FAKE_VOL_NAME", is_registered); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLis_connector_registered " + err); + } + } + + @Test + public void testH5VLget_connector_id() { + try { + long native_id = H5.H5VLget_connector_id(HDF5Constants.H5VL_NATIVE_NAME); + assertTrue("H5.H5VLget_connector_id H5VL_NATIVE_NAME", native_id >= 0); + assertEquals(HDF5Constants.H5VL_NATIVE, native_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_id " + err); + } + } + + @Test + public void testH5VLget_connector_name() { + String H5_FILE = "testFvl.h5"; + + long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + try { + String native_name = H5.H5VLget_connector_name(H5fid); + assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5VLget_connector_name " + err); + } + finally { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5VLclose_NegativeID() throws Throwable { + H5.H5VLclose(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5VLunregister_connector_NegativeID() throws Throwable { + H5.H5VLunregister_connector(-1); + } +} + diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 350fb7b..42e16ee 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -989,6 +989,27 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5PL.txt JUnit-TestH5PL.out |sed 's/^/ /' fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL" +TESTING JUnit-TestH5VL +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL > JUnit-TestH5VL.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5VL.ext > JUnit-TestH5VL.out + +if diff JUnit-TestH5VL.out JUnit-TestH5VL.txt > /dev/null; then + echo " PASSED JUnit-TestH5VL" +else + echo "**FAILED** JUnit-TestH5VL" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5VL.txt JUnit-TestH5VL.out |sed 's/^/ /' +fi + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z" TESTING JUnit-TestH5Z ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext) diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt new file mode 100644 index 0000000..caadf26 --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5VL.txt @@ -0,0 +1,11 @@ +JUnit version 4.11 +.testH5VLget_connector_id +.testH5VLnative_init +.testH5VLget_connector_name +.testH5VLclose_NegativeID +.testH5VLunregister_connector_NegativeID + +Time: XXXX + +OK (5 tests) + |