X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fbin%2FCommandLineOperations.java;h=3ac86567ec24e6329b0ac3bc10bc11c34239b82c;hb=bd7b3138379c2db8507fe7e8d25f5a921e2d9df7;hp=2163a7a9ddc0e344b9378d55b926c0ae2c4fcc3f;hpb=b242acfd02dab9c625454c91c6cb1ac71a4bfe9f;p=jalview.git diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index 2163a7a..3ac8656 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -20,6 +20,8 @@ */ package jalview.bin; +import jalview.gui.JvOptionPane; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -28,13 +30,27 @@ import java.util.ArrayList; import org.testng.Assert; import org.testng.FileAssert; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ScanResult; + public class CommandLineOperations { - private static final int TEST_TIMEOUT = 4000; + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + + private static final int TEST_TIMEOUT = 9000; // Note longer timeout needed on + // full test run than on + // individual tests private static final int SETUP_TIMEOUT = 9000; @@ -42,7 +58,7 @@ public class CommandLineOperations private static final int MINFILESIZE_BIG = 4096; - private ArrayList successfulCMDs = new ArrayList(); + private ArrayList successfulCMDs = new ArrayList<>(); /*** * from @@ -100,13 +116,39 @@ public class CommandLineOperations } } + private static ClassGraph scanner = null; + + private static String classpath = null; + + public synchronized static String getClassPath() + { + if (scanner == null) + { + scanner = new ClassGraph(); + ScanResult scan = scanner.scan(); + classpath = scan.getClasspath(); + } + while (classpath == null) + { + try + { + Thread.sleep(10); + } catch (InterruptedException x) + { + + } + } + return classpath; + } private Worker jalviewDesktopRunner(boolean withAwt, String cmd, int timeout) { + // Note: JAL-3065 - don't include quotes for lib/* because the arguments are + // not expanded by the shell + String classpath = getClassPath(); String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "") - + " -Djava.ext.dirs=./lib -classpath ./classes jalview.bin.Jalview "; - System.out.println("CMD [" + cmd + "]"); + + " -classpath " + classpath + " jalview.bin.Jalview "; Process ls2_proc = null; Worker worker = null; try