From 3fbf61190d7ddadac6646b988b324b9a3af172dc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 20 Aug 2019 11:54:36 -0500 Subject: HDFFV-10887 merge from develop --- java/examples/groups/JavaGroupExample.sh.in | 14 ++----- java/src/hdf/hdf5lib/H5.java | 7 ++-- java/src/jni/h5oImp.c | 60 +++++++++++++++++++++++++++++ java/src/jni/h5oImp.h | 27 +++++++++++++ java/test/TestH5Ocreate.java | 53 +++++++++++++++++++++++++ java/test/TestH5Oparams.java | 15 ++++++++ java/test/testfiles/JUnit-TestH5Ocreate.txt | 3 +- java/test/testfiles/JUnit-TestH5Oparams.txt | 5 ++- 8 files changed, 167 insertions(+), 17 deletions(-) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 9d4673f..acc606f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -179,17 +179,9 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - $RM $BLDDIR/examples.groups.H5Ex_G_*.txt - $RM $BLDDIR/H5Ex_G_*.out - $RM $BLDDIR/H5Ex_G_*.h5 - $RM $BLDDIR/h5ex_g_*.h5 - SDIR=`$DIRNAME $tstfile` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile` - $RM $BLDDIR/h5ex_g_iterate.h5 - $RM $BLDDIR/h5ex_g_visit.h5 - fi + $RM $BLDDIR/examples.groups.H5Ex_G_*.txt + $RM $BLDDIR/H5Ex_G_*.out + $RM $BLDDIR/H5Ex_G_*.h5 } COPY_ITERFILES="$LIST_ITER_FILES" diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 4a651ea..6e37d77 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -5006,10 +5006,9 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; - // /////// unimplemented //////// - // 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); + public synchronized static native void H5Odisable_mdc_flushes(long object_id); + public synchronized static native void H5Oenable_mdc_flushes(long object_id); + public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id); // //////////////////////////////////////////////////////////// // // diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index cc88b81..b49a3e9 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -856,6 +856,66 @@ done: return; } /* end Java_hdf_hdf5lib_H5_H5Orefresh */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odisable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes + (JNIEnv *env, jclass clss, jlong loc_id) +{ + UNUSED(clss); + + if (H5Odisable_mdc_flushes((hid_t)loc_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oenable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes + (JNIEnv *env, jclass clss, jlong loc_id) +{ + UNUSED(clss); + + if (H5Oenable_mdc_flushes((hid_t)loc_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oare_mdc_flushes_disabled + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled + (JNIEnv *env, jclass clss, jlong loc_id) +{ + jboolean bval = JNI_FALSE; + hbool_t is_disabled = FALSE; + + UNUSED(clss); + + if (H5Oare_mdc_flushes_disabled((hid_t)loc_id, &is_disabled) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (is_disabled == TRUE) + bval = JNI_TRUE; + +done: + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled */ + #ifdef __cplusplus diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index cb8c776..5241aba 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -202,6 +202,33 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Orefresh (JNIEnv*, jclass, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odisable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oenable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oare_mdc_flushes_disabled + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled + (JNIEnv*, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index c3e36b4..de17d8b 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -557,4 +557,57 @@ public class TestH5Ocreate { } } + @Test + public void testH5Ocork() { + boolean corked = false; + + // Check cork status of the group: not corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertFalse("H5Oare_mdc_flushes_disabled: ", corked); + + // Cork the group: an object + try { + H5.H5Odisable_mdc_flushes(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Odisable_mdc_flushes: " + err); + } + + // Check cork status of the group: corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertTrue("H5Oare_mdc_flushes_disabled: ", corked); + + // Unork the group: an object + try { + H5.H5Oenable_mdc_flushes(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oenable_mdc_flushes: " + err); + } + + // Check cork status of the group: corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertFalse("H5Oare_mdc_flushes_disabled: ", corked); + } + } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index d340ee7..cac3dcd 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -159,4 +159,19 @@ public class TestH5Oparams { H5.H5Orefresh(-1); } + @Test(expected = HDF5LibraryException.class) + public void testH5Odisable_mdc_flushes() throws Throwable { + H5.H5Odisable_mdc_flushes(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oenable_mdc_flushes() throws Throwable { + H5.H5Oenable_mdc_flushes(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oare_mdc_flushes_disabled() throws Throwable { + H5.H5Oare_mdc_flushes_disabled(-1); + } + } diff --git a/java/test/testfiles/JUnit-TestH5Ocreate.txt b/java/test/testfiles/JUnit-TestH5Ocreate.txt index c2365e5..5bc9e07 100644 --- a/java/test/testfiles/JUnit-TestH5Ocreate.txt +++ b/java/test/testfiles/JUnit-TestH5Ocreate.txt @@ -4,6 +4,7 @@ JUnit version 4.11 .testH5Oget_info_softlink .testH5Oget_info_externallink .testH5Ocopy +.testH5Ocork .testH5Olink .testH5Ocomment_by_name .testH5Oget_info_by_idx_n1_create @@ -17,5 +18,5 @@ JUnit version 4.11 Time: XXXX -OK (15 tests) +OK (16 tests) diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt index 94220b9..bc23695 100644 --- a/java/test/testfiles/JUnit-TestH5Oparams.txt +++ b/java/test/testfiles/JUnit-TestH5Oparams.txt @@ -3,8 +3,10 @@ JUnit version 4.11 .testH5Ovisit_by_name_nullname .testH5Oget_info_invalid .testH5Ovisit_by_name_null +.testH5Odisable_mdc_flushes .testH5Oget_comment_invalid .testH5Oset_comment_by_name_invalid +.testH5Oare_mdc_flushes_disabled .testH5Oopen_null .testH5Oclose_invalid .testH5Oflush_invalid @@ -22,9 +24,10 @@ JUnit version 4.11 .testH5Ocopy_null_current .testH5Oset_comment_invalid .testH5Oopen_invalid +.testH5Oenable_mdc_flushes .testH5Ovisit_null Time: XXXX -OK (24 tests) +OK (27 tests) -- cgit v0.12