diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-05-06 21:07:08 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-05-06 21:07:08 (GMT) |
commit | f2cb86499efa2fe6f44ca2f4e93ea62e952d0fb0 (patch) | |
tree | 8c26de9faca9450513bf771d36ded0593b66419a /java/test/TestH5Pfapl.java | |
parent | 457b199a383865febbd52045b343b902ef383512 (diff) | |
download | hdf5-f2cb86499efa2fe6f44ca2f4e93ea62e952d0fb0.zip hdf5-f2cb86499efa2fe6f44ca2f4e93ea62e952d0fb0.tar.gz hdf5-f2cb86499efa2fe6f44ca2f4e93ea62e952d0fb0.tar.bz2 |
Brings java wrapper updates from develop
The wrappers compile but fail tests due to some missing develop
functionality
Diffstat (limited to 'java/test/TestH5Pfapl.java')
-rw-r--r-- | java/test/TestH5Pfapl.java | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index e1f5200..cc674e2 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 * @@ -47,17 +46,17 @@ public class TestH5Pfapl { private static final int DIM_Y = 6; private static final int DIMF_X = 12; private static final int DIMF_Y = 18; - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + long H5Fdsid = HDF5Constants.H5I_INVALID_HID; + long H5Fdid = HDF5Constants.H5I_INVALID_HID; long[] H5dims = { DIM_X, DIM_Y }; - long fapl_id = -1; - long plapl_id = -1; - long dapl_id = -1; - long plist_id = -1; - long btplist_id = -1; + long fapl_id = HDF5Constants.H5I_INVALID_HID; + long plapl_id = HDF5Constants.H5I_INVALID_HID; + long dapl_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; + long btplist_id = HDF5Constants.H5I_INVALID_HID; long[] H5Fdims = { DIMF_X, DIMF_Y }; double windchillF[][] = {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, @@ -130,7 +129,7 @@ public class TestH5Pfapl { } private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; + long did = HDF5Constants.H5I_INVALID_HID; try { did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); @@ -385,7 +384,7 @@ public class TestH5Pfapl { @Test public void testH5Pget_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { ret_val_id = H5.H5Pget_elink_fapl(plapl_id); assertTrue("H5Pget_elink_fapl", ret_val_id >= 0); @@ -403,7 +402,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_fapl() { - long ret_val_id = -1; + long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); ret_val_id = H5.H5Pget_elink_fapl(plapl_id); @@ -421,7 +420,7 @@ public class TestH5Pfapl { @Test public void testH5P_elink_file_cache_size() { - long elink_fapl_id = -1; + long elink_fapl_id = HDF5Constants.H5I_INVALID_HID; int efc_size = 0; try { H5.H5Pset_elink_fapl(plapl_id, fapl_id ); @@ -1398,4 +1397,36 @@ public class TestH5Pfapl { fail("H5P_evict_on_close: " + err); } } + + @Test + public void testH5P_file_locking() { + boolean use_file_locking = false; + boolean ignore_disabled_file_locking = false; + try { + // false values (usually not the default) + H5.H5Pset_file_locking(fapl_id, false, false); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); + assertFalse("H5P_file_locking", use_file_locking); + assertFalse("H5P_file_locking", ignore_disabled_file_locking); + + // true values (typically the default) + H5.H5Pset_file_locking(fapl_id, true, true); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); + assertTrue("H5P_file_locking", use_file_locking); + assertTrue("H5P_file_locking", ignore_disabled_file_locking); + } + catch (HDF5PropertyListInterfaceException err) { + // parallel is not supported + if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) { + err.printStackTrace(); + fail("H5P_test_file_locking: " + err); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_test_file_locking: " + err); + } + } } |