From dd51bebc2f9a7dd5a178bbf6f2cd9e726a74632a Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 14 Dec 2018 10:10:39 +0000 Subject: [PATCH] JAL-3130 single class testing on CLI with ant [ -Dclass.name=path/from/classpath/to/Test.class ], and 'fixed' some other tests [that I broke] --- build-j11.xml | 19 +++++++++ src/jalview/gui/AlignFrame.java | 9 ++-- test/jalview/bin/CommandLineOperations.java | 61 +++++++++++++++------------ 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/build-j11.xml b/build-j11.xml index d589cc3..6ed0b0f 100755 --- a/build-j11.xml +++ b/build-j11.xml @@ -338,6 +338,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 1433cd2..2b6d868 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1200,7 +1200,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int count = 20; for (int i = 0; i < count; i++) { - Thread.sleep(1000); + // Thread.sleep(1000); out.println("; TEST: " + (count - 1 - i)); } } @@ -2734,8 +2734,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (viewport.getViewName() == null) { - viewport.setViewName(MessageManager - .getString("label.view_name_original")); + viewport.setViewName( + MessageManager.getString("label.view_name_original")); } /* @@ -4483,7 +4483,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int assocfiles = 0; if (filesmatched.size() > 0) { - boolean autoAssociate = Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS", false); + boolean autoAssociate = Cache + .getDefault("AUTOASSOCIATE_PDBANDSEQS", false); if (!autoAssociate) { String msg = MessageManager.formatMessage( diff --git a/test/jalview/bin/CommandLineOperations.java b/test/jalview/bin/CommandLineOperations.java index 3ac8656..4017931 100644 --- a/test/jalview/bin/CommandLineOperations.java +++ b/test/jalview/bin/CommandLineOperations.java @@ -48,7 +48,8 @@ public class CommandLineOperations JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } - private static final int TEST_TIMEOUT = 9000; // Note longer timeout needed on + private static final int TEST_TIMEOUT = 9000; // Note longer timeout needed + // on // full test run than on // individual tests @@ -140,14 +141,14 @@ public class CommandLineOperations } 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" : "") + String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "") + " -classpath " + classpath + " jalview.bin.Jalview "; Process ls2_proc = null; Worker worker = null; @@ -233,7 +234,8 @@ public class CommandLineOperations } @Test( - groups = { "Functional" }, + groups = + { "Functional", "testben" }, dataProvider = "headlessModeOutputOperationsData") public void testHeadlessModeOutputOperations(String harg, String type, String fileName, boolean withAWT, int expectedMinFileSize, @@ -244,19 +246,20 @@ public class CommandLineOperations File file = new File(fileName); Worker worker = jalviewDesktopRunner(withAWT, cmd, timeout); - FileAssert.assertFile(file, "Didn't create an output" + type - + " file.[" + harg + "]"); - FileAssert.assertMinLength(new File(fileName), expectedMinFileSize); + FileAssert.assertFile(file, + "Didn't create an output" + type + " file.[" + harg + "]"); + // System.out.println( "File '" + file.getName() + "' has size " + + // file.length()); + // FileAssert.assertMinLength(new File(fileName), expectedMinFileSize); + FileAssert.assertMinLength(file, expectedMinFileSize); if (worker != null && worker.exit == null) { worker.interrupt(); Thread.currentThread().interrupt(); worker.process.destroy(); - Assert.fail("Jalview did not exit after " - + type + Assert.fail("Jalview did not exit after " + type + " generation (try running test again to verify - timeout at " - + SETUP_TIMEOUT + "ms). [" - + harg + "]"); + + timeout + "ms). [" + harg + "]"); } new File(fileName).delete(); } @@ -272,8 +275,7 @@ public class CommandLineOperations "Failed command : -props File" }, { "CMD [-sortbytree] executed successfully!", "Failed command : -sortbytree" }, - { - "CMD [-jabaws http://www.compbio.dundee.ac.uk/jabaws] executed successfully!", + { "CMD [-jabaws http://www.compbio.dundee.ac.uk/jabaws] executed successfully!", "Failed command : -jabaws http://www.compbio.dundee.ac.uk/jabaws" }, { "CMD [-open examples/uniref50.fa] executed successfully!", "Failed command : -open examples/uniref50.fa" }, @@ -281,14 +283,11 @@ public class CommandLineOperations "Failed command : -nosortbytree" }, { "CMD [-dasserver nickname=www.test.com] executed successfully!", "Failed command : -dasserver nickname=www.test.com" }, - { - "CMD [-features examples/testdata/plantfdx.features] executed successfully!", + { "CMD [-features examples/testdata/plantfdx.features] executed successfully!", "Failed command : -features examples/testdata/plantfdx.features" }, - { - "CMD [-annotations examples/testdata/plantfdx.annotations] executed successfully!", + { "CMD [-annotations examples/testdata/plantfdx.annotations] executed successfully!", "Failed command : -annotations examples/testdata/plantfdx.annotations" }, - { - "CMD [-tree examples/testdata/uniref50_test_tree] executed successfully!", + { "CMD [-tree examples/testdata/uniref50_test_tree] executed successfully!", "Failed command : -tree examples/testdata/uniref50_test_tree" }, // non headless mode input operations { "CMD [-nousagestats] executed successfully!", @@ -319,20 +318,28 @@ public class CommandLineOperations { "headless -open examples/uniref50.fa", " -html", "test_uniref50_out.html", true, MINFILESIZE_BIG, TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -fasta", - "test_uniref50_out.mfa", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.mfa", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -clustal", - "test_uniref50_out.aln", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.aln", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -msf", - "test_uniref50_out.msf", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.msf", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -pileup", - "test_uniref50_out.aln", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.aln", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -pir", - "test_uniref50_out.pir", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.pir", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -pfam", - "test_uniref50_out.pfam", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.pfam", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -blc", - "test_uniref50_out.blc", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, + "test_uniref50_out.blc", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, { "headless -open examples/uniref50.fa", " -jalview", - "test_uniref50_out.jvp", true, MINFILESIZE_SMALL, TEST_TIMEOUT }, }; + "test_uniref50_out.jvp", true, MINFILESIZE_SMALL, + TEST_TIMEOUT }, }; } } -- 1.7.10.2