X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fbin%2FCommandLineOperations.java;h=9d8a99329a5a9219eb0cb2f9399887a549262ffe;hb=ddc73338c0a046369b53151e8b3ebfba4d385df7;hp=98e4eb54297ca74f2197b2e938ee834870bf3296;hpb=05efc2ac3c6427a4dabce842ebbd6f2ae17f49b9;p=jalview.git diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index 98e4eb5..9d8a993 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -20,12 +20,17 @@ */ package jalview.bin; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + import jalview.gui.JvOptionPane; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import org.testng.Assert; @@ -124,6 +129,8 @@ public class CommandLineOperations private static String modules = null; + private static String java_exe = null; + public synchronized static String getClassPath() { if (scanner == null) @@ -136,6 +143,9 @@ public class CommandLineOperations { modules.concat(mr.getName()); } + java_exe = System.getProperty("java.home") + File.separator + "bin" + + File.separator + "java"; + } while (classpath == null) { @@ -156,7 +166,8 @@ public class CommandLineOperations // 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" : "") + String _cmd = java_exe + " " + + (withAwt ? "-Djava.awt.headless=true" : "") + " -classpath " + classpath + (modules.length() > 2 ? "--add-modules=\"" + modules + "\"" : "") @@ -191,6 +202,20 @@ public class CommandLineOperations return worker; } + @Test(groups = { "Functional" }) + public void reportCurrentWorkingDirectory() + { + try + { + Path currentRelativePath = Paths.get(""); + String s = currentRelativePath.toAbsolutePath().toString(); + System.out.println("Test CWD is " + s); + } catch (Exception q) + { + q.printStackTrace(); + } + } + @BeforeTest(alwaysRun = true) public void initialize() { @@ -262,8 +287,7 @@ public class CommandLineOperations file.deleteOnExit(); Worker worker = getJalviewDesktopRunner(withAWT, cmd, timeout); assertNotNull(worker, "worker is null"); - String msg = "Didn't create an output" + type + " file at '" - + file.getAbsolutePath() + "'.[" + harg + "]"; + String msg = "Didn't create an output" + type + " file.[" + harg + "]"; assertTrue(file.exists(), msg); FileAssert.assertFile(file, msg); FileAssert.assertMinLength(file, expectedMinFileSize);