Skip to content

Commit

Permalink
wip/test: BdvMetadataIoTests temporarily don't clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Oct 4, 2024
1 parent 677aa02 commit 2bd2533
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.janelia.saalfeldlab.n5.bdv;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -26,7 +26,9 @@
import org.janelia.saalfeldlab.n5.universe.N5Factory;
import org.janelia.saalfeldlab.n5.universe.N5TreeNode;
import org.janelia.saalfeldlab.n5.universe.metadata.axes.AxisUtils;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import bdv.cache.SharedQueue;
Expand All @@ -49,10 +51,10 @@

public class BdvMetadataIoTests {

private File baseDir;
private static File baseDir;

@Before
public void before() {
@BeforeClass
public static void before() {

try {
baseDir = Files.createTempDirectory("n5-ij-tests-").toFile();
Expand All @@ -62,6 +64,12 @@ public void before() {
}
}

@AfterClass
public static void after() {

// baseDir.delete();
}

public <T extends NumericType<T> & NativeType<T>, V extends Volatile<T> & NumericType<V>> void readWriteParseTest(
final ImagePlus imp,
final String outputPath,
Expand All @@ -83,11 +91,16 @@ public <T extends NumericType<T> & NativeType<T>, V extends Volatile<T> & Numeri

try( final N5Writer n5 = new N5Factory().openWriter(outputPath) ) {

final N5DatasetDiscoverer datasetDiscoverer = new N5DatasetDiscoverer(n5, Executors.newSingleThreadExecutor(), (x) -> true,
final N5DatasetDiscoverer datasetDiscoverer = new N5DatasetDiscoverer(
n5,
Executors.newSingleThreadExecutor(),
(x) -> true,
Arrays.asList(N5ViewerCreator.n5vParsers),
Arrays.asList(N5ViewerCreator.n5vGroupParsers));

final N5TreeNode root = datasetDiscoverer.discoverAndParseRecursive("");
assertNotNull("root is null", root);

final Optional<N5TreeNode> metaOpt = root.getDescendant(readerDataset);
if (!metaOpt.isPresent())
fail("could not find metadata at: " + readerDataset);
Expand Down Expand Up @@ -135,7 +148,6 @@ public <T extends NumericType<T> & NativeType<T>, V extends Volatile<T> & Numeri
final List<Source<T>> srcList = sourcesAndConverters.stream().map(sac -> sac.getSpimSource()).collect(Collectors.toList());
assertTrue(String.format("%s data ", dataset), sourceDataIdentical(imp, srcList));
}
n5.remove();
}
}

Expand Down

0 comments on commit 2bd2533

Please sign in to comment.