+ String[] someUniref50Seqs = new String[] { "FER_CAPAA", "FER_CAPAN",
+ "FER1_MAIZE", "FER1_SPIOL", "O80429_MAIZE" };
+ String[] t1 = new String[] { "TEST1" };
+ String[] t2 = new String[] { "TEST2" };
+ String[] t3 = new String[] { "TEST3" };
+ return new Object[][] {
+ /*
+ */
+ { "--append=examples/uniref50.fa", true, 1, someUniref50Seqs },
+ { "--append examples/uniref50.fa", true, 1, someUniref50Seqs },
+ { "--append=examples/uniref50*.fa", true, 1, someUniref50Seqs },
+ // NOTE we cannot use shell expansion in tests, so list all files!
+ { "--append examples/uniref50.fa examples/uniref50_mz.fa", true, 1,
+ someUniref50Seqs },
+ { "--append=[new]examples/uniref50*.fa", true, 2,
+ someUniref50Seqs },
+ { "--open=examples/uniref50*.fa", true, 2, someUniref50Seqs },
+ { "examples/uniref50.fa", true, 1, someUniref50Seqs },
+ { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2,
+ ArrayUtils.concatArrays(someUniref50Seqs, t1) },
+ { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2, t1 },
+ { "--gui --argfile=" + testfiles + "/argfile0.txt", true, 1,
+ ArrayUtils.concatArrays(t1, t3) },
+ { "--gui --argfile=" + testfiles + "/argfile*.txt", true, 5,
+ ArrayUtils.concatArrays(t1, t2, t3) },
+ { "--gui --argfile=" + testfiles + "/argfile.autocounter", true, 3,
+ ArrayUtils.concatArrays(t1, t2) } };
+
+ }
+
+ public static boolean lookForSequenceName(String sequenceName)
+ {
+ AlignFrame[] afs = Desktop.getAlignFrames();
+ for (AlignFrame af : afs)
+ {
+ for (String name : af.getViewport().getAlignment().getSequenceNames())
+ {
+ if (sequenceName.equals(name))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static void cleanupFiles(String[] filenames)
+ {
+ for (String filename : filenames)
+ {
+ File file = new File(filename);
+ if (file.exists())
+ {
+ file.delete();
+ }
+ }
+ }
+
+ @Test(
+ groups = "Functional",
+ dataProvider = "allLinkedIdsData",
+ singleThreaded = true)
+ public void allLinkedIdsTest(String cmdLine, String[] filenames,
+ String[] nonfilenames)
+ {
+ String[] args = (cmdLine + " --gui").split("\\s+");
+ callJalviewMain(args);
+ Commands cmds = Jalview.getInstance().getCommands();
+ Assert.assertNotNull(cmds);
+ for (String filename : filenames)
+ {
+ Assert.assertTrue(new File(filename).exists(),
+ "File '" + filename + "' was not created");
+ }
+ cleanupFiles(filenames);
+ if (nonfilenames != null)
+ {
+ for (String nonfilename : nonfilenames)
+ {
+ File nonfile = new File(nonfilename);
+ Assert.assertFalse(nonfile.exists(),
+ "File " + nonfilename + " exists when it shouldn't!");
+ }
+ }
+ }
+
+ @DataProvider(name = "allLinkedIdsData")
+ public Object[][] allLinkedIdsData()
+ {
+ return new Object[][] {
+ //
+ /*
+ */
+ { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk", },
+ null },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.png",
+ "test/jalview/bin/argparser/testfiles/test2.png",
+ "test/jalview/bin/argparser/testfiles/test3.png", },
+ null },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --all --output={dirname}/{basename}.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
+ { "--gui --open=test/jalview/bin/argparser/**/*.fa --all --output={dirname}/{basename}.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
+ null },
+ { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
+ null },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --opened --output={dirname}/{basename}.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output open*.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.aln --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.aln",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.aln",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
+ "test/jalview/bin/argparser/testfiles/test1.aln",
+ "test/jalview/bin/argparser/testfiles/test2.aln",
+ "test/jalview/bin/argparser/testfiles/test3.aln",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
+ //
+ };