4 import java.io.IOException;
5 import java.lang.management.ManagementFactory;
7 import org.testng.annotations.BeforeTest;
8 import org.testng.annotations.Test;
10 import io.github.classgraph.ClassGraph;
12 public class CommandsTest
15 private static final int SETUP_TIMEOUT = 30000;
17 private static class Worker extends Thread
19 private final Process process;
23 private Worker(Process process)
25 this.process = process;
33 exit = process.waitFor();
34 } catch (InterruptedException ignore)
41 private static ClassGraph scanner = null;
43 private static String classpath = null;
45 private static String modules = null;
47 private static String java_exe = null;
49 public synchronized static String getClassPath()
51 java_exe = System.getProperty("java.home") + File.separator + "bin"
52 + File.separator + "java";
53 classpath = ManagementFactory.getRuntimeMXBean().getClassPath();
57 private Worker getJalviewDesktopRunner(boolean withAwt, String cmd,
60 // Note: JAL-3065 - don't include quotes for lib/* because the arguments are
61 // not expanded by the shell
62 String classpath = getClassPath();
63 String _cmd = java_exe + " "
64 + (withAwt ? "-Djava.awt.headless=true" : "") + " -classpath "
65 + classpath + " jalview.bin.Jalview ";
66 Process ls2_proc = null;
70 ls2_proc = Runtime.getRuntime().exec(_cmd + cmd);
71 } catch (Throwable e1)
77 worker = new Worker(ls2_proc);
82 } catch (InterruptedException e)
84 System.err.println("Thread interrupted");
90 @BeforeTest(alwaysRun = true)
91 public void initialize()
96 @Test(groups = "Functional")
97 public void setUpForHeadlessCommandsTest() throws IOException
99 String cmds = "--open=./examples/uniref50.fa";
100 Worker worker = getJalviewDesktopRunner(true, cmds, SETUP_TIMEOUT);