Skip to content

Commit

Permalink
keep improving tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 11, 2024
1 parent 2d73d25 commit 57adf29
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/integration-test/java/TestRunEveryFramework.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
Expand All @@ -14,6 +15,8 @@
import java.util.Map;
import java.util.stream.Collectors;

import javax.swing.JOptionPane;

import org.junit.Test;

import io.bioimage.modelrunner.bioimageio.BioimageioRepo;
Expand Down Expand Up @@ -62,18 +65,18 @@ public class TestRunEveryFramework {
FIJI_URL.put(PlatformDetection.OS_LINUX, "https://downloads.imagej.net/fiji/latest/fiji-linux64.zip");
FIJI_URL.put(PlatformDetection.OS_OSX, "https://downloads.imagej.net/fiji/latest/fiji-macosx.zip");
}

@Test
public void checkTestResults() {

}

@BeforeAll
public void setUp() throws InterruptedException, IOException, ModelSpecsException {
downloadAndTrackFiji();
installEngines();
installModels();
compileAndCopyToPlugins();
runModels();
}

private void compileAndCopyToPlugins() {
// TODO method that executes mvn build in subprocess and copies jar to fiji plugins folder
createMacros();
}

private static void downloadAndTrackFiji() throws InterruptedException, IOException {
Expand Down Expand Up @@ -132,14 +135,16 @@ private void installModels() throws IOException, InterruptedException {
}
}

private void runModels() throws FileNotFoundException, ModelSpecsException, IOException {
private void createMacros() throws FileNotFoundException, ModelSpecsException, IOException {
for (String mm : modelPaths) {
ModelDescriptor model = ModelDescriptorFactory.readFromLocalFile(mm + File.separator + Constants.RDF_FNAME);
String modelPath = model.getModelPath();
String samplePath = modelPath + File.separator + model.getInputTensors().get(0).getSampleTensorName();
String macro = String.format(MACRO_FORMAT, modelPath, samplePath, modelPath);
String runModelCommand = "command that runs macros in headless mode";
new ProcessBuilder().command(runModelCommand).start();
try (FileWriter writer = new FileWriter(selectedFile)) {
writer.write(macro);
writer.close();
}
}
}

Expand Down

0 comments on commit 57adf29

Please sign in to comment.