diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-09-05 19:35:33 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-09-05 19:35:33 (GMT) |
commit | dcab85c83b72bd41fcefd8d989b3d17db8b44981 (patch) | |
tree | 37c044719e1a85f994f4bca0a2b808df4abf6798 /java/test | |
parent | e3e9cf04b07310873c0916448229a0d45eb83c11 (diff) | |
download | hdf5-dcab85c83b72bd41fcefd8d989b3d17db8b44981.zip hdf5-dcab85c83b72bd41fcefd8d989b3d17db8b44981.tar.gz hdf5-dcab85c83b72bd41fcefd8d989b3d17db8b44981.tar.bz2 |
Add back missing java implementation
Diffstat (limited to 'java/test')
-rw-r--r-- | java/test/TestH5Pfaplhdfs.java | 69 | ||||
-rw-r--r-- | java/test/TestH5Pfapls3.java | 67 |
2 files changed, 29 insertions, 107 deletions
diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 30d326e..b0d42d8 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -19,18 +19,11 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; -import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; import org.junit.Before; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfaplhdfs { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfaplhdfs { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,23 +89,11 @@ public class TestH5Pfaplhdfs { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testHDFS_fapl() - throws Exception + public void testHDFS_fapl() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -127,34 +104,17 @@ public class TestH5Pfaplhdfs { String kerbcache = "/dev/null"; int streamsize = 1024; - final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize - ); - assertTrue("setting fapl should succeed", - -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); + final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize); + assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); - assertEquals("driver types should match", - HDF5Constants.H5FD_HDFS, - H5.H5Pget_driver(fapl_id)); + assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id); - assertEquals("fapl contents should match", - new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize), - copy); + assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_hdfs_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -162,8 +122,7 @@ public class TestH5Pfaplhdfs { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -172,9 +131,7 @@ public class TestH5Pfaplhdfs { /* TODO: for now, test against a sec2 fapl only */ H5.H5Pset_fapl_sec2(fapl_id); - assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id); } diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index 00a2a73..ba10524 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -19,17 +19,10 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; -import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfapls3 { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfapls3 { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,48 +89,32 @@ public class TestH5Pfapls3 { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testH5Pset_fapl_ros3() - throws Exception + public void testH5Pset_fapl_ros3() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(); assertEquals("Default fapl has unexpected contents", - new H5FD_ros3_fapl_t("", "", ""), - config); + new H5FD_ros3_fapl_t("", "", ""), config); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); /* get_fapl_ros3 can throw exception in error cases */ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t("", "", ""), - copy); + new H5FD_ros3_fapl_t("", "", ""), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_ros3_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -149,8 +122,7 @@ public class TestH5Pfapls3 { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -160,14 +132,12 @@ public class TestH5Pfapls3 { H5.H5Pset_fapl_sec2(fapl_id); assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id); } @Test - public void testH5Pset_fapl_ros3_specified() - throws Exception + public void testH5Pset_fapl_ros3_specified() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; @@ -176,19 +146,14 @@ public class TestH5Pfapls3 { String acc_id = "my_access_id"; String acc_key = "my_access_key"; - final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t( - region, - acc_id, - acc_key); + final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t(region, acc_id, acc_key), - copy); + new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy); } } |