fixing hdf5 tests to use local file

This commit is contained in:
Mark Wolters 2023-08-16 09:05:17 -04:00
parent 8943aea946
commit 5a9cf9dd58
4 changed files with 9 additions and 56 deletions

View File

@ -48,31 +48,15 @@
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.md</include>
<include>**/*.yaml</include>
<include>**/*.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>h5ex_t_float.h5</exclude>
</excludes>
</resource>
<resource>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<excludes>
<exclude>h5ex_t_float.h5</exclude>
</excludes>
</resource>
</resources>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
</project>

View File

@ -17,20 +17,12 @@
package io.nosqlbench.virtdata.library.hdf5.from_long.to_array;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import static com.datastax.oss.protocol.internal.ProtocolConstants.ErrorCode.READ_TIMEOUT;
public class HdfFileToArrayTest {
private static final int CONNECT_TIMEOUT = 100;
@Test
public void testHdfFileToVector() throws IOException {
public void testHdfFileToVector() {
final float[][] results = new float[][]{
{0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f},
{2.0f,1.6666666f,2.4f,3.2857144f,4.2222223f,5.181818f,6.1538463f},
@ -38,14 +30,8 @@ public class HdfFileToArrayTest {
{6.0f,3.0f,3.2f,3.857143f,4.6666665f,5.5454545f,6.4615383f}
};
FileUtils.copyURLToFile(
new URL("https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/h5ex_t_float.h5"),
new File("h5ex_t_float.h5"),
CONNECT_TIMEOUT,
READ_TIMEOUT);
HdfFileToVectorArray hdfFileToVector = new HdfFileToVectorArray(
"h5ex_t_float.h5",
"src/test/resources/h5ex_t_float.h5",
"/DS1");
float[] read;
@ -55,7 +41,5 @@ public class HdfFileToArrayTest {
assert (read[j] == results[i][j]);
}
}
new File("h5ex_t_float.h5").delete();
}
}

View File

@ -17,21 +17,14 @@
package io.nosqlbench.virtdata.library.hdf5.from_long.to_list;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import static com.datastax.oss.protocol.internal.ProtocolConstants.ErrorCode.READ_TIMEOUT;
public class HdfFileToVectorTest {
private static final int CONNECT_TIMEOUT = 100;
@Test
public void testHdfFileToVector() throws IOException {
public void testHdfFileToVector() {
final float[][] results = new float[][]{
{0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f},
{2.0f,1.6666666f,2.4f,3.2857144f,4.2222223f,5.181818f,6.1538463f},
@ -39,14 +32,8 @@ public class HdfFileToVectorTest {
{6.0f,3.0f,3.2f,3.857143f,4.6666665f,5.5454545f,6.4615383f}
};
FileUtils.copyURLToFile(
new URL("https://support.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/h5ex_t_float.h5"),
new File("h5ex_t_float.h5"),
CONNECT_TIMEOUT,
READ_TIMEOUT);
HdfFileToVectorList hdfFileToVector = new HdfFileToVectorList(
"h5ex_t_float.h5",
"src/test/resources/h5ex_t_float.h5",
"/DS1");
List<Float> read;
@ -56,7 +43,5 @@ public class HdfFileToVectorTest {
assert (read.get(j) == results[i][j]);
}
}
new File("h5ex_t_float.h5").delete();
}
}

Binary file not shown.