HDFFV-10887 Implement requested functions

This commit is contained in:
Allen Byrne 2019-08-19 11:58:44 -05:00
parent 06e5cbd541
commit 935f27c1b8
7 changed files with 164 additions and 6 deletions

View File

@ -5048,10 +5048,9 @@ public class H5 implements java.io.Serializable {
**/ **/
public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException;
// /////// unimplemented //////// public synchronized static native void H5Odisable_mdc_flushes(long object_id);
// herr_t H5Odisable_mdc_flushes(hid_t object_id); public synchronized static native void H5Oenable_mdc_flushes(long object_id);
// herr_t H5Oenable_mdc_flushes(hid_t object_id); public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id);
// herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
// //////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////
// // // //

View File

@ -856,6 +856,66 @@ done:
return; return;
} /* end Java_hdf_hdf5lib_H5_H5Orefresh */ } /* 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 #ifdef __cplusplus

View File

@ -202,6 +202,33 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Orefresh Java_hdf_hdf5lib_H5_H5Orefresh
(JNIEnv*, jclass, jlong); (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 #ifdef __cplusplus
} /* end extern "C" */ } /* end extern "C" */
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -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);
}
} }

View File

@ -159,4 +159,19 @@ public class TestH5Oparams {
H5.H5Orefresh(-1); 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);
}
} }

View File

@ -4,6 +4,7 @@ JUnit version 4.11
.testH5Oget_info_softlink .testH5Oget_info_softlink
.testH5Oget_info_externallink .testH5Oget_info_externallink
.testH5Ocopy .testH5Ocopy
.testH5Ocork
.testH5Olink .testH5Olink
.testH5Ocomment_by_name .testH5Ocomment_by_name
.testH5Oget_info_by_idx_n1_create .testH5Oget_info_by_idx_n1_create
@ -17,5 +18,5 @@ JUnit version 4.11
Time: XXXX Time: XXXX
OK (15 tests) OK (16 tests)

View File

@ -3,8 +3,10 @@ JUnit version 4.11
.testH5Ovisit_by_name_nullname .testH5Ovisit_by_name_nullname
.testH5Oget_info_invalid .testH5Oget_info_invalid
.testH5Ovisit_by_name_null .testH5Ovisit_by_name_null
.testH5Odisable_mdc_flushes
.testH5Oget_comment_invalid .testH5Oget_comment_invalid
.testH5Oset_comment_by_name_invalid .testH5Oset_comment_by_name_invalid
.testH5Oare_mdc_flushes_disabled
.testH5Oopen_null .testH5Oopen_null
.testH5Oclose_invalid .testH5Oclose_invalid
.testH5Oflush_invalid .testH5Oflush_invalid
@ -22,9 +24,10 @@ JUnit version 4.11
.testH5Ocopy_null_current .testH5Ocopy_null_current
.testH5Oset_comment_invalid .testH5Oset_comment_invalid
.testH5Oopen_invalid .testH5Oopen_invalid
.testH5Oenable_mdc_flushes
.testH5Ovisit_null .testH5Ovisit_null
Time: XXXX Time: XXXX
OK (24 tests) OK (27 tests)