summaryrefslogtreecommitdiffstats
path: root/java/test/TestH5VL.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/test/TestH5VL.java')
-rw-r--r--java/test/TestH5VL.java70
1 files changed, 47 insertions, 23 deletions
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java
index 4253d20..99505ae 100644
--- a/java/test/TestH5VL.java
+++ b/java/test/TestH5VL.java
@@ -16,12 +16,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
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.HDF5LibraryException;
-import java.io.File;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -29,28 +30,37 @@ import org.junit.Test;
import org.junit.rules.TestName;
public class TestH5VL {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
- private final void _deleteFile(String filename) {
+ private final void _deleteFile(String filename)
+ {
File file = new File(filename);
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {
+ file.delete();
+ }
+ catch (SecurityException e) {
+ }
}
}
@Before
- public void checkOpenIDs() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void checkOpenIDs()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test
- public void testH5VLnative_init() {
+ public void testH5VLnative_init()
+ {
try {
boolean is_registered;
@@ -70,11 +80,12 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_id() {
+ public void testH5VLget_connector_id()
+ {
String H5_FILE = "testFvl.h5";
- long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ 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);
@@ -95,14 +106,19 @@ public class TestH5VL {
}
finally {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
}
}
@Test
- public void testH5VLget_connector_id_by_name() {
+ public void testH5VLget_connector_id_by_name()
+ {
try {
long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME);
assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0);
@@ -115,7 +131,8 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_id_by_value() {
+ public void testH5VLget_connector_id_by_value()
+ {
try {
long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE);
assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0);
@@ -128,11 +145,12 @@ public class TestH5VL {
}
@Test
- public void testH5VLget_connector_name() {
+ public void testH5VLget_connector_name()
+ {
String H5_FILE = "testFvl.h5";
- long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
try {
@@ -145,7 +163,8 @@ public class TestH5VL {
*/
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);
+ assertTrue("H5.H5VLget_connector_name H5VL_NATIVE",
+ native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME) == 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -153,20 +172,25 @@ public class TestH5VL {
}
finally {
if (H5fid > 0) {
- try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ try {
+ H5.H5Fclose(H5fid);
+ }
+ catch (Exception ex) {
+ }
}
_deleteFile(H5_FILE);
}
}
@Test(expected = HDF5LibraryException.class)
- public void testH5VLclose_NegativeID() throws Throwable {
+ public void testH5VLclose_NegativeID() throws Throwable
+ {
H5.H5VLclose(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5VLunregister_connector_NegativeID() throws Throwable {
+ public void testH5VLunregister_connector_NegativeID() throws Throwable
+ {
H5.H5VLunregister_connector(-1);
}
}
-