From f4015bed9e7ee43468240e734232f9114b749d4f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Jun 2019 14:33:54 -0700 Subject: Updated the Java attribute test so that attribute access property lists are created and used correctly. --- java/test/TestH5A.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index 536364c..7d336e1 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -50,6 +50,7 @@ public class TestH5A { long type_id = -1; long space_id = -1; long lapl_id = -1; + long aapl_id = -1; private final void _deleteFile(String filename) { File file = new File(filename); @@ -90,8 +91,10 @@ public class TestH5A { assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); space_id = H5.H5Screate(HDF5Constants.H5S_NULL); assertTrue(space_id > 0); - lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); assertTrue(lapl_id > 0); + aapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + assertTrue(aapl_id > 0); type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE); assertTrue(type_id > 0); int status = H5.H5Tenum_insert(type_id, "test", 1); @@ -122,6 +125,8 @@ public class TestH5A { try {H5.H5Sclose(space_id);} catch (Exception ex) {} if (lapl_id > 0) try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + if (aapl_id > 0) + try {H5.H5Pclose(aapl_id);} catch (Exception ex) {} System.out.println(); } @@ -194,7 +199,6 @@ public class TestH5A { long n = 0; long attr_id = -1; long attribute_id = -1; - long aapl_id = HDF5Constants.H5P_DEFAULT; try { attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, @@ -203,7 +207,7 @@ public class TestH5A { // Opening the existing attribute, obj_name(Created by H5ACreate2) // by index, attached to an object identifier. attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, - 0, HDF5Constants.H5P_DEFAULT, lapl_id); + 0, aapl_id, lapl_id); assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); @@ -258,7 +262,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Acreate_by_name: H5Acreate_by_name", attribute_id >= 0); @@ -289,7 +293,7 @@ public class TestH5A { boolean bool_val = false; try { - attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id); + attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id); ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); @@ -328,7 +332,7 @@ public class TestH5A { try { attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id); @@ -369,7 +373,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); ret_name = H5.H5Aget_name(attribute_id); assertEquals(ret_name, attr_name); -- cgit v0.12