summaryrefslogtreecommitdiffstats
path: root/java/test
diff options
context:
space:
mode:
Diffstat (limited to 'java/test')
-rw-r--r--java/test/CMakeLists.txt5
-rw-r--r--java/test/Makefile.am2
-rw-r--r--java/test/TestH5.java155
-rw-r--r--java/test/TestH5A.java115
-rw-r--r--java/test/TestH5D.java41
-rw-r--r--java/test/TestH5Dparams.java1
-rw-r--r--java/test/TestH5Dplist.java9
-rw-r--r--java/test/TestH5E.java1
-rw-r--r--java/test/TestH5Edefault.java85
-rw-r--r--java/test/TestH5Eparams.java1
-rw-r--r--java/test/TestH5Eregister.java1
-rw-r--r--java/test/TestH5F.java19
-rw-r--r--java/test/TestH5Fbasic.java17
-rw-r--r--java/test/TestH5Fparams.java13
-rw-r--r--java/test/TestH5Fswmr.java13
-rw-r--r--java/test/TestH5G.java31
-rw-r--r--java/test/TestH5Gbasic.java17
-rw-r--r--java/test/TestH5Giterate.java7
-rw-r--r--java/test/TestH5Lbasic.java3
-rw-r--r--java/test/TestH5Lcreate.java19
-rw-r--r--java/test/TestH5Lparams.java1
-rw-r--r--java/test/TestH5Obasic.java55
-rw-r--r--java/test/TestH5Ocopy.java41
-rw-r--r--java/test/TestH5Ocreate.java27
-rw-r--r--java/test/TestH5Oparams.java1
-rw-r--r--java/test/TestH5P.java31
-rw-r--r--java/test/TestH5PData.java11
-rw-r--r--java/test/TestH5PL.java11
-rw-r--r--java/test/TestH5Pfapl.java29
-rw-r--r--java/test/TestH5Pfaplhdfs.java11
-rw-r--r--java/test/TestH5Pfapls3.java11
-rw-r--r--java/test/TestH5Plist.java33
-rw-r--r--java/test/TestH5Pvirtual.java27
-rw-r--r--java/test/TestH5R.java118
-rw-r--r--java/test/TestH5Rref.java562
-rw-r--r--java/test/TestH5S.java21
-rw-r--r--java/test/TestH5Sbasic.java25
-rw-r--r--java/test/TestH5T.java23
-rw-r--r--java/test/TestH5Tbasic.java13
-rw-r--r--java/test/TestH5Tparams.java1
-rw-r--r--java/test/TestH5VL.java53
-rw-r--r--java/test/TestH5Z.java1
-rw-r--r--java/test/junit.sh.in29
-rw-r--r--java/test/testfiles/JUnit-TestH5.txt4
-rw-r--r--java/test/testfiles/JUnit-TestH5Rref.txt10
45 files changed, 1144 insertions, 560 deletions
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index b0a0d53..6544b77 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -27,6 +27,7 @@ set (HDF5_JAVA_TEST_SOURCES
TestH5Lbasic
TestH5Lcreate
TestH5R
+ TestH5Rref
TestH5P
TestH5PData
TestH5Pfapl
@@ -93,6 +94,8 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
@@ -206,6 +209,8 @@ if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL)
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5" "${PROJECT_BINARY_DIR}/${voltest}/trefer_attr.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list})
diff --git a/java/test/Makefile.am b/java/test/Makefile.am
index e953c6b..41cd56e 100644
--- a/java/test/Makefile.am
+++ b/java/test/Makefile.am
@@ -1,6 +1,5 @@
#
# Copyright by The HDF Group.
-# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
@@ -58,6 +57,7 @@ noinst_JAVA = \
TestH5Lbasic.java \
TestH5Lcreate.java \
TestH5R.java \
+ TestH5Rref.java \
TestH5P.java \
TestH5PData.java \
TestH5Pfapl.java \
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 1f9ea06..a6b60d3 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -32,6 +31,7 @@ import java.io.StreamTokenizer;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
@@ -47,22 +47,21 @@ import org.junit.rules.TestName;
*/
public class TestH5 {
@Rule public TestName testname = new TestName();
- @Before
- public void showTestName() {
- System.out.print(testname.getMethodName());
- }
- @After
- public void nextTestName() {
- System.out.println();
- }
private static final String H5_FILE = "testData.h5";
private static final String EXPORT_FILE = "testExport.txt";
+ private static final String H5_DREG_FILE = "trefer_reg.h5";
+ private static final String EXPORT_DREG_FILE = "testExportReg.txt";
+ private static final String H5_AREG_FILE = "trefer_attr.h5";
+ private static final String EXPORT_AREG_FILE = "testExportAReg.txt";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
+ private static final int DIM_BLKS = 36;
+ private static final int DIM_PNTS = 10;
+ private static final int DIM_ATTR = 12;
private static final int RANK = 2;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -78,7 +77,7 @@ public class TestH5 {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -115,22 +114,64 @@ public class TestH5 {
}
}
- public final void _closeH5File() throws HDF5LibraryException {
+ private final void _closeH5File() {
if (H5did >= 0)
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
if (H5dsid > 0)
try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
if (H5fid > 0)
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- H5dsid = -1;
- H5did = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
+ H5dsid = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
+ }
+
+ public void _openH5File(String filename, String dsetname) {
+ try {
+ H5fid = H5.H5Fopen(filename,
+ HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Screate_simple: ",H5dsid > 0);
}
public final void _deleteH5file() {
+ _closeH5File();
_deleteFile(H5_FILE);
}
+ @After
+ public void closeH5File() throws HDF5LibraryException {
+ _closeH5File();
+ System.out.println();
+ }
+
+ @Before
+ public void verifyCount()
+ throws NullPointerException, HDF5Exception {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ }
+
/**
* Test method for {@link hdf.hdf5lib.H5#J2C(int)}.
* NOTE:
@@ -411,4 +452,84 @@ public class TestH5 {
}
_deleteH5file();
}
+
+ @Test
+ public void testH5export_regdataset() {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
+ 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
+ String objName = "/Dataset1";
+
+ _openH5File(H5_DREG_FILE, objName);
+
+ try {
+ H5.H5export_dataset(EXPORT_DREG_FILE, H5_DREG_FILE, objName, 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_dataset failed: " + err);
+ }
+
+ File file = new File(EXPORT_DREG_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_DREG_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx] = (int)streamTokenizer.nval;
+ indx++;
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ }
+
+ @Test
+ public void testH5export_attrdataset() {
+ int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11};
+ int[] dset_indata = new int[DIM_ATTR];
+ String objName = "/Dataset3";
+
+ _openH5File(H5_AREG_FILE, objName);
+
+ try {
+ H5.H5export_dataset(EXPORT_AREG_FILE, H5_AREG_FILE, objName, 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_dataset failed: " + err);
+ }
+
+ File file = new File(EXPORT_AREG_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_AREG_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ int jndx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx] = (int)streamTokenizer.nval;
+ indx++;
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ }
}
diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java
index cff03f9..f2134d2 100644
--- a/java/test/TestH5A.java
+++ b/java/test/TestH5A.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -43,14 +42,14 @@ public class TestH5A {
private static final String H5_FILE = "testA.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
- long type_id = -1;
- long space_id = -1;
- long lapl_id = -1;
- long aapl_id = -1;
+ long type_id = HDF5Constants.H5I_INVALID_HID;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
+ long aapl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -61,7 +60,7 @@ public class TestH5A {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -132,7 +131,7 @@ public class TestH5A {
@Test
public void testH5Acreate2() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Acreate2", attr_id >= 0);
@@ -160,8 +159,8 @@ public class TestH5A {
@Test
public void testH5Aopen() {
String attr_name = "dset";
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id,
@@ -197,8 +196,8 @@ public class TestH5A {
int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER;
int order = HDF5Constants.H5_ITER_INC;
long n = 0;
- long attr_id = -1;
- long attribute_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "file", type_id, space_id,
@@ -256,7 +255,7 @@ public class TestH5A {
public void testH5Acreate_by_name() {
String obj_name = ".";
String attr_name = "DATASET";
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
boolean bool_val = false;
try {
@@ -288,7 +287,7 @@ public class TestH5A {
long loc_id = H5fid;
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int ret_val = -1;
boolean bool_val = false;
@@ -326,7 +325,7 @@ public class TestH5A {
String obj_name = ".";
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int ret_val = -1;
boolean bool_val = false;
@@ -368,7 +367,7 @@ public class TestH5A {
String obj_name = ".";
String attr_name = "DATASET1";
String ret_name = null;
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
@@ -398,8 +397,8 @@ public class TestH5A {
int idx_type = HDF5Constants.H5_INDEX_NAME;
int order = HDF5Constants.H5_ITER_INC;
int n = 0;
- long attr1_id = -1;
- long attr2_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name,
@@ -435,8 +434,8 @@ public class TestH5A {
@Test
public void testH5Aget_storage_size() {
- long attr_id = -1;
- long attr_size = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_size = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
@@ -458,8 +457,8 @@ public class TestH5A {
@Test
public void testH5Aget_info() {
H5A_info_t attr_info = null;
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
@@ -490,8 +489,8 @@ public class TestH5A {
@Test
public void testH5Aget_info1() {
H5A_info_t attr_info = null;
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int order = HDF5Constants.H5_ITER_INC;
try {
@@ -526,8 +525,8 @@ public class TestH5A {
@Test
public void testH5Aget_info_by_idx() {
- long attr_id = -1;
- long attr2_id = -1;;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;;
H5A_info_t attr_info = null;
try {
@@ -582,7 +581,7 @@ public class TestH5A {
@Test
public void testH5Aget_info_by_name() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
H5A_info_t attr_info = null;
String obj_name = ".";
String attr_name = "DATASET";
@@ -607,7 +606,7 @@ public class TestH5A {
@Test
public void testH5Adelete_by_name() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int ret_val = -1;
boolean bool_val = false;
boolean exists = false;
@@ -650,8 +649,8 @@ public class TestH5A {
@Test
public void testH5Aexists() {
boolean exists = false;
- long attr_id = -1;
- long attribute_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
exists = H5.H5Aexists(H5fid, "None");
@@ -689,10 +688,10 @@ public class TestH5A {
@Test
public void testH5Adelete_by_idx_order() {
boolean exists = false;
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -731,9 +730,9 @@ public class TestH5A {
@Test
public void testH5Adelete_by_idx_name1() {
boolean exists = false;
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -766,10 +765,10 @@ public class TestH5A {
@Test
public void testH5Adelete_by_idx_name2() {
boolean exists = false;
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -821,8 +820,8 @@ public class TestH5A {
public void testH5Aopen_by_name() {
String obj_name = ".";
String attr_name = "DATASET";
- long attribute_id = -1;
- long aid = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
@@ -856,9 +855,9 @@ public class TestH5A {
@Test
public void testH5Awrite_readVL() {
String attr_name = "VLdata";
- long attr_id = -1;
- long atype_id = -1;
- long aspace_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long atype_id = HDF5Constants.H5I_INVALID_HID;
+ long aspace_id = HDF5Constants.H5I_INVALID_HID;
String[] str_data = { "Parting", "is such", "sweet", "sorrow." };
long[] dims = { str_data.length };
long lsize = 1;
@@ -923,8 +922,8 @@ public class TestH5A {
public void testH5Aget_create_plist() {
String attr_name = "DATASET1";
int char_encoding = 0;
- long plist_id = -1;
- long attribute_id = -1;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE);
@@ -984,10 +983,10 @@ public class TestH5A {
@Test
public void testH5Aiterate() {
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
class idata {
public String attr_name = null;
@@ -1052,10 +1051,10 @@ public class TestH5A {
@Test
public void testH5Aiterate_by_name() {
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
class idata {
public String attr_name = null;
diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java
index 21f0879..863ce79 100644
--- a/java/test/TestH5D.java
+++ b/java/test/TestH5D.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -39,13 +38,13 @@ public class TestH5D {
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
private static final int RANK = 2;
- long H5fid = -1;
- long H5faplid = -1;
- long H5dsid = -1;
- long H5dtid = -1;
- long H5did = -1;
- long H5did0 = -1;
- long H5dcpl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5faplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dtid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5did0 = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
// Values for the status of space allocation
@@ -195,9 +194,9 @@ public class TestH5D {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
}
- private final void _openH5file(String name, long dapl) {
+ private final void _openH5file(String filename, String dsetname, long dapl) {
try {
- H5fid = H5.H5Fopen(H5_FILE,
+ H5fid = H5.H5Fopen(filename,
HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
@@ -206,7 +205,7 @@ public class TestH5D {
}
assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0);
try {
- H5did = H5.H5Dopen(H5fid, name, dapl);
+ H5did = H5.H5Dopen(H5fid, dsetname, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -268,7 +267,7 @@ public class TestH5D {
@Test
public void testH5Dcreate() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -292,7 +291,7 @@ public class TestH5D {
@Test
public void testH5Dcreate_anon() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE,
H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -315,12 +314,12 @@ public class TestH5D {
@Test
public void testH5Dopen() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
H5.H5Dclose(H5did);
- H5did = -1;
+ H5did = HDF5Constants.H5I_INVALID_HID;
dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Exception err) {
@@ -388,8 +387,8 @@ public class TestH5D {
@Test
public void testH5Dget_access_plist() {
- long dapl_id = -1;
- long test_dapl_id = -1;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long test_dapl_id = HDF5Constants.H5I_INVALID_HID;
int[] mdc_nelmts1 = {0};
int[] mdc_nelmts2 = {0};
long[] rdcc_nelmts1 = {0};
@@ -500,7 +499,7 @@ public class TestH5D {
@Test(expected = HDF5LibraryException.class)
public void testH5Dget_space_closed() throws Throwable {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -518,7 +517,7 @@ public class TestH5D {
@Test
public void testH5Dget_space() {
- long dataspace_id = -1;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
@@ -542,7 +541,7 @@ public class TestH5D {
@Test(expected = HDF5LibraryException.class)
public void testH5Dget_type_closed() throws Throwable {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -560,7 +559,7 @@ public class TestH5D {
@Test
public void testH5Dget_type() {
- long datatype_id = -1;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java
index 66f0d83..3661139 100644
--- a/java/test/TestH5Dparams.java
+++ b/java/test/TestH5Dparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java
index 97ce084..774b9dd 100644
--- a/java/test/TestH5Dplist.java
+++ b/java/test/TestH5Dplist.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -42,10 +41,10 @@ public class TestH5Dplist {
private static final int NDIMS = 2;
private static final int FILLVAL = 99;
private static final int RANK = 2;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
- long H5dcpl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
long[] H5extdims = { EDIM_X, EDIM_Y };
long[] H5chunk_dims = { CHUNK_X, CHUNK_Y };
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 68cd933..cad0a06 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 2f05c75..9e93cea 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -58,27 +57,27 @@ public class TestH5Edefault {
@Ignore
public void testH5Eprint() {
- /*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
- String connector = System.getenv("HDF5_VOL_CONNECTOR");
- if (connector == null) {
- try {
- H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eprint: " + err);
- }
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eprint: " + err);
+ }
+ }
}
@Test
@@ -439,27 +438,27 @@ public class TestH5Edefault {
@Ignore
public void testH5EprintInt() {
- /*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
- String connector = System.getenv("HDF5_VOL_CONNECTOR");
- if (connector == null) {
- try {
- H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5EprintInt: " + err);
- }
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5EprintInt: " + err);
+ }
+ }
}
@Test
diff --git a/java/test/TestH5Eparams.java b/java/test/TestH5Eparams.java
index e74475f..e55f1fc 100644
--- a/java/test/TestH5Eparams.java
+++ b/java/test/TestH5Eparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java
index 99f8303..99e8e5f 100644
--- a/java/test/TestH5Eregister.java
+++ b/java/test/TestH5Eregister.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java
index 3ef4635..16786b9 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -49,7 +48,7 @@ public class TestH5F {
HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
HDF5Constants.H5F_OBJ_ALL };
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -74,7 +73,7 @@ public class TestH5F {
public void deleteH5file() throws HDF5LibraryException {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
System.out.println();
@@ -82,7 +81,7 @@ public class TestH5F {
@Test
public void testH5Fget_create_plist() {
- long plist = -1;
+ long plist = HDF5Constants.H5I_INVALID_HID;
try {
plist = H5.H5Fget_create_plist(H5fid);
@@ -106,7 +105,7 @@ public class TestH5F {
@Test
public void testH5Fget_access_plist() {
- long plist = -1;
+ long plist = HDF5Constants.H5I_INVALID_HID;
try {
plist = H5.H5Fget_access_plist(H5fid);
@@ -134,7 +133,7 @@ public class TestH5F {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
@@ -159,7 +158,7 @@ public class TestH5F {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
@@ -182,8 +181,8 @@ public class TestH5F {
public void testH5Fget_fileno_same() {
long fileno1 = 0;
long fileno2 = 0;
- long fid1 = -1;
- long fid2 = -1;
+ long fid1 = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
@@ -213,7 +212,7 @@ public class TestH5F {
public void testH5Fget_fileno_diff() {
long fileno1 = 0;
long fileno2 = 0;
- long fid2 = -1;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java
index 225e311..4f3d928 100644
--- a/java/test/TestH5Fbasic.java
+++ b/java/test/TestH5Fbasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -35,7 +34,7 @@ public class TestH5Fbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testFb.h5";
private static final String TXT_FILE = "testFb.txt";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -90,7 +89,7 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Fopen_read_only() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -125,8 +124,8 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Freopen_closed() throws Throwable {
- long fid = -1;
- long fid2 = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -148,8 +147,8 @@ public class TestH5Fbasic {
@Test
public void testH5Freopen() {
- long fid = -1;
- long fid2 = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -182,7 +181,7 @@ public class TestH5Fbasic {
@Test
public void testH5Fclose() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -202,7 +201,7 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Fclose_twice() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index 85bfdf5..0376485 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -105,7 +104,7 @@ public class TestH5Fparams {
@Test
public void testH5Fcreate() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
File file = null;
try {
@@ -132,7 +131,7 @@ public class TestH5Fparams {
@Test
public void testH5Fflush_global() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
@@ -158,7 +157,7 @@ public class TestH5Fparams {
@Test
public void testH5Fflush_local() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
@@ -184,7 +183,7 @@ public class TestH5Fparams {
@Test
public void testH5Fget_info() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -215,7 +214,7 @@ public class TestH5Fparams {
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -234,7 +233,7 @@ public class TestH5Fparams {
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java
index 6a7ccfa..1ec78fe 100644
--- a/java/test/TestH5Fswmr.java
+++ b/java/test/TestH5Fswmr.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -33,9 +32,9 @@ public class TestH5Fswmr {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testswmr.h5";
- long H5fid = -1;
- long H5fapl = -1;
- long H5fcpl = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fapl = HDF5Constants.H5I_INVALID_HID;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -63,15 +62,15 @@ public class TestH5Fswmr {
public void deleteH5file() throws HDF5LibraryException {
if (H5fapl > 0) {
try {H5.H5Pclose(H5fapl);} catch (Exception ex) {}
- H5fapl = -1;
+ H5fapl = HDF5Constants.H5I_INVALID_HID;
}
if (H5fcpl > 0) {
try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
- H5fcpl = -1;
+ H5fcpl = HDF5Constants.H5I_INVALID_HID;
}
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
System.out.println();
diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java
index abd9642..edf2cbe 100644
--- a/java/test/TestH5G.java
+++ b/java/test/TestH5G.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -39,11 +38,11 @@ public class TestH5G {
private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12",
"/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" };
private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"};
- long H5fid = -1;
- long H5fid2 = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -58,8 +57,8 @@ public class TestH5G {
}
private final long _createGroup2(long fid, String name) {
- long gid = -1;
- long gcpl = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
+ long gcpl = HDF5Constants.H5I_INVALID_HID;
try {
gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl
}
@@ -92,12 +91,12 @@ public class TestH5G {
}
private final long _openGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- gid = -1;
+ gid = HDF5Constants.H5I_INVALID_HID;
err.printStackTrace();
fail("H5.H5Gopen: " + err);
}
@@ -134,7 +133,7 @@ public class TestH5G {
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0);
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0);
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
gid = _createGroup(H5fid, GROUPS[i]);
@@ -165,7 +164,7 @@ public class TestH5G {
@Test
public void testH5Gopen() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
try {
gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT);
@@ -185,8 +184,8 @@ public class TestH5G {
@Test
public void testH5Gget_create_plist() {
- long gid = -1;
- long pid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
+ long pid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
try {
@@ -325,7 +324,7 @@ public class TestH5G {
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objTokens, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -366,7 +365,7 @@ public class TestH5G {
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objTokens, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -401,7 +400,7 @@ public class TestH5G {
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objTokens, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
@@ -432,7 +431,7 @@ public class TestH5G {
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objTokens, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java
index aea417e..6e2e450 100644
--- a/java/test/TestH5Gbasic.java
+++ b/java/test/TestH5Gbasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -33,10 +32,10 @@ import org.junit.rules.TestName;
public class TestH5Gbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testGb.h5";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -85,7 +84,7 @@ public class TestH5Gbasic {
@Test(expected = NullPointerException.class)
public void testH5Gcreate_null() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
// it should fail because the group name is null
gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT,
@@ -102,7 +101,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gcreate() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(H5fid, "/testH5Gcreate",
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
@@ -145,7 +144,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gcreate_anon() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
@@ -161,7 +160,7 @@ public class TestH5Gbasic {
@Test(expected = NullPointerException.class)
public void testH5Gopen_null() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT);
@@ -175,7 +174,7 @@ public class TestH5Gbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Gopen_not_exists() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
@@ -209,7 +208,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gget_create_plist() {
- long pid = -1;
+ long pid = HDF5Constants.H5I_INVALID_HID;
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index af210ca..388d2ac 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -31,15 +30,15 @@ import org.junit.rules.TestName;
public class TestH5Giterate {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterate.hdf";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final long _openGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- gid = -1;
+ gid = HDF5Constants.H5I_INVALID_HID;
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java
index bc4d65c..a28fc3d 100644
--- a/java/test/TestH5Lbasic.java
+++ b/java/test/TestH5Lbasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -35,7 +34,7 @@ import org.junit.rules.TestName;
public class TestH5Lbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterateL1.hdf";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
public void openH5file()
diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java
index de29c1e..44af2e5 100644
--- a/java/test/TestH5Lcreate.java
+++ b/java/test/TestH5Lcreate.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -41,13 +40,13 @@ public class TestH5Lcreate {
private static final String H5_FILE = "testL.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
- long H5fcpl = -1;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did1 = -1;
- long H5did2 = -1;
- long H5gcpl = -1;
- long H5gid = -1;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -64,7 +63,7 @@ public class TestH5Lcreate {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -80,7 +79,7 @@ public class TestH5Lcreate {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java
index 2ce1eca..30ee242 100644
--- a/java/test/TestH5Lparams.java
+++ b/java/test/TestH5Lparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java
index 89474c4..350b7aa 100644
--- a/java/test/TestH5Obasic.java
+++ b/java/test/TestH5Obasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -41,7 +40,7 @@ public class TestH5Obasic {
private static final String H5_FILE = "h5ex_g_iterateO1.hdf";
private static H5O_token_t H5la_ds1 = null;
private static H5O_token_t H5la_l1 = null;
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
public void openH5file()
@@ -69,7 +68,7 @@ public class TestH5Obasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Oopen_not_exists() throws Throwable {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
@@ -78,7 +77,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_dataset() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
@@ -96,7 +95,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_hardlink() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -113,7 +112,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_group() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
@@ -130,7 +129,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_datatype() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
@@ -234,7 +233,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_by_idx_n0() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -260,7 +259,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_by_idx_n3() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -286,7 +285,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_dataset() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
@@ -306,7 +305,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_hardlink() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
@@ -326,7 +325,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_group() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
@@ -346,7 +345,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_datatype() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
try {
@@ -376,10 +375,10 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_name_dataset() {
- H5O_native_info_t native_info = null;
+ H5O_native_info_t native_info = null;
try {
- native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -393,10 +392,10 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_name_hardlink() {
- H5O_native_info_t native_info = null;
+ H5O_native_info_t native_info = null;
try {
- native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -410,10 +409,10 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_name_group() {
- H5O_native_info_t native_info = null;
+ H5O_native_info_t native_info = null;
try {
- native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -427,10 +426,10 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_name_datatype() {
- H5O_native_info_t native_info = null;
+ H5O_native_info_t native_info = null;
try {
- native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -464,7 +463,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_idx_n0() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
H5O_hdr_info_t ohdr;
H5_ih_info_t oinfo;
@@ -486,7 +485,7 @@ public class TestH5Obasic {
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -503,7 +502,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_native_info_by_idx_n3() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_native_info_t native_info = null;
H5O_hdr_info_t ohdr;
H5_ih_info_t oinfo;
@@ -525,7 +524,7 @@ public class TestH5Obasic {
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -630,7 +629,7 @@ public class TestH5Obasic {
@Test
public void testH5Oopen_by_token() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
@@ -668,7 +667,7 @@ public class TestH5Obasic {
@Test
public void testH5Oopen_by_idx_n0() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
@@ -706,7 +705,7 @@ public class TestH5Obasic {
@Test
public void testH5Oopen_by_idx_n3() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java
index 4888e76..b3b1acd 100644
--- a/java/test/TestH5Ocopy.java
+++ b/java/test/TestH5Ocopy.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -36,13 +35,13 @@ public class TestH5Ocopy {
private static final String FILENAME = "testRefsattribute.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did1 = -1;
- long H5did2 = -1;
- long H5gcpl = -1;
- long H5gid = -1;
- long H5dsid2 = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
long[] dims = { 2 };
private final void _deleteFile(String filename) {
@@ -59,7 +58,7 @@ public class TestH5Ocopy {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -75,7 +74,7 @@ public class TestH5Ocopy {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
@@ -136,10 +135,10 @@ public class TestH5Ocopy {
@Test
public void testH5OcopyRefsAttr() {
- long ocp_plist_id = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
byte rbuf0[]=null , rbuf1[] = null;
byte[] dset_data = new byte[16];
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
@@ -184,9 +183,9 @@ public class TestH5Ocopy {
public void testH5OcopyRefsDatasettodiffFile() {
byte rbuf1[] = null;
byte[] dset_data = new byte[16];
- long ocp_plist_id = -1;
- long dataset_id = -1;
- long H5fid2 = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
try {
rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
@@ -244,9 +243,9 @@ public class TestH5Ocopy {
public void testH5OcopyRefsDatasettosameFile() {
byte rbuf0[]=null , rbuf1[] = null;
byte[] dset_data = new byte[16];
- long ocp_plist_id = -1;
- long dataset_id = -1;
- long did = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
int obj_type = -1;
byte[] read_data = new byte[16];
@@ -328,9 +327,9 @@ public class TestH5Ocopy {
// @Test(expected = HDF5LibraryException.class)
// public void testH5OcopyInvalidRef() throws Throwable {
// final long _pid_ = HDF5Constants.H5P_DEFAULT;
-// long sid = -1;
-// long did = -1;
-// long aid = -1;
+// long sid = HDF5Constants.H5I_INVALID_HID;
+// long did = HDF5Constants.H5I_INVALID_HID;
+// long aid = HDF5Constants.H5I_INVALID_HID;
//
// try {
// sid = H5.H5Screate_simple(1, new long[] {1}, null);
diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java
index 959e990..78ea744 100644
--- a/java/test/TestH5Ocreate.java
+++ b/java/test/TestH5Ocreate.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -41,13 +40,13 @@ public class TestH5Ocreate {
private static final String H5_FILE = "testO.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
- long H5fcpl = -1;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did1 = -1;
- long H5did2 = -1;
- long H5gcpl = -1;
- long H5gid = -1;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -64,7 +63,7 @@ public class TestH5Ocreate {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -80,7 +79,7 @@ public class TestH5Ocreate {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
@@ -293,7 +292,7 @@ public class TestH5Ocreate {
@Test
public void testH5Olink() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
H5O_info_t dst_obj_info = null;
try {
@@ -380,7 +379,7 @@ public class TestH5Ocreate {
@Test
public void testH5Ocomment() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -405,7 +404,7 @@ public class TestH5Ocreate {
@Test
public void testH5Ocomment_clear() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -506,7 +505,7 @@ public class TestH5Ocreate {
@Test
public void testH5Oinc_dec_count() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java
index 1ad31cb..5cbabe1 100644
--- a/java/test/TestH5Oparams.java
+++ b/java/test/TestH5Oparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index 786c330..3879128 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -41,20 +40,20 @@ public class TestH5P {
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
long[] H5dims = { DIM_X, DIM_Y };
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
- long lapl_id = -1;
- long fapl_id = -1;
- long fcpl_id = -1;
- long ocpl_id = -1;
- long ocp_plist_id = -1;
- long lcpl_id = -1;
- long plapl_id = -1;
- long plist_id = -1;
- long gapl_id = -1;
- long gcpl_id = -1;
- long acpl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long lcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long gapl_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long acpl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -65,7 +64,7 @@ public class TestH5P {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java
index 82864cd..8b04629 100644
--- a/java/test/TestH5PData.java
+++ b/java/test/TestH5PData.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -37,10 +36,10 @@ public class TestH5PData {
private static final String H5_FILE = "testPD.h5";
private static final int DIM_X = 12;
private static final int DIM_Y = 18;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
- long plist_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
double windchillF[][] =
{{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0},
@@ -66,7 +65,7 @@ public class TestH5PData {
}
private final long _createFloatDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java
index 98665dc..d44cc0b 100644
--- a/java/test/TestH5PL.java
+++ b/java/test/TestH5PL.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -147,11 +146,11 @@ public class TestH5PL {
@Ignore
public void TestH5PLdlopen() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long fapl_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
try {
int[] cd_values = {9, 0, 0, 0};
int[] libversion = {0, 0, 0};
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index d5d0901..cc674e2 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -47,17 +46,17 @@ public class TestH5Pfapl {
private static final int DIM_Y = 6;
private static final int DIMF_X = 12;
private static final int DIMF_Y = 18;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
- long H5Fdsid = -1;
- long H5Fdid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdsid = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdid = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
- long fapl_id = -1;
- long plapl_id = -1;
- long dapl_id = -1;
- long plist_id = -1;
- long btplist_id = -1;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
long[] H5Fdims = { DIMF_X, DIMF_Y };
double windchillF[][] =
{{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0},
@@ -130,7 +129,7 @@ public class TestH5Pfapl {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -385,7 +384,7 @@ public class TestH5Pfapl {
@Test
public void testH5Pget_elink_fapl() {
- long ret_val_id = -1;
+ long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
assertTrue("H5Pget_elink_fapl", ret_val_id >= 0);
@@ -403,7 +402,7 @@ public class TestH5Pfapl {
@Test
public void testH5P_elink_fapl() {
- long ret_val_id = -1;
+ long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
@@ -421,7 +420,7 @@ public class TestH5Pfapl {
@Test
public void testH5P_elink_file_cache_size() {
- long elink_fapl_id = -1;
+ long elink_fapl_id = HDF5Constants.H5I_INVALID_HID;
int efc_size = 0;
try {
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java
index 398a4d4..d922666 100644
--- a/java/test/TestH5Pfaplhdfs.java
+++ b/java/test/TestH5Pfaplhdfs.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -34,11 +33,11 @@ import org.junit.rules.TestName;
public class TestH5Pfaplhdfs {
@Rule public TestName testname = new TestName();
- long fapl_id = -1;
- long plapl_id = -1;
- long dapl_id = -1;
- long plist_id = -1;
- long btplist_id = -1;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createFileAccess() throws NullPointerException, HDF5Exception
diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java
index a55856c..dda2716 100644
--- a/java/test/TestH5Pfapls3.java
+++ b/java/test/TestH5Pfapls3.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -34,11 +33,11 @@ import org.junit.rules.TestName;
public class TestH5Pfapls3 {
@Rule public TestName testname = new TestName();
- long fapl_id = -1;
- long plapl_id = -1;
- long dapl_id = -1;
- long plist_id = -1;
- long btplist_id = -1;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createFileAccess() throws NullPointerException, HDF5Exception
diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java
index 7c43693..0d53071 100644
--- a/java/test/TestH5Plist.java
+++ b/java/test/TestH5Plist.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -85,7 +84,7 @@ public class TestH5Plist {
PROP3_NAME,
PROP4_NAME};
- long plist_class_id = -1;
+ long plist_class_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createPropClass()throws NullPointerException, HDF5Exception
@@ -114,9 +113,9 @@ public class TestH5Plist {
@Test
public void testH5P_genprop_basic_class() {
int status = -1;
- long cid1 = -1; // Generic Property class ID
- long cid2 = -1; // Generic Property class ID
- long cid3 = -1; // Generic Property class ID
+ long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
String name = null; // Name of class
try {
@@ -162,7 +161,7 @@ public class TestH5Plist {
// Close parent class
try {
H5.H5Pclose_class(cid2);
- cid2 = -1;
+ cid2 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -172,7 +171,7 @@ public class TestH5Plist {
// Close class
try {
H5.H5Pclose_class(plist_class_id);
- plist_class_id = -1;
+ plist_class_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -242,7 +241,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid3);
- cid3 = -1;
+ cid3 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -252,7 +251,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid2);
- cid2 = -1;
+ cid2 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -262,7 +261,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid1);
- cid1 = -1;
+ cid1 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -634,7 +633,7 @@ public class TestH5Plist {
@Test
public void testH5P_genprop_basic_list_prop() {
boolean status = false;
- long lid1 = -1; // Generic Property list ID
+ long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
long nprops = -1; // Number of properties in class
try {
@@ -760,7 +759,7 @@ public class TestH5Plist {
// @Test
// public void testH5P_genprop_class_callback() {
// class cdata {
-// public long cls_id = -1;
+// public long cls_id = HDF5Constants.H5I_INVALID_HID;
// public int cls_count = -1;
// cdata(long id, int count) {
// this.cls_id = id;
@@ -813,11 +812,11 @@ public class TestH5Plist {
// }
// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback();
//
-// long cid1 = -1; // Generic Property class ID
-// long cid2 = -1; // Generic Property class ID
-// long lid1 = -1; // Generic Property list ID
-// long lid2 = -1; // Generic Property list ID
-// long lid3 = -1; // Generic Property list ID
+// long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+// long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+// long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+// long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+// long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
// long nprops = -1; // Number of properties in class
//
// try {
diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java
index 4c9a763..0478356 100644
--- a/java/test/TestH5Pvirtual.java
+++ b/java/test/TestH5Pvirtual.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -52,13 +51,13 @@ public class TestH5Pvirtual {
private static final int fill_value = -1;
long[] H5dims = { DIM_Y };
long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y };
- long H5fid = -1;
- long H5dsid = -1;
- long H5dssid = -1;
- long H5dvsid = -1;
- long H5did = -1;
- long H5dcplid = -1;
- long H5dapl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dssid = HDF5Constants.H5I_INVALID_HID;
+ long H5dvsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dapl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -69,8 +68,8 @@ public class TestH5Pvirtual {
}
private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) {
- long did = -1;
- long space_id = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
long[] start = {0, 0};
long[] stride = null;
long[] count = {1, 1};
@@ -100,9 +99,9 @@ public class TestH5Pvirtual {
int[] dset_data = new int[DIM_Y];
// Create source files and datasets
for (int i=0; i < 3; i++) {
- long space_id = -1;
- long dset_id = -1;
- long file_id = -1;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
+ long dset_id = HDF5Constants.H5I_INVALID_HID;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1;
try {
@@ -265,7 +264,7 @@ public class TestH5Pvirtual {
@Test
public void testH5Pget_selection_source_dataset() throws Throwable {
- long src_space = -1;
+ long src_space = HDF5Constants.H5I_INVALID_HID;
long src_selection = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java
index a51c7b6..031b8e4 100644
--- a/java/test/TestH5R.java
+++ b/java/test/TestH5R.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -39,11 +38,11 @@ public class TestH5R {
private static final String H5_FILE = "testH5R.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
- long H5gid = -1;
- long H5did2 = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
int FILLVAL = 99;
@@ -62,7 +61,7 @@ public class TestH5R {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -78,7 +77,7 @@ public class TestH5R {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -150,109 +149,6 @@ public class TestH5R {
System.out.println();
}
- // 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); }
- */
// Test v1.12 APIs params
@Test
diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java
new file mode 100644
index 0000000..e306d7a
--- /dev/null
+++ b/java/test/TestH5Rref.java
@@ -0,0 +1,562 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Rref {
+ @Rule public TestName testname = new TestName();
+ private static final String H5_DREG_FILE = "trefer_reg.h5";
+ private static final String H5_AREG_FILE = "trefer_attr.h5";
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+
+ private boolean byteArrayCheck(final byte[] array) {
+ for (byte b : array) {
+ if (b != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void openH5file(String filename, String dsetname) {
+ try {
+ H5fid = H5.H5Fopen(filename,
+ HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5R._openH5file: " + err);
+ }
+ assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ",H5dsid > 0);
+ }
+
+ @After
+ public void closeH5file() throws HDF5LibraryException {
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5dsid > 0)
+ try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ H5fid = HDF5Constants.H5I_INVALID_HID;
+ H5dsid = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
+ System.out.println();
+ }
+
+ @Before
+ public void verifyCount()
+ throws NullPointerException, HDF5Exception {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ }
+
+ // Test v1.12 APIs params
+
+ @Test
+ public void testH5Rget_object() {
+ int ref_type = HDF5Constants.H5R_OBJECT1;
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String name = "";
+ String objName = "/DS_NA";
+
+ try {
+ openH5file(H5_DREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_object: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE")==0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: " + err);
+ }
+ finally {
+ try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ }
+ try {
+ ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Dread: " + err);
+ }
+
+ for (int i = 0; i < ndims; i++) {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ assertTrue("testH5Rget_object: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ if (!byteArrayCheck(refbuf[i])) {
+ try {
+ obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT);
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+ }
+ catch (Throwable err2) {
+ err2.printStackTrace();
+ fail("testH5Rget_object: H5.H5Rget_obj_type3: " + err2);
+ }
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ }
+ }
+
+ @Test
+ public void testH5Rget_obj_type3() {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_DATASET_REGION2;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String objName = "/Dataset1";
+
+ try {
+ openH5file(H5_DREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_obj_type3: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_obj_type3: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: " + err);
+ }
+ finally {
+ try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ }
+ try {
+ ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Dread: " + err);
+ }
+
+ for (int i = 0; i < ndims; i++) {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ assertTrue("testH5Rget_obj_type3: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ if (!byteArrayCheck(refbuf[i])) {
+ try {
+ obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT);
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+ }
+ catch (Throwable err2) {
+ err2.printStackTrace();
+ fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err2);
+ }
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ }
+ }
+
+ @Test
+ public void testH5Rget_region_dataset() {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ long loc_id = HDF5Constants.H5I_INVALID_HID;
+ long loc_sid = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_DATASET_REGION2;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String name = "";
+ String objName = "/Dataset1";
+
+ try {
+ openH5file(H5_DREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_region_dataset: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err);
+ }
+ finally {
+ try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ }
+ try {
+ ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Dread: " + err);
+ }
+ for (int i = 0; i < ndims; i++) {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ try {
+ loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_id >= 0);
+ boolean regionzero = byteArrayCheck(refbuf[i]);
+ if (i > 1)
+ assertTrue(regionzero);
+ else {
+ try {
+ loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_sid >= 0);
+ int region_type = -1;
+ try {
+ int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid);
+ region_type = H5.H5Sget_select_type(loc_sid);
+ if (i == 1)
+ assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS);
+ else
+ assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS);
+ if (region_type == HDF5Constants.H5S_SEL_POINTS) {
+ long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid);
+ // Coordinates for get point selection
+ long getcoord[] = new long[reg_ndims * (int)reg_npoints];
+ // Known coordinates for point selection
+ long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2},
+ {0,4},{9,0},{7,1},{3,3}};
+ try {
+ H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]);
+ assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]);
+ }
+ catch (Throwable err3) {
+ err3.printStackTrace();
+ fail("H5.H5Sget_select_elem_pointlist: " + err3);
+ }
+ }
+ else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) {
+ long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid);
+ assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1);
+ // Coordinates for get block selection
+ long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2];
+ long start[] = {2,2};
+ long block[] = {8,8};
+ try {
+ H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]);
+ assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]);
+ }
+ catch (Throwable err3) {
+ err3.printStackTrace();
+ fail("H5.H5Sget_select_hyper_blocklist: " + err3);
+ }
+ }
+ }
+ catch (Throwable err2) {
+ err2.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Sget_select_type: " + err2);
+ }
+ }
+ catch (Throwable err1) {
+ err1.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err1);
+ }
+ finally {
+ try {H5.H5Sclose(loc_sid);} catch (Exception ex) {}
+ }
+ }
+ }
+ catch (Throwable err0) {
+ err0.printStackTrace();
+ fail("testH5Rget_region_dataset: " + err0);
+ }
+ finally {
+ try {H5.H5Dclose(loc_id);} catch (Exception ex) {}
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_dataset: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ } //for (int i = 0; i < ndims; i++)
+ }
+
+ @Test
+ public void testH5Rget_region_attribute() {
+ long f_type = HDF5Constants.H5I_INVALID_HID;
+ long loc_id = HDF5Constants.H5I_INVALID_HID;
+ long loc_sid = HDF5Constants.H5I_INVALID_HID;
+ int ref_type = HDF5Constants.H5R_ATTR;
+ int obj_type = -1;
+ int ndims = 1;
+ long ret_val = -1;
+ byte[][] refbuf = null;
+ String objName = "/Dataset3";
+
+ try {
+ openH5file(H5_AREG_FILE, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: openH5file: " + err);
+ }
+ try {
+ f_type = H5.H5Dget_type(H5did);
+ int result = H5.H5Tget_class(f_type);
+ assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0);
+ String class_name = H5.H5Tget_class_name(result);
+ assertTrue("testH5Rget_region_attribute: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: " + err);
+ }
+ finally {
+ try {H5.H5Tclose(f_type);} catch (Exception ex) {}
+ }
+ try {
+ ndims = H5.H5Sget_simple_extent_ndims(H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err);
+ }
+ refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE];
+ // Read the reference from the dataset.
+ try {
+ H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, refbuf);
+ }
+ catch (Exception err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Dread: " + err);
+ }
+
+ for (int i = 0; i < ndims; i++) {
+ try {
+ ret_val = H5.H5Rget_type(refbuf[i]);
+ assertTrue("testH5Rget_region_attribute: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type);
+ try {
+ loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ assertTrue(loc_id >= 0);
+ if (!byteArrayCheck(refbuf[i])) {
+ try {
+ loc_sid = H5.H5Aget_space(loc_id);
+ assertTrue(loc_sid >= 0);
+ }
+ catch (Throwable err1) {
+ err1.printStackTrace();
+ fail("testH5Rget_region_attribute: " + err1);
+ }
+ finally {
+ try {H5.H5Sclose(loc_sid);} catch (Exception ex) {}
+ }
+ }
+ }
+ catch (Throwable err0) {
+ err0.printStackTrace();
+ fail("testH5Rget_region_attribute: " + err0);
+ }
+ finally {
+ try {H5.H5Aclose(loc_id);} catch (Exception ex) {}
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_region_attribute: H5Rget_type: " + err);
+ }
+ finally {
+ H5.H5Rdestroy(refbuf[i]);
+ }
+ }
+ }
+
+
+// These tests need to be updated with new APIs
+// @Test//
+// public void testH5Rget_group() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// 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) {}
+// }
+// }
+
+// @Test//
+// public void testH5Rget_attr() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// 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) {}
+// }
+// }
+
+}
diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java
index 03943a4..7eeed7a 100644
--- a/java/test/TestH5S.java
+++ b/java/test/TestH5S.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -30,7 +29,7 @@ import org.junit.rules.TestName;
public class TestH5S {
@Rule public TestName testname = new TestName();
- long H5sid = -1;
+ long H5sid = HDF5Constants.H5I_INVALID_HID;
int H5rank = 2;
long H5dims[] = {5, 5};
long H5maxdims[] = {10, 10};
@@ -181,7 +180,7 @@ public class TestH5S {
@Test
public void testH5Scopy() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int read_rank = -1;
try {
@@ -201,7 +200,7 @@ public class TestH5S {
@Test
public void testH5Sextent_copy() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
@@ -222,7 +221,7 @@ public class TestH5S {
@Test
public void testH5Sextent_equal() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
boolean result = false;
try {
@@ -252,8 +251,8 @@ public class TestH5S {
@Test
public void testH5Sencode_decode_null_dataspace() {
- long sid = -1;
- long decoded_sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] null_sbuf = null;
boolean result = false;
@@ -299,8 +298,8 @@ public class TestH5S {
@Test
public void testH5Sencode_decode_scalar_dataspace() {
- long sid = -1;
- long decoded_sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] scalar_sbuf = null;
boolean result = false;
int iresult = -1;
@@ -470,7 +469,7 @@ public class TestH5S {
@Test
public void testH5Sget_select_hyper() {
- long space1 = -1;
+ long space1 = HDF5Constants.H5I_INVALID_HID;
long start[] = {0,0};
long stride[] = {1,1};
long count[] = {1,1};
@@ -508,7 +507,7 @@ public class TestH5S {
@Test
public void testH5Sget_select_valid() {
- long space1 = -1;
+ long space1 = HDF5Constants.H5I_INVALID_HID;
long start[] = {1,0};
long stride[] = {1,1};
long count[] = {2,3};
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index e6698c6..548ac95 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -56,7 +55,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_scalar() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SCALAR);
@@ -75,7 +74,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_null() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
@@ -125,7 +124,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 2;
long dims[] = {5, 5};
@@ -148,7 +147,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_unlimted() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 2;
long dims[] = {5, 5};
@@ -171,7 +170,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_unlimted_1d() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 1;
long dims[] = {5};
@@ -194,7 +193,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_max_default() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int rank = 2;
long dims[] = {5, 5};
@@ -213,7 +212,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_extent() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int rank = 2;
long dims[] = {5, 5};
long maxdims[] = {10, 10};
@@ -270,7 +269,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_adjust_rank_offset() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long offset[][] = {{0,1},{2,4},{5,6}};
try {
@@ -292,7 +291,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_intersect_block_rank_start() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = new long[2];
long end[] = null;
@@ -308,7 +307,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_intersect_block_rank_end() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = null;
long end[] = new long[2];
@@ -336,7 +335,7 @@ public class TestH5Sbasic {
@Test(expected = NullPointerException.class)
public void testH5Scombine_hyperslab_null_start() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = null;
long stride[] = null;
long count[] = new long[2];
@@ -354,7 +353,7 @@ public class TestH5Sbasic {
@Test(expected = NullPointerException.class)
public void testH5Scombine_hyperslab_null_count() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = new long[2];
long stride[] = null;
long count[] = null;
diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java
index 18b5985..c882f8e 100644
--- a/java/test/TestH5T.java
+++ b/java/test/TestH5T.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -33,8 +32,8 @@ import org.junit.rules.TestName;
public class TestH5T {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testT.h5";
- long H5fid = -1;
- long H5strdid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = null;
@@ -129,7 +128,7 @@ public class TestH5T {
@Test
public void testH5Tarray_create() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
long[] adims = { 3, 5 };
try {
@@ -148,7 +147,7 @@ public class TestH5T {
@Test
public void testH5Tget_array_ndims() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
int ndims = 0;
long[] adims = { 3, 5 };
@@ -176,7 +175,7 @@ public class TestH5T {
@Test
public void testH5Tget_array_dims() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
int ndims = 0;
long[] adims = { 3, 5 };
long[] rdims = new long[2];
@@ -207,7 +206,7 @@ public class TestH5T {
@Test
public void testH5Tenum_functions() {
- long filetype_id =-1;
+ long filetype_id =HDF5Constants.H5I_INVALID_HID;
String enum_type ="Enum_type";
byte[] enum_val = new byte[1];
String enum_name = null;
@@ -275,7 +274,7 @@ public class TestH5T {
@Test
public void testH5Tenum_create_functions() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
byte[] enum_val = new byte[1];
// Create a enumerate datatype
@@ -315,7 +314,7 @@ public class TestH5T {
@Test
public void testH5Topaque_functions() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
String opaque_name = null;
// Create a opaque datatype
@@ -345,7 +344,7 @@ public class TestH5T {
@Test
public void testH5Tvlen_create() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
try {
filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1);
@@ -368,7 +367,7 @@ public class TestH5T {
@Test
public void testH5Tis_variable_str() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
try {
filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
@@ -399,7 +398,7 @@ public class TestH5T {
@Test
public void testH5Tcompound_functions() {
- long filetype_id =-1;
+ long filetype_id =HDF5Constants.H5I_INVALID_HID;
// Create a compound datatype
try {
diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java
index 6dbc6e3..7aac2ab 100644
--- a/java/test/TestH5Tbasic.java
+++ b/java/test/TestH5Tbasic.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -40,7 +39,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tcopy() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -57,7 +56,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tequal() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -76,7 +75,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tequal_not() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -98,8 +97,8 @@ public class TestH5Tbasic {
String[] strs = {"a1234","b1234"};
int srcLen = 5;
int dstLen = 10;
- long srcId = -1;
- long dstId = -1;
+ long srcId = HDF5Constants.H5I_INVALID_HID;
+ long dstId = HDF5Constants.H5I_INVALID_HID;
int dimSize = strs.length;
byte[] buf = new byte[dimSize*dstLen];
@@ -131,7 +130,7 @@ public class TestH5Tbasic {
@Test
public void testH5Torder_size() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
// Fixed length string
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java
index 4180de5..92a034c 100644
--- a/java/test/TestH5Tparams.java
+++ b/java/test/TestH5Tparams.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java
index 554c1f7..4253d20 100644
--- a/java/test/TestH5VL.java
+++ b/java/test/TestH5VL.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
@@ -72,28 +71,28 @@ public class TestH5VL {
@Test
public void testH5VLget_connector_id() {
- String H5_FILE = "testFvl.h5";
+ String H5_FILE = "testFvl.h5";
long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
- try {
- long native_id = H5.H5VLget_connector_id(H5fid);
- assertTrue("H5.H5VLget_connector_id", native_id >= 0);
-
- /*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector. Only check for the native connector
- * if this isn't set.
- */
- String connector = System.getenv("HDF5_VOL_CONNECTOR");
- if (connector == null)
- assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5VLget_connector_id " + err);
- }
+ try {
+ long native_id = H5.H5VLget_connector_id(H5fid);
+ assertTrue("H5.H5VLget_connector_id", native_id >= 0);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_id " + err);
+ }
finally {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -139,14 +138,14 @@ public class TestH5VL {
try {
String native_name = H5.H5VLget_connector_name(H5fid);
- /*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector. Only check for the native connector
- * if this isn't set.
- */
- String connector = System.getenv("HDF5_VOL_CONNECTOR");
- if (connector == null)
- assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java
index 696642b..fde8f1a 100644
--- a/java/test/TestH5Z.java
+++ b/java/test/TestH5Z.java
@@ -1,6 +1,5 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 2eabdf0..81ce13b 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -1,7 +1,6 @@
#! /bin/sh
#
# Copyright by The HDF Group.
-# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
@@ -46,6 +45,8 @@ HDFLIB_HOME="$top_srcdir/java/lib"
BLDDIR="."
BLDLIBDIR="$BLDDIR/testlibs"
HDFTEST_HOME="$top_srcdir/java/test"
+TOOLS_TESTFILES="$top_srcdir/tools/testfiles"
+
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
TESTJARFILE=jar@PACKAGE_TARNAME@test.jar
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
@@ -93,6 +94,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5R.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Rref.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5P.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt
$HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt
@@ -146,7 +148,7 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
- if [ "$IS_DARWIN" = "yes" ]; then
+ if [ "$IS_DARWIN" = "yes" ]; then
(cd testlibs; \
install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \
exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \
@@ -248,6 +250,8 @@ COPY_DATAFILES_TO_BLDDIR()
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf
+ $CP -f $TOOLS_TESTFILES/trefer_reg.h5 $BLDDIR/trefer_reg.h5
+ $CP -f $TOOLS_TESTFILES/trefer_attr.h5 $BLDDIR/trefer_attr.h5
}
CLEAN_DATAFILES_AND_BLDDIR()
@@ -768,6 +772,27 @@ else
test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /'
fi
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref"
+TESTING JUnit-TestH5Rref
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Rref > JUnit-TestH5Rref.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Rref.ext > JUnit-TestH5Rref.out
+
+if diff JUnit-TestH5Rref.out JUnit-TestH5Rref.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Rref"
+else
+ echo "**FAILED** JUnit-TestH5Rref"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Rref.txt JUnit-TestH5Rref.out |sed 's/^/ /'
+fi
+
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P"
TESTING JUnit-TestH5P
($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext)
diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt
index 4bab633..59765d9 100644
--- a/java/test/testfiles/JUnit-TestH5.txt
+++ b/java/test/testfiles/JUnit-TestH5.txt
@@ -3,8 +3,10 @@ JUnit version 4.11
.testJ2C
.testH5export_dataset
.testIsSerializable
+.testH5export_attrdataset
.testH5garbage_collect
.testH5error_off
+.testH5export_regdataset
.serializeToDisk
.testH5open
.testH5check_version
@@ -13,5 +15,5 @@ JUnit version 4.11
Time: XXXX
-OK (11 tests)
+OK (13 tests)
diff --git a/java/test/testfiles/JUnit-TestH5Rref.txt b/java/test/testfiles/JUnit-TestH5Rref.txt
new file mode 100644
index 0000000..05019c0
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Rref.txt
@@ -0,0 +1,10 @@
+JUnit version 4.11
+.testH5Rget_region_dataset
+.testH5Rget_object
+.testH5Rget_region_attribute
+.testH5Rget_obj_type3
+
+Time: XXXX
+
+OK (4 tests)
+