summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-08-19 16:58:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-08-19 16:58:52 (GMT)
commit935f27c1b803faf981131ff936619aecd9f76e38 (patch)
treef0e9d3d639c522cdc187088d95de293902567b3b /java
parent06e5cbd54149087de0c7d99f1d14be5729d6c129 (diff)
downloadhdf5-935f27c1b803faf981131ff936619aecd9f76e38.zip
hdf5-935f27c1b803faf981131ff936619aecd9f76e38.tar.gz
hdf5-935f27c1b803faf981131ff936619aecd9f76e38.tar.bz2
HDFFV-10887 Implement requested functions
Diffstat (limited to 'java')
-rw-r--r--java/src/hdf/hdf5lib/H5.java7
-rw-r--r--java/src/jni/h5oImp.c60
-rw-r--r--java/src/jni/h5oImp.h27
-rw-r--r--java/test/TestH5Ocreate.java53
-rw-r--r--java/test/TestH5Oparams.java15
-rw-r--r--java/test/testfiles/JUnit-TestH5Ocreate.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5Oparams.txt5
7 files changed, 164 insertions, 6 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 481ca8c..4b563fd 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -5048,10 +5048,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)