diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-12-08 22:27:45 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-12-09 21:44:38 (GMT) |
commit | 483f862a012977e8e28c2954e13ce137f04ed028 (patch) | |
tree | 62f55aee86a9ca5f2c9a0a5e1982f5a61833a16e /java/test/TestH5R.java | |
parent | 310b42e35af19780000344fa8902c1954659ee58 (diff) | |
download | hdf5-483f862a012977e8e28c2954e13ce137f04ed028.zip hdf5-483f862a012977e8e28c2954e13ce137f04ed028.tar.gz hdf5-483f862a012977e8e28c2954e13ce137f04ed028.tar.bz2 |
Fix compile error and add ref destroy to Java test
Diffstat (limited to 'java/test/TestH5R.java')
-rw-r--r-- | java/test/TestH5R.java | 307 |
1 files changed, 105 insertions, 202 deletions
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index ba16e9b..7b9f538 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -151,208 +151,108 @@ public class TestH5R { } // Test v1.8 APIs params - - @Ignore - public void testH5Rget_name() { - long loc_id = H5fid; - int ref_type = HDF5Constants.H5R_OBJECT; - long ret_val = -1; - byte[] ref = null; - String[] name = {""}; - String objName = "/dset"; - - try { - ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Rget_name:H5Rcreate " + err); - } - - try { - ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Rget_name: " + err); - } - - assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); - assertTrue("The name of the object: ", objName.equals(name[0])); - } - - @Ignore - public void testH5Rget_obj_type2() { - int ref_type=HDF5Constants.H5R_OBJECT; - byte[] ref=null; - - String objName = "/dset"; - int obj_type = -1; - - try { - ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); - } - catch(Throwable err) { - err.printStackTrace(); - } - - try { - obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Rget_obj_type2: " + err); - } - assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); - } - - @Ignore - public void testH5Rcreate_refobj() { - byte[] ref = null; - - try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Rcreate: " + err); - } - assertNotNull(ref); - } - - @Ignore - public void testH5Rcreate_regionrefobj() { - byte[] ref = null; - try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Rcreate: " + err); - } - assertNotNull(ref); - } - - @Ignore - public void testH5Rdereference() { - byte[] ref1 = null; - byte[] ref2 = null; - long dataset_id = -1; - long group_id = -1; - try { - //Create reference on dataset - ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); - - //Create reference on group - ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); - assertNotNull(ref1); - assertNotNull(ref2); - assertTrue(dataset_id >= 0); - assertTrue(group_id >= 0); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Rdereference " + err); - } - finally { - try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} - try {H5.H5Gclose(group_id);} catch (Exception ex) {} - } - } - - @Ignore - public void testH5Rget_region() { - byte[] ref = null; - long dsid = -1; - try { - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); - assertNotNull(ref); - assertTrue(dsid >= 0); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Rget_region: " + err); - } - finally { - try {H5.H5Sclose(dsid);} catch (Exception ex) {} - } - } - - @Ignore//(expected = IllegalArgumentException.class) - public void testH5Rget_name_Invalidreftype() throws Throwable { - byte[] ref = null; - String[] name = {""}; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16); - } - - @Ignore//(expected = NullPointerException.class) - public void testH5Rget_name_NULLreference() throws Throwable { - byte[] ref = null; - String[] name = {""}; - H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16); - } - - @Ignore//(expected = HDF5LibraryException.class) - public void testH5Rget_obj_type2_Invalidreftype() throws Throwable { - byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); - } - - @Ignore//(expected = HDF5LibraryException.class) - public void testH5Rcreate_InvalidObjectName() throws Throwable { - byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); - } - - @Ignore//(expected = HDF5LibraryException.class) - public void testH5Rcreate_Invalidspace_id() throws Throwable { - byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); - } - - @Ignore//(expected = IllegalArgumentException.class) - public void testH5Rcreate_Invalidreftype() throws Throwable { - byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); - } - - @Ignore//(expected = IllegalArgumentException.class) - public void testH5Rgetregion_Invalidreftype() throws Throwable { - byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); - H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); - } - - @Ignore//(expected = IllegalArgumentException.class) - public void testH5Rgetregion_Badreferencetype() throws Throwable { - byte[] ref = null; - ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); - H5.H5Rget_region(H5fid, HDF5Constants.H5R_OBJECT, ref); - } - - @Ignore//(expected = NullPointerException.class) - public void testH5Rgetregion_Nullreference() throws Throwable { - byte[] ref = null; - H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); - } - - @Ignore//(expected = NullPointerException.class) - public void testH5Rdereference_Nullreference() throws Throwable { - byte[] ref = null; - H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref); - } - - @Ignore//(expected = IllegalArgumentException.class) - public void testH5Rdereference_Invalidreference() throws Throwable { - byte[] ref1 = null; - byte[] ref2 = null; - ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); - ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); - H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); - } - + /* + * @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type = + * HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String + * objName = "/dset"; + * + * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); } + * + * try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rget_name: " + err); } + * + * assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ", + * objName.equals(name[0])); } + * + * @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[] + * ref=null; + * + * String objName = "/dset"; int obj_type = -1; + * + * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) { + * err.printStackTrace(); } + * + * try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable + * err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type, + * HDF5Constants.H5O_TYPE_DATASET); } + * + * @Ignore public void testH5Rcreate_refobj() { byte[] ref = null; + * + * try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } + * + * @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) { + * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); } + * + * @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long + * dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dataset_id= + * H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); + * + * //Create reference on group ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + * group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); + * assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); assertTrue(group_id >= 0); + * } catch (Throwable err) { err.printStackTrace(); fail("TestH5Rdereference " + err); } finally { + * try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} try {H5.H5Gclose(group_id);} catch + * (Exception ex) {} } } + * + * @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dsid = + * H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); assertNotNull(ref); + * assertTrue(dsid >= 0); } catch (Throwable err) { err.printStackTrace(); + * fail("TestH5Rget_region: " + err); } finally { try {H5.H5Sclose(dsid);} catch (Exception ex) {} } + * } + * + * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype() + * throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset", + * HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, + * 16); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference() + * throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid, + * HDF5Constants.H5R_OBJECT, ref, name, 16); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void + * testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid, + * HDF5Constants.H5R_DATASET_REGION, ref); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); } + * + * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); + * } + * + * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype() + * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid, + * "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, + * HDF5Constants.H5R_DATASET_REGION, ref); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref = + * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid, + * HDF5Constants.H5R_OBJECT, ref); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference() + * throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, + * ref); } + * + * @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference() + * throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, + * HDF5Constants.H5R_OBJECT, ref); } + * + * @Ignore//(expected = IllegalArgumentException.class) public void + * testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null; + * ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 = + * H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid, + * HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); } + */ // Test v1.12 APIs params @Test @@ -397,6 +297,7 @@ public class TestH5R { fail("testH5Rget_object: H5Rget_obj_name: " + err); } assertTrue("The name of the object: ", objName.equals(name)); + H5.H5Rdestroy(ref); } @Test @@ -421,6 +322,7 @@ public class TestH5R { fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err); } assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + H5.H5Rdestroy(ref); } @Test @@ -448,6 +350,7 @@ public class TestH5R { fail("testH5Rget_object: H5Rcreate_region " + err); } assertNotNull(ref); + H5.H5Rdestroy(ref); } // These tests need to be updated with new APIs |