Delete JABAWS testing codes
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 24 Oct 2013 14:12:35 +0000 (15:12 +0100)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 24 Oct 2013 14:12:35 +0000 (15:12 +0100)
39 files changed:
testsrc/compbio/data/msa/CategoryTester.java [deleted file]
testsrc/compbio/data/sequence/ClustalAlignmentUtilTester.java [deleted file]
testsrc/compbio/data/sequence/FastaGeneratorManager.java [deleted file]
testsrc/compbio/data/sequence/FastaReaderTester.java [deleted file]
testsrc/compbio/data/sequence/FastaSequenceGenerator.java [deleted file]
testsrc/compbio/data/sequence/FastaSequenceGeneratorTester.java [deleted file]
testsrc/compbio/data/sequence/FastaSequenceTester.java [deleted file]
testsrc/compbio/data/sequence/SequenceUtilTester.java [deleted file]
testsrc/compbio/engine/EngineConfiguratorTester.java [deleted file]
testsrc/compbio/engine/FilePullerTester.java [deleted file]
testsrc/compbio/engine/LoadBalancerTester.java [deleted file]
testsrc/compbio/engine/PulledFileCacheTester.java [deleted file]
testsrc/compbio/engine/client/CommandBuilderTester.java [deleted file]
testsrc/compbio/engine/client/PathValidatorTester.java [deleted file]
testsrc/compbio/engine/cluster/drmaa/ClusterSessionTester.java [deleted file]
testsrc/compbio/engine/cluster/drmaa/DrmaaAsyncClusterEngineTester.java [deleted file]
testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java [deleted file]
testsrc/compbio/engine/cluster/drmaa/UtilTester.java [deleted file]
testsrc/compbio/engine/conf/DirectoryManagerTester.java [deleted file]
testsrc/compbio/engine/conf/PropertyHelperManagerTester.java [deleted file]
testsrc/compbio/engine/conf/RunnerConfigMarshallerTester.java [deleted file]
testsrc/compbio/engine/local/AsyncLocalRunnerTester.java [deleted file]
testsrc/compbio/engine/local/EngineResourcesLeakTester.java [deleted file]
testsrc/compbio/engine/local/LocalRunnerTester.java [deleted file]
testsrc/compbio/metadata/AllTestSuit.java [deleted file]
testsrc/compbio/metadata/OptionCombinatorTester.java [deleted file]
testsrc/compbio/metadata/OptionMarshallerTester.java [deleted file]
testsrc/compbio/metadata/PresetTester.java [deleted file]
testsrc/compbio/metadata/RunnerConfigTester.java [deleted file]
testsrc/compbio/stat/collector/ExecutionStatCollectorTester.java [deleted file]
testsrc/compbio/stat/collector/StatDBTester.java [deleted file]
testsrc/compbio/stat/collector/TestInputFilter.java [deleted file]
testsrc/compbio/stat/servlet/util/StatCollectionTester.java [deleted file]
testsrc/compbio/ws/client/AAConWSClientExample.java [deleted file]
testsrc/compbio/ws/client/TestAAConWS.java [deleted file]
testsrc/compbio/ws/client/TestIUPredWS.java [deleted file]
testsrc/compbio/ws/client/TestRNAalifoldWS.java [deleted file]
testsrc/compbio/ws/client/WSTesterTester.java [deleted file]
testsrc/compbio/ws/server/RegistryWSTester.java [deleted file]

diff --git a/testsrc/compbio/data/msa/CategoryTester.java b/testsrc/compbio/data/msa/CategoryTester.java
deleted file mode 100644 (file)
index 00a93f4..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-package compbio.data.msa;\r
-\r
-import java.net.ConnectException;\r
-import java.util.Set;\r
-\r
-import javax.xml.ws.WebServiceException;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.BeforeTest;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.ws.client.Jws2Client;\r
-import compbio.ws.client.Services;\r
-import compbio.ws.client.WSTesterTester;\r
-\r
-public class CategoryTester {\r
-\r
-       // test category membership from string constants\r
-       RegistryWS registry = null;\r
-\r
-       @BeforeTest(groups = AllTestSuit.test_group_webservices)\r
-       public void setupTest() {\r
-               try {\r
-                       /*\r
-                        * registry = Jws2Client .connectToRegistry(\r
-                        * "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jaba");\r
-                        */\r
-                       registry = Jws2Client.connectToRegistry(WSTesterTester.SERVER);\r
-\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-\r
-       /*\r
-        * This test will FAIL unless a connection to a running JABAWS web server is\r
-        * made!\r
-        */\r
-       @Test(groups = AllTestSuit.test_group_webservices)\r
-       public void categoryTest() {\r
-               Set<Category> servicecategories = registry.getServiceCategories();\r
-\r
-               boolean found = false;\r
-               for (Category svccategory : servicecategories) {\r
-\r
-                       Set<Services> catservices;\r
-\r
-                       for (String category : new String[]{Category.CATEGORY_ALIGNMENT,\r
-                                       Category.CATEGORY_CONSERVATION, Category.CATEGORY_DISORDER}) {\r
-                               if (category.equals(svccategory.name)) {\r
-                                       found = true;\r
-                                       catservices = svccategory.getServices();\r
-                                       System.out.println("Found " + catservices.size()\r
-                                                       + " services in category " + category\r
-                                                       + "(service category string " + svccategory + ")");\r
-                               }\r
-                       }\r
-               }\r
-               if (!found) {\r
-                       Assert.fail("Could not match any category to one of the given category constants");\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/data/sequence/ClustalAlignmentUtilTester.java b/testsrc/compbio/data/sequence/ClustalAlignmentUtilTester.java
deleted file mode 100644 (file)
index 812cd6f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.data.sequence;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileWriter;\r
-import java.io.IOException;\r
-import java.io.Writer;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class ClustalAlignmentUtilTester {\r
-\r
-       @Test()\r
-       public void testReadClustalFile() {\r
-               try {\r
-                       readWriteClustal("TO1381.aln");\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       static void readWriteClustal(String fname) throws IOException,\r
-                       UnknownFileFormatException {\r
-               FileInputStream fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
-                               + fname);\r
-               Alignment seqAl = ClustalAlignmentUtil.readClustalFile(fio);\r
-               assertTrue(seqAl != null);\r
-               assertTrue(seqAl.getSize() == 3);\r
-               assertNotNull(seqAl.getSequences());\r
-               assertEquals(3, seqAl.getSequences().size());\r
-\r
-               // Now try to write the alignment read\r
-               Writer os = new FileWriter(AllTestSuit.TEST_DATA_PATH + fname\r
-                               + ".written");\r
-               ClustalAlignmentUtil.writeClustalAlignment(os, seqAl);\r
-               fio.close();\r
-               os.close();\r
-\r
-               fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + fname\r
-                               + ".written");\r
-               Alignment readseqs = ClustalAlignmentUtil.readClustalFile(fio);\r
-               assertTrue(readseqs != null);\r
-               assertTrue(readseqs.getSize() == 3);\r
-               fio.close();\r
-       }\r
-\r
-       @Test()\r
-       public void testReadClustalFileShortNames() {\r
-               try {\r
-                       readWriteClustal("TO1381s.aln");\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test()\r
-       public void testReadClustalFileLongNames() {\r
-               try {\r
-                       readWriteClustal("TO1381L.aln");\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (Exception e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/data/sequence/FastaGeneratorManager.java b/testsrc/compbio/data/sequence/FastaGeneratorManager.java
deleted file mode 100644 (file)
index 9305d8b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.data.sequence;\r
-\r
-import java.io.IOException;\r
-import java.util.List;\r
-\r
-import compbio.util.FileUtil;\r
-\r
-public class FastaGeneratorManager {\r
-\r
-       public static void main(String[] args) throws IOException {\r
-               FastaSequenceGenerator fgen = new FastaSequenceGenerator(\r
-                               FastaSequenceGenerator.SeqType.PROTEIN, 50);\r
-\r
-               List<FastaSequence> fslist = fgen.generateFasta(400);\r
-               writeToFile(fslist, "SmallProtein.fasta");\r
-\r
-               fgen = new FastaSequenceGenerator(\r
-                               FastaSequenceGenerator.SeqType.PROTEIN, 200);\r
-\r
-               fslist = fgen.generateFasta(500);\r
-               writeToFile(fslist, "200x500Protein.fasta");\r
-\r
-               fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
-                               1000);\r
-               fslist = fgen.generateFasta(3000);\r
-               writeToFile(fslist, "1000x3000Dna.fasta");\r
-\r
-               fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
-                               50000);\r
-               fslist = fgen.generateFasta(300);\r
-               writeToFile(fslist, "50000x300Dna.fasta");\r
-               System.out.println("Done");\r
-       }\r
-\r
-       static void writeToFile(List<FastaSequence> fastalist, String filepath)\r
-                       throws IOException {\r
-               StringBuilder sb = new StringBuilder();\r
-               for (FastaSequence fs : fastalist) {\r
-                       sb.append(fs.getOnelineFasta() + "\n");\r
-               }\r
-               FileUtil.writeToFile(sb.toString(), filepath);\r
-       }\r
-}\r
diff --git a/testsrc/compbio/data/sequence/FastaReaderTester.java b/testsrc/compbio/data/sequence/FastaReaderTester.java
deleted file mode 100644 (file)
index 3a3b747..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-package compbio.data.sequence;\r
-\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class FastaReaderTester {\r
-\r
-       static FastaSequence s0 = new FastaSequence(\r
-                       "zedpshvyzg",\r
-                       "GCQDKNNIAELNEIMGTTRSPSDWQHMKGASPRAEIGLTGKKDSWWRHCCSKEFNKTPPPIHPDMKRWGWMWNRENFEKFLIDNFLNPPCPRLMLTKGTWWRHEDLCHEIFWSTLRWLCLGNQSFSAMIWGHLCECHRMIWWESNEHMFWLKFRRALKKMNSNGPCMGPDNREWMITNRMGKEFCGPAFAGDCQSCWRKCHKTNKICFNEKKGTPTKIDHEQKDIMDILKDIDNHRNWKQCQLWLLTSKSTDQESTTMLTWSTWRDFFIIIKQPFDHKCRGALDANGDFQIAAELKWPAPMIILRQNQKTMHDKSCHHFFTNRCPLMHTTRANDKQCSWHTRKQFICQQDFTTWQHRPDTHRILPSWCMSTRRKNHIKNTPALAFSTCEMGDLPNGWAPGTIILQRQFTQAIKLPQETTGWPRCDPKFDHWNMSKWLRQLLGRDDEMIPPQCD");\r
-\r
-       static FastaSequence s1 = new FastaSequence(\r
-                       "xovkactesa",\r
-                       "CPLSKWWNRRAFLSHTANHWMILMTWEGPHDGESKMRIAMMKWSPCKPTMSHFRCGLDAWAEPIRQIACESTFRM"\r
-                                       + "FCTTPRPIHKLTEMWGHMNGWTGAFCRQLECEWMMPPRHPHPCTSTFNNNKKRLIGQIPNEGKQLFINFQKPQHG"\r
-                                       + "FSESDIWIWKDNPTAWHEGLTIAGIGDGQHCWNWMPMPWSGAPTSNALIEFWTWLGMIGTRCKTQGMWWDAMNHH"\r
-                                       + "DQFELSANAHIAAHHMEKKMILKPDDRNLGDDTWMPPGKIWMRMFAKNTNACWPEGCRDDNEEDDCGTHNLHRMC");\r
-       static FastaSequence s2 = new FastaSequence(\r
-                       "ntazzewyvv",\r
-                       "CGCKIF D D NMKDNNRHG TDIKKHGFMH IRHPE KRDDC FDNHCIMPKHRRWGLWD"\r
-                                       + "EASINM       AQQWRSLPPSRIMKLNG       HGCDCMHSHMEAD   DTKQSGIKGTFWNG  HDAQWLCRWG"\r
-                                       + "EFITEA       WWGRWGAITFFHAH  ENKNEIQECSDQNLKE        SRTTCEIID   TCHLFTRHLDGW"\r
-                                       + " RCEKCQANATHMTW ACTKSCAEQW  FCAKELMMN    "\r
-                                       + "W        KQMGWRCKIFRKLFRDNCWID  FELPWWPICFCCKGLSTKSHSAHDGDQCRRW    WPDCARDWLGPGIRGEF   "\r
-                                       + "FCTHICQQLQRNFWCGCFRWNIEKRMFEIFDDNMAAHWKKCMHFKFLIRIHRHGPITMKMTWCRSGCCFGKTRRLPDSSFISAFLDPKHHRDGSGMMMWSSEMRSCAIPDPQQAWNQGKWIGQIKDWNICFAWPIRENQQCWATPHEMPSGFHFILEKWDALAHPHMHIRQKKCWAWAFLSLMSSTHSDMATFQWAIPGHNIWSNWDNIICGWPRI");\r
-       static FastaSequence s3 = new FastaSequence(" 12 d t y wi               k       jbke    ",\r
-                       "  KLSHHDCD" + "   N" + "    H" + "    HSKCTEPHCGNSHQML\n\rHRDP"\r
-                                       + "    CCDQCQSWEAENWCASMRKAILF");\r
-       static FastaSequence s4 = new FastaSequence(" 12 d t>y wi->foo          k       jbke    ",\r
-                       "  KLSHHDCD" + "   N" + "    H" + "    HSKCTEPHCGNSHQML\n\rHRDP"\r
-                                       + "    CCDQCQSWEAENWCASMRKAILF");\r
-       @Test()\r
-       public void test() {\r
-\r
-               List<FastaSequence> old_seqs = null;\r
-               final List<FastaSequence> list = new ArrayList<FastaSequence>();\r
-               try {\r
-                       old_seqs = SequenceUtil.readFasta(new FileInputStream(\r
-                                       AllTestSuit.TEST_DATA_PATH + "complicated.fasta"));\r
-                       final FastaReader fr = new FastaReader(AllTestSuit.TEST_DATA_PATH\r
-                                       + "complicated.fasta");\r
-\r
-                       while (fr.hasNext()) {\r
-                               final FastaSequence fs = fr.next();\r
-                               list.add(fs);\r
-                       }\r
-               } catch (final FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getLocalizedMessage());\r
-               } catch (final IOException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getLocalizedMessage());\r
-               }\r
-               System.out.println("OLD: " + old_seqs);\r
-               System.out.println("NEW: " + list);\r
-               Assert.assertEquals(old_seqs.size(), list.size());\r
-               Assert.assertEquals(old_seqs.get(0), list.get(0));\r
-               Assert.assertEquals(old_seqs.get(1), list.get(1));\r
-               // Assert.assertEquals(old_seqs.get(2), list.get(2));\r
-               // Assert.assertEquals(seqs.get(3), list.get(3));\r
-\r
-               Assert.assertEquals(FastaReaderTester.s0, list.get(0));\r
-               Assert.assertEquals(FastaReaderTester.s1, list.get(1));\r
-               Assert.assertEquals(FastaReaderTester.s2, list.get(2));\r
-               Assert.assertEquals(FastaReaderTester.s3, list.get(3));\r
-               Assert.assertEquals(FastaReaderTester.s4, list.get(4));\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/data/sequence/FastaSequenceGenerator.java b/testsrc/compbio/data/sequence/FastaSequenceGenerator.java
deleted file mode 100644 (file)
index c1aeb4e..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.data.sequence;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Random;\r
-\r
-public class FastaSequenceGenerator {\r
-\r
-       enum SeqType {\r
-               DNA, PROTEIN\r
-       }\r
-\r
-       enum ProteinAlphabet {\r
-               A, R, N, D, C, E, Q, G, H, I, L, K, M, F, P, S, T, W, V\r
-       };\r
-\r
-       enum DNAAlphabet {\r
-               C, T, G, A, U\r
-       };\r
-\r
-       enum Letters {\r
-               q, w, e, r, t, y, u, i, o, p, a, s, d, f, g, h, j, k, l, z, x, c, v, b, n, m\r
-       };\r
-\r
-       final SeqType seqtype;\r
-       final int seqNumber;\r
-       final Random rand;\r
-\r
-       /**\r
-        * \r
-        * @param type\r
-        *            of the sequence to be generated one of DNA or PROTEIN\r
-        * @param seqNumber\r
-        *            number of sequences to be generated\r
-        */\r
-       public FastaSequenceGenerator(SeqType type, int seqNumber) {\r
-               this.seqtype = type;\r
-               this.seqNumber = seqNumber;\r
-               this.rand = new Random();\r
-       }\r
-\r
-       /**\r
-        * Generate a list of Fasta formatted sequences with sequence length between\r
-        * 0.5 to 1 of maxLenght. Name of the sequence as well as the sequence is\r
-        * generated randomly\r
-        * \r
-        * @param maxSeqLength\r
-        *            maximum length of generated sequence\r
-        * @return\r
-        */\r
-       public List<FastaSequence> generateFasta(int maxSeqLength) {\r
-               List<FastaSequence> fastal = new ArrayList<FastaSequence>();\r
-               FastaSequence seq = null;\r
-               for (int i = 0; i < seqNumber; i++) {\r
-                       switch (this.seqtype) {\r
-                       case DNA:\r
-                               seq = new FastaSequence(generateName(), generateDna(\r
-                                               maxSeqLength, getRandomNumber(0.5, 0.99)));\r
-                               break;\r
-                       case PROTEIN:\r
-                               seq = new FastaSequence(generateName(), generateProtein(\r
-                                               maxSeqLength, getRandomNumber(0.5, 0.99)));\r
-                               break;\r
-                       default:\r
-                               throw new AssertionError("Cannot recognise a type!");\r
-                       }\r
-                       fastal.add(seq);\r
-               }\r
-               return fastal;\r
-       }\r
-\r
-       private String generateName() {\r
-               Letters[] letters = Letters.values();\r
-               int max = letters.length - 1;\r
-               StringBuilder sb = new StringBuilder();\r
-               for (int i = 0; i < 10; i++) {\r
-                       sb.append(letters[getRandomNumber(0, max)]);\r
-               }\r
-               return sb.toString();\r
-       }\r
-\r
-       private String generateProtein(int length, double variability) {\r
-               ProteinAlphabet[] proteinA = ProteinAlphabet.values();\r
-               int max = proteinA.length - 1;\r
-               StringBuilder sb = new StringBuilder();\r
-               for (int i = 0; i < length * variability; i++) {\r
-                       sb.append(proteinA[getRandomNumber(max)]);\r
-               }\r
-               return sb.toString();\r
-       }\r
-\r
-       private String generateDna(int length, double variability) {\r
-               if (variability == 0) {\r
-                       variability = 1;\r
-               }\r
-               DNAAlphabet[] dnaA = DNAAlphabet.values();\r
-               int max = dnaA.length - 1;\r
-               StringBuilder sb = new StringBuilder();\r
-               for (int i = 0; i < length * variability; i++) {\r
-                       sb.append(dnaA[getRandomNumber(max)]);\r
-               }\r
-               return sb.toString();\r
-       }\r
-\r
-       /*\r
-        * Returns random integers in range from 0 to max\r
-        * \r
-        * @param max\r
-        * \r
-        * @return\r
-        */\r
-       private int getRandomNumber(int max) {\r
-               return rand.nextInt(max);\r
-       }\r
-\r
-       /*\r
-        * Returns random integers with value in range from min to max\r
-        * \r
-        * @param min\r
-        * \r
-        * @param max\r
-        * \r
-        * @return\r
-        */\r
-       private int getRandomNumber(int min, int max) {\r
-               return new Long(Math.round((max - min) * rand.nextDouble() + min))\r
-                               .intValue();\r
-       }\r
-\r
-       private double getRandomNumber(double min, double max) {\r
-               return (max - min) * rand.nextDouble() + min;\r
-       }\r
-}\r
diff --git a/testsrc/compbio/data/sequence/FastaSequenceGeneratorTester.java b/testsrc/compbio/data/sequence/FastaSequenceGeneratorTester.java
deleted file mode 100644 (file)
index 374a052..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.data.sequence;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-\r
-import java.util.List;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-public class FastaSequenceGeneratorTester {\r
-\r
-       @Test()\r
-       public void testProteinSequenceGeneration() {\r
-               FastaSequenceGenerator fs = new FastaSequenceGenerator(\r
-                               FastaSequenceGenerator.SeqType.PROTEIN, 100);\r
-               assertEquals(100, fs.generateFasta(100).size());\r
-\r
-               fs = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA, 50);\r
-               List<FastaSequence> flist = fs.generateFasta(100);\r
-               assertEquals(50, flist.size());\r
-               for (FastaSequence s : flist) {\r
-                       assertTrue(s.getLength() >= 50);\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/data/sequence/FastaSequenceTester.java b/testsrc/compbio/data/sequence/FastaSequenceTester.java
deleted file mode 100644 (file)
index eaeac43..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.data.sequence;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-public class FastaSequenceTester {\r
-\r
-       @Test()\r
-       public void testGetFormattedFasta() {\r
-               FastaSequence fs = new FastaSequence(\r
-                               "test",\r
-                               "kjashf asjkdfhjkahsdfkadf fewyweyrfhjajfasdjkfkjhasdjkfaskhdfjhasdjkf "\r
-                                               + "hdflhdghuetirwhglhasdghfjkhdfs gdsfkjghsdjfgjhdsfglkhskdjfgjhjsdkfgkhsdjkfghsdkjfgh "\r
-                                               + "sdfjglkjhsdflkjg sdfgklhsdkfgdfkjghjkshgdflsdfgjkshdfghksdjfgkjhsdfgjkh");\r
-               assertEquals(219, fs.getSequence().length());\r
-               assertEquals(11, fs.getFormatedSequence(20).split("\n").length);\r
-               assertEquals(3, fs.getFormatedSequence(80).split("\n").length);\r
-               fs = new FastaSequence("test", "kjashf f ");\r
-               assertEquals(1, fs.getFormatedSequence(80).split("\n").length);\r
-               assertEquals(7, fs.getFormatedSequence(1).split("\n").length);\r
-       }\r
-}\r
diff --git a/testsrc/compbio/data/sequence/SequenceUtilTester.java b/testsrc/compbio/data/sequence/SequenceUtilTester.java
deleted file mode 100644 (file)
index 9468cda..0000000
+++ /dev/null
@@ -1,426 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- * Copyright (c) 2013 Alexander Sherstnev\r
- * \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) \r
- *  @version: 2.5\r
- * \r
- * This library is free software; you can redistribute it and/or modify it under \r
- * the terms of the Apache License version 2 as published\r
- * by the Apache Software Foundation This library is distributed in the hope\r
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * Apache License for more details. A copy of the license is in\r
- * apache_license.txt. It is also available here:\r
- * \r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt \r
- * \r
- * Any republication or derived work distributed in source code form must include \r
- * this copyright and license notice.\r
- */\r
-package compbio.data.sequence;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.PrintWriter;\r
-import java.util.HashMap;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class SequenceUtilTester {\r
-\r
-       @Test()\r
-       public void isNonAmbNucleotideSequence() {\r
-               String dnaseq = "atgatTGACGCTGCTGatgtcgtgagtgga";\r
-               assertTrue(SequenceUtil.isNonAmbNucleotideSequence(dnaseq));\r
-               String dirtyDnaseq = "atgAGTggt\taGGTgc\ncgcACTgc gACtcgcGAt cgA ";\r
-               assertTrue(SequenceUtil.isNonAmbNucleotideSequence(dirtyDnaseq));\r
-               String nonDna = "atgfctgatgcatgcatgatgctga";\r
-               assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
-\r
-               nonDna = "atgc1tgatgcatgcatgatgctga";\r
-               assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
-\r
-               nonDna = "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQL";\r
-               assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
-               // String ambDna = "AGTCRYMKSWHBVDN"; // see IUPAC Nucleotide Code\r
-               assertFalse(SequenceUtil.isNonAmbNucleotideSequence(nonDna));\r
-       }\r
-\r
-       @Test()\r
-       public void CleanSequence() {\r
-               String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
-               assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),SequenceUtil.cleanSequence(dirtySeq));\r
-       }\r
-\r
-       @Test()\r
-       public void DeepCleanSequence() {\r
-               String dirtySeq = "a!t?g.A;GTggt\ta12GGTgc\ncgc23AC\rTgc gAC<>.,?!|\\|/t@cg-c¬GA=_+(0){]}[:£$&^*\"t cgA ";\r
-               assertEquals("atgAGTggtaGGTgccgcACTgcgACtcgcGAtcgA".toUpperCase(),SequenceUtil.deepCleanSequence(dirtySeq));\r
-       }\r
-\r
-       @Test()\r
-       public void isProteinSequence() {\r
-               String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
-               assertFalse(SequenceUtil.isProteinSequence(dirtySeq));\r
-               String notaSeq = "atgc1tgatgcatgcatgatgctga";\r
-               assertFalse(SequenceUtil.isProteinSequence(notaSeq));\r
-               String AAseq = "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQL";\r
-               assertTrue(SequenceUtil.isProteinSequence(AAseq));\r
-               AAseq += "XU";\r
-               assertFalse(SequenceUtil.isProteinSequence(AAseq));\r
-\r
-       }\r
-\r
-       @Test()\r
-       public void CleanProteinSequence() {\r
-               String dirtySeq = "atgAGTggt\taGGTgc\ncgcAC\rTgc gACtcgcGAt cgA ";\r
-               assertFalse(SequenceUtil.isProteinSequence(dirtySeq));\r
-               // This will still be NON protein sequence despite having only correct\r
-               // letters because the letters match perfectly the nucleotide sequence!\r
-               assertFalse(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(dirtySeq)));\r
-\r
-               String notaSeq = "atgc1tgatgcatgcatgatgmctga";\r
-               assertFalse(SequenceUtil.isProteinSequence(notaSeq));\r
-               assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(notaSeq)));\r
-\r
-               String AAseq = "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQL";\r
-               assertTrue(SequenceUtil.isProteinSequence(AAseq));\r
-               assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(AAseq)));\r
-               AAseq += "XU";\r
-\r
-               assertFalse(SequenceUtil.isProteinSequence(AAseq));\r
-               assertTrue(SequenceUtil.isProteinSequence(SequenceUtil.cleanProteinSequence(AAseq)));\r
-       }\r
-\r
-       @Test()\r
-       public void ReadWriteFasta() {\r
-               try {\r
-                       FileInputStream fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta");\r
-                       assertNotNull(fio);\r
-                       List<FastaSequence> fseqs = SequenceUtil.readFasta(fio);\r
-                       assertNotNull(fseqs);\r
-                       assertEquals(3, fseqs.size());\r
-                       assertEquals(3, fseqs.size());\r
-                       fio.close();\r
-                       FileOutputStream fou = new FileOutputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta.written");\r
-                       SequenceUtil.writeFasta(fou, fseqs);\r
-                       fou.close();\r
-                       FileOutputStream fou20 = new FileOutputStream(AllTestSuit.TEST_DATA_PATH + "TO1381.fasta20.written");\r
-                       SequenceUtil.writeFasta(fou20, fseqs, 21);\r
-                       fou20.close();\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       // Potential Bug :- Sequence names are shortened to 2-3 letters\r
-       @Test\r
-       public void testReadFastaWriteClustal() {\r
-               \r
-               try {\r
-                       FileInputStream fio = new FileInputStream(\r
-                                       AllTestSuit.TEST_DATA_PATH + "TO1381.fasta");\r
-                       assertNotNull(fio);\r
-                       List<FastaSequence> fseqs = SequenceUtil.readFasta(fio);\r
-                       assertNotNull(fseqs);\r
-                       fio.close();\r
-                       \r
-                       char gapChar = '-';\r
-                       FileOutputStream fou = new FileOutputStream(\r
-                                       AllTestSuit.TEST_DATA_PATH + "TO1381.aln.written");\r
-                       SequenceUtil.writeClustal(fou, fseqs, gapChar);\r
-                       fou.close();\r
-                       \r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       /**\r
-        * This test tests the loading of horizontally formatted Jronn output file\r
-        */\r
-       @Test\r
-       public void LoadJronnFile() {\r
-\r
-               FileInputStream fio;\r
-               try {\r
-                       fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "jronn.out");\r
-                       Map<String, Score> aseqs = SequenceUtil.readJRonn(fio);\r
-                       assertNotNull(aseqs);\r
-                       assertEquals(aseqs.size(), 3);\r
-                       Score aseq = aseqs.get("Foobar");\r
-                       assertNotNull(aseq);\r
-                       assertNotNull(aseq.getScores());\r
-                       assertEquals(aseq.getScores().size(), aseq.getScores().size());\r
-                       fio.close();\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (UnknownFileFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       enum Trial {\r
-               one, two, three\r
-       };\r
-\r
-       /**\r
-        * This test tests the loading of horizontally formatted Jronn output file\r
-        * \r
-        * First seq\r
-        * \r
-        * M 0.86010 0.88512 0.37094\r
-        * \r
-        * T 0.79983 0.85864 0.44331\r
-        * \r
-        */\r
-       @SuppressWarnings("unchecked")\r
-       @Test\r
-       public void ReadDisemblResults() {\r
-               Map<String, Map<String,Set<Range>>> _ranges=new HashMap<String, Map<String,Set<Range>>>();\r
-               Map<String, Set<Range>> ranges=new HashMap<String,Set<Range>>();\r
-               Map<String,Map<String, Float>>  _values=new HashMap<String, Map<String,Float>>();\r
-               Map<String, Float> values = new HashMap<String, Float>();\r
-               Set<Range> rset;\r
-               rset = new HashSet<Range>();\r
-               for (String[] se:new String[][] { { "34","41"},{"50","58"},{"83","91"},{"118","127"},{" 160","169"},{" 191","220"},{" 243","252"},{" 287","343"},{" 350","391"},{" 429","485"},{" 497","506"},{"539","547"}}) {\r
-                       rset.add(new Range(se));\r
-               }\r
-               ranges.put(DisemblResult.COILS.toString(), rset);\r
-               values.put(DisemblResult.COILS.toString(), Float.valueOf(0.86010f));\r
-               rset = new HashSet<Range>();\r
-               for (String[] se:new String[][] { { "355","368"}}) {\r
-                       rset.add(new Range(se));\r
-               }\r
-               ranges.put(DisemblResult.REM465.toString(), rset);\r
-               values.put(DisemblResult.REM465.toString(), Float.valueOf(0.88512f));\r
-               rset = new HashSet<Range>();\r
-               for (String[] se:new String[][] { { "190","204"}}) {\r
-                       rset.add(new Range(se));\r
-               }\r
-               ranges.put(DisemblResult.HOTLOOPS.toString(), rset);\r
-               values.put(DisemblResult.HOTLOOPS.toString(), Float.valueOf(0.37094f));\r
-               _ranges.put("Foobar_dundeefriends", ranges);\r
-               _values.put("Foobar_dundeefriends", values);\r
-               FileInputStream fio;\r
-               try {\r
-                       fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "disembl.out");\r
-                       Map<String, Set<Score>> aseqs = SequenceUtil.readDisembl(fio);\r
-                       assertNotNull(aseqs);\r
-                       assertEquals(aseqs.size(), 3);\r
-                       ScoreManager sman = ScoreManager.newInstance(aseqs);\r
-\r
-                       for (String fs : aseqs.keySet()) {\r
-                               assertTrue(" Foobar_dundeefriends Foobar dundeefriends ".contains(fs));\r
-                               Set<Score> scores = aseqs.get(fs);\r
-                               assertEquals(scores.size(), 3);\r
-                               for (Score sc:scores) {\r
-                                       if (_ranges.containsKey(fs)) {\r
-                                               assertEquals("Checking range for Method "+sc.getMethod(),_ranges.get(fs).get(sc.getMethod()), sc.getRanges());\r
-                                               assertEquals("Checking first value for Method "+sc.getMethod(), _values.get(fs).get(sc.getMethod()), sc.getScores().get(0));\r
-                                       }\r
-                               }\r
-                       }\r
-                       fio.close();\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (UnknownFileFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       /**\r
-        * This method tests the loading of horizontally formatted Jronn output file\r
-        * \r
-        * First sequence:\r
-        * \r
-        * >Foobar_dundeefriends\r
-        * \r
-        * # GlobDoms 2-358, 373-568\r
-        * \r
-        * # Disorder 1-5, 206-218, 243-250, 288-300, 313-324, 359-372, 475-481\r
-        * \r
-        * # RESIDUE DYDX RAW SMOOTHED\r
-        * \r
-        * M 0.0044 -0.2259 -0.2259\r
-        * \r
-        * T -0.1308 -0.2170 -0.2170\r
-        * \r
-        * ............\r
-        * \r
-        * > Second sequence\r
-        */\r
-       @SuppressWarnings("unchecked")\r
-       @Test\r
-       public void ReadGlobPlotResults() {\r
-\r
-               FileInputStream fio;\r
-               try {\r
-                       fio = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "globplot.out");\r
-                       HashMap<String, Set<Score>> aseqs = SequenceUtil.readGlobPlot(fio);\r
-                       assertNotNull(aseqs);\r
-                       assertEquals(aseqs.size(), 3);\r
-\r
-                       String fsdf = null;\r
-                       Set<Score> scores = null;\r
-                       for (String fs : aseqs.keySet()) {\r
-                               if ("Foobar_dundeefriends".contains(fs)) {\r
-                                       fsdf = fs;\r
-                                       scores = aseqs.get(fs);\r
-                               }\r
-                               assertEquals(scores.size(), 5);\r
-                       }\r
-\r
-                       ScoreManager sm = ScoreManager.newInstanceSingleSequence(scores);\r
-                       sm.writeOut(new PrintWriter(System.out, true));\r
-\r
-                       for (Score score : scores) {\r
-                               if (score.getMethod().equals(GlobProtResult.Disorder.toString())) {\r
-                                       assertEquals(score.getRanges().size(), 7);\r
-                                       assertTrue(score.getScores().isEmpty());\r
-                               }\r
-                               if (GlobProtResult.valueOf(score.getMethod()) == GlobProtResult.Dydx) {\r
-                                       assertFalse(score.getScores().isEmpty());\r
-                                       assertTrue(score.getRanges().isEmpty());\r
-                               }\r
-                       }\r
-                       fio.close();\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (UnknownFileFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void ReadIUPredForShortAndLongDisorder() {\r
-               try {\r
-                       Map<String, Score> scores = SequenceUtil.readIUPred(new File(AllTestSuit.TEST_DATA_PATH, "out.long"));\r
-                       ScoreManager man = ScoreManager.newInstanceSingleScore(scores);\r
-                       assertNotNull(scores);\r
-                       assertEquals(3, scores.size());\r
-\r
-                       Score score = scores.get("Foobar_dundeefriends");\r
-                       assertNotNull(score);\r
-                       assertEquals(0, score.getRanges().size());\r
-                       assertEquals(568, score.getScores().size());\r
-                       assertEquals("Long", score.getMethod());\r
-\r
-                       score = scores.get("Foobar");\r
-                       assertNotNull(score);\r
-                       assertEquals(0, score.getRanges().size());\r
-                       assertEquals(481, score.getScores().size());\r
-                       assertEquals("Long", score.getMethod());\r
-\r
-                       score = scores.get("dundeefriends");\r
-                       assertNotNull(score);\r
-                       assertEquals(0, score.getRanges().size());\r
-                       assertEquals(513, score.getScores().size());\r
-                       assertEquals("Long", score.getMethod());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (UnknownFileFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void ReadIUPredForGlobDomain() {\r
-               try {\r
-                       Map<String, Score> scores = SequenceUtil.readIUPred(new File(AllTestSuit.TEST_DATA_PATH, "output.glob"));\r
-                       assertNotNull(scores);\r
-                       assertEquals(2, scores.size());\r
-                       ScoreManager man = ScoreManager.newInstanceSingleScore(scores);\r
-                       assertEquals(2, man.getNumberOfSeq());\r
-                       Score score = scores.get("P53_HUMA");\r
-                       assertNotNull(score);\r
-                       assertEquals(2, score.getRanges().size());\r
-                       assertEquals(0, score.getScores().size());\r
-                       assertEquals("Glob", score.getMethod());\r
-                       score = scores.get("Foobar_dundeefriends");\r
-                       assertEquals(0, score.getRanges().size());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (UnknownFileFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void ReadAAConResults() {\r
-               try {\r
-                       InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "aacon_results.txt");\r
-                       HashSet<Score> result = SequenceUtil.readAAConResults(inStream);\r
-                       inStream.close();\r
-                       assertNotNull(result);\r
-                       assertEquals(result.size(), 18);\r
-\r
-                       inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "aacon_result_single.out");\r
-                       result = SequenceUtil.readAAConResults(inStream);\r
-                       inStream.close();\r
-                       assertNotNull(result);\r
-                       assertEquals(result.size(), 1);\r
-                       assertEquals(result.iterator().next().getScores().size(), 568);\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-       @Test\r
-       public void ReadJpredResults() {\r
-               try {\r
-                       InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "Jpred.test1.out");\r
-                       List<FastaSequence> result = SequenceUtil.readJpredFile(inStream);\r
-                       inStream.close();\r
-                       assertNotNull(result);\r
-                       assertEquals(result.size(), 19);\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
-\r
diff --git a/testsrc/compbio/engine/EngineConfiguratorTester.java b/testsrc/compbio/engine/EngineConfiguratorTester.java
deleted file mode 100644 (file)
index 6a0d27d..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine;\r
-\r
-import static org.testng.Assert.fail;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.runner.msa.ClustalW;\r
-\r
-public class EngineConfiguratorTester {\r
-\r
-       @Test\r
-       public void testGetAsyncEngine() {\r
-\r
-               ClustalW clustal = new ClustalW();\r
-\r
-               try {\r
-                       SyncExecutor sEngine = Configurator.getSyncEngine(Configurator\r
-                                       .configureExecutable(clustal));\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void testGetSyncEngine() {\r
-               ClustalW clustal = new ClustalW();\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       AsyncExecutor aEngine = Configurator.getAsyncEngine(confClust);\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/FilePullerTester.java b/testsrc/compbio/engine/FilePullerTester.java
deleted file mode 100644 (file)
index 2ffb4c8..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.testng.annotations.BeforeTest;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.local.AsyncLocalRunner;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.ChunkHolder;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Muscle;\r
-\r
-public class FilePullerTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381.fasta";\r
-\r
-       String jobId;\r
-       String jobId2;\r
-       String jobId3;\r
-\r
-       @BeforeTest(alwaysRun = true)\r
-       public void init() {\r
-               ClustalW clustal = new ClustalW();\r
-               clustal.setInput(test_input);\r
-               Muscle ms = new Muscle().setInput(test_input);\r
-               Muscle ms2 = new Muscle().setInput(test_input);\r
-\r
-               try {\r
-                       // For local execution use relavive\r
-                       ConfiguredExecutable<ClustalW> confClustal = Configurator\r
-                                       .configureExecutable(clustal, Executable.ExecProvider.Local);\r
-                       ConfiguredExecutable<Muscle> confms = Configurator\r
-                                       .configureExecutable(ms, Executable.ExecProvider.Local);\r
-\r
-                       ConfiguredExecutable<Muscle> confms2 = Configurator\r
-                                       .configureExecutable(ms2, Executable.ExecProvider.Local);\r
-\r
-                       AsyncLocalRunner as = new AsyncLocalRunner();\r
-                       jobId = as.submitJob(confClustal);\r
-                       jobId2 = as.submitJob(confms);\r
-                       jobId3 = as.submitJob(confms2);\r
-\r
-                       ConfiguredExecutable<?> al = as.getResults(jobId);\r
-                       ConfiguredExecutable<?> al2 = as.getResults(jobId2);\r
-                       ConfiguredExecutable<?> al3 = as.getResults(jobId3);\r
-                       assertNotNull(al);\r
-                       assertNotNull(al2);\r
-                       assertNotNull(al3);\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine })\r
-       public void testPull() {\r
-               assertNotNull(jobId, "init() method failed!");\r
-               String workDir = Configurator.getWorkDirectory(jobId);\r
-               String statFile = workDir + File.separator + ClustalW.getStatFile();\r
-\r
-               ChunkHolder ch = ProgressGetter.pull(statFile, 0);\r
-               while (ch == null) {\r
-                       ch = ProgressGetter.pull(statFile, 0);\r
-               }\r
-               String chunk = "";\r
-               long pos = 0;\r
-               do {\r
-                       chunk = ch.getChunk();\r
-                       assertNotNull(chunk);\r
-                       pos = ch.getNextPosition();\r
-                       ch = ProgressGetter.pull(statFile, pos);\r
-               } while (chunk.length() > 0);\r
-\r
-               // All consequent pulls just return empty chunk and same position =\r
-               // file.length\r
-               ch = ProgressGetter.pull(statFile, pos);\r
-               assertNotNull(ch);\r
-               assertEquals(ch.getChunk().length(), 0);\r
-               // Output file size depends on the operation system fs!\r
-               // assertEquals(ch.getNextPosition(), 668);\r
-\r
-               ch = ProgressGetter.pull(statFile, pos);\r
-               assertNotNull(ch);\r
-               assertEquals(ch.getChunk().length(), 0);\r
-               // Output file size depends on the operation system and fs!\r
-               // assertEquals(ch.getNextPosition(), 668);\r
-\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine })\r
-       public void testGetDelay() {\r
-               FilePuller fp = FilePuller.newFilePuller(Configurator\r
-                               .getWorkDirectory(jobId)\r
-                               + File.separator + "stat.log", 256);\r
-               // default delay is 5 minutes\r
-               assertEquals(fp.getDelayValue(TimeUnit.SECONDS), 5 * 60);\r
-               long d = 1000 * 1000 * 1000L * 60; // 1m in nanoseconds\r
-               fp.setDelay(d, TimeUnit.NANOSECONDS);\r
-               assertEquals(fp.getDelayValue(TimeUnit.NANOSECONDS), d);\r
-               assertEquals(fp.getDelayValue(TimeUnit.SECONDS), 60);\r
-               assertEquals(fp.getDelayValue(TimeUnit.MINUTES), 1);\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine }, dependsOnMethods = { "testPull" })\r
-       public void testCache() {\r
-               assertNotNull(jobId, "init() method failed!");\r
-               assertNotNull(jobId2, "init() method failed!");\r
-               assertEquals(PulledFileCache.getSize(), 1); // One is from previous test\r
-\r
-               String statFile = Configurator.getWorkDirectory(jobId) + File.separator\r
-                               + ClustalW.getStatFile();\r
-               String statFile2 = Configurator.getWorkDirectory(jobId2)\r
-                               + File.separator + Muscle.getStatFile();\r
-               String statFile3 = Configurator.getWorkDirectory(jobId3)\r
-                               + File.separator + Muscle.getStatFile();\r
-\r
-               ChunkHolder ch = ProgressGetter.pull(statFile, 0);\r
-               assertEquals(PulledFileCache.getSize(), 1); // Still one as job has been\r
-               // retrieved from cache\r
-               ChunkHolder ch2 = ProgressGetter\r
-                               .pull(statFile2, 0, 5, TimeUnit.SECONDS); // 5\r
-               // second delay\r
-               assertEquals(PulledFileCache.getSize(), 2); // One is from previous test\r
-\r
-               // Pull the first job completely\r
-               while (ch == null) {\r
-                       ch = ProgressGetter.pull(statFile, 0);\r
-               }\r
-               String chunk = "";\r
-               long pos = 0;\r
-               do {\r
-                       chunk = ch.getChunk();\r
-                       assertNotNull(chunk);\r
-                       pos = ch.getNextPosition();\r
-                       ch = ProgressGetter.pull(statFile, pos);\r
-               } while (chunk.length() > 0);\r
-\r
-               try {\r
-                       Thread.sleep(1000 * 6);\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-               // Elements are removed on put operation only\r
-               assertEquals(PulledFileCache.getSize(), 2); // One is from previous test\r
-               ChunkHolder ch3 = ProgressGetter.pull(statFile3, 0);\r
-               // Now old element was removed, but new added, thus size remains\r
-               // constant\r
-               assertEquals(PulledFileCache.getSize(), 2); // One is from previous test\r
-\r
-       }\r
-\r
-       @Test\r
-       public void testGet() {\r
-\r
-               FilePuller pp = FilePuller\r
-                               .newProgressPuller(AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                                               + "percentProgress.txt");\r
-               try {\r
-                       assertEquals(pp.getProgress(), 12);\r
-                       pp.disconnect();\r
-               } catch (NumberFormatException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/LoadBalancerTester.java b/testsrc/compbio/engine/LoadBalancerTester.java
deleted file mode 100644 (file)
index f345720..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-package compbio.engine;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.util.List;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.SequenceUtil;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable.ExecProvider;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.PresetManager;\r
-import compbio.runner.msa.ClustalW;\r
-\r
-public class LoadBalancerTester {\r
-\r
-       @Test\r
-       public void testLoadBalance() {\r
-               /**\r
-                * This is 5 sequence x per 20000 length\r
-                */\r
-               String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                               + "testlimit.fasta";\r
-               try {\r
-                       FileInputStream fio = new FileInputStream(test_input);\r
-                       List<FastaSequence> data = SequenceUtil.readFasta(fio);\r
-                       fio.close();\r
-                       assertNotNull(data);\r
-                       assertTrue(data.size() > 0);\r
-\r
-                       ClustalW clustal = new ClustalW();\r
-                       /**\r
-                        * ClustalW local limit is 2 sequences per 500 letters\r
-                        */\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       ExecProvider aEngine = LoadBalancer.getEngine(confClust, data);\r
-                       Limit<ClustalW> locExec = new Limit<ClustalW>(2, 500, PresetManager.LOCAL_ENGINE_LIMIT_PRESET); \r
-                       // For testing of production configuration uncomment\r
-                       //Limit locExec = confClust\r
-                       //              .getLimit(PresetManager.LOCAL_ENGINE_LIMIT_PRESET);\r
-                       assertTrue(locExec.getSeqNumber() <= data.size()\r
-                                       || locExec.getAvgSeqLength() * locExec.getSeqNumber() <= Limit\r
-                                                       .getAvgSequenceLength(data));\r
-                       // Engine will be local because LoadBalancer accessed the presets & limits \r
-                       // directly\r
-                       // For testing of production configuration uncomment\r
-                       // assertEquals(aEngine, ExecProvider.Cluster);\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/PulledFileCacheTester.java b/testsrc/compbio/engine/PulledFileCacheTester.java
deleted file mode 100644 (file)
index 9201e73..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class PulledFileCacheTester {\r
-\r
-       @Test\r
-       public void test() {\r
-               try {\r
-                       FilePuller fp1 = FilePuller.newFilePuller(\r
-                                       AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "1", 256);\r
-                       fp1.setDelay(2, TimeUnit.SECONDS);\r
-\r
-                       FilePuller fp2 = FilePuller.newFilePuller(\r
-                                       AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "2", 256);\r
-                       fp2.setDelay(1, TimeUnit.SECONDS);\r
-\r
-                       FilePuller fp3 = FilePuller.newFilePuller(\r
-                                       AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "3", 256);\r
-                       fp3.setDelay(1, TimeUnit.SECONDS);\r
-\r
-                       FilePuller fp4 = FilePuller.newFilePuller(\r
-                                       AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "4", 256);\r
-                       fp4.setDelay(5, TimeUnit.SECONDS);\r
-\r
-                       // This only hold if tested in isolation thus clear is essential\r
-                       PulledFileCache.clear();\r
-                       assertEquals(PulledFileCache.getSize(), 0);\r
-                       PulledFileCache.put(fp1);\r
-                       PulledFileCache.put(fp2);\r
-                       PulledFileCache.put(fp3);\r
-                       PulledFileCache.put(fp4);\r
-                       assertEquals(PulledFileCache.getSize(), 4);\r
-                       Thread.sleep(1000);\r
-                       // sweep was not called yet\r
-                       assertEquals(PulledFileCache.getSize(), 4);\r
-                       // now sweep is called\r
-                       PulledFileCache.put(fp1);\r
-                       // fp1 and fp1 and fp4 only remains - copies are allowed this is\r
-                       // responsibility of the caller to ensure they are not there\r
-                       assertEquals(PulledFileCache.getSize(), 3);\r
-                       assertNotNull(PulledFileCache\r
-                                       .get(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "1"));\r
-                       assertNotNull(PulledFileCache\r
-                                       .get(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "4"));\r
-\r
-                       for (int i = 0; i < 4; i++) {\r
-                               Thread.sleep(1000);\r
-                               FilePuller fp = PulledFileCache\r
-                                               .get(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "4");\r
-                               // This will update access time\r
-                               fp.isFileCreated();\r
-                       }\r
-                       // still fp1 and fp4 only remains\r
-\r
-                       assertEquals(PulledFileCache.getSize(), 3);\r
-                       PulledFileCache.put(FilePuller.newFilePuller(\r
-                                       AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "5", 256));\r
-                       // at this point only fp4 and 5 will remain\r
-                       assertEquals(PulledFileCache.getSize(), 2);\r
-                       assertNotNull(PulledFileCache\r
-                                       .get(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "4"));\r
-                       assertNotNull(PulledFileCache\r
-                                       .get(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "5"));\r
-\r
-               } catch (InterruptedException e) {\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/client/CommandBuilderTester.java b/testsrc/compbio/engine/client/CommandBuilderTester.java
deleted file mode 100644 (file)
index 41b8354..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.client;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertNotSame;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Mafft;\r
-import compbio.runner.msa.Muscle;\r
-\r
-public class CommandBuilderTester {\r
-\r
-       @Test()\r
-       public void testCommandBuilding() {\r
-               CommandBuilder<ClustalW> builder = new CommandBuilder<ClustalW>("=");\r
-               builder.setParam("-MATRIX", "blosum65");\r
-               assertTrue(builder.getCommands().size() == 1);\r
-               String p = builder.getParamValue("-MATRIX");\r
-               builder.setParam("-clustalw");\r
-               builder.setParam("-in", "\\gile\\path\\abs.txt");\r
-               System.out.println(builder.getCommands());\r
-               assertTrue(builder.getCommands().size() == 3);\r
-               builder.setParam("-stat=/test.log");\r
-               assertTrue(builder.getCommands().size() == 4);\r
-               System.out.println("CP:" + builder.getCommands());\r
-               assertTrue(builder.setParam("-stat=/newtest.log"));\r
-\r
-               List<String> clist = Arrays.asList("-prop", "-tree=treefile.txt",\r
-                               "-clustalw");\r
-               builder.addParams(clist);\r
-               assertTrue(builder.size() == 6);\r
-               builder.setParams(clist);\r
-               assertTrue(builder.size() == 3);\r
-               System.out.println("CP:" + builder.getCommands());\r
-               String option = "-log=error.txt";\r
-               builder.setFirst(option);\r
-               assertEquals(builder.getCommands().get(0), option);\r
-               builder.setParam("-newParam2");\r
-               assertEquals(builder.getCommands().get(0), option);\r
-               builder.setLast(option);\r
-               assertNotSame(builder.getCommands().get(0), option);\r
-               assertEquals(builder.getCommands().get(builder.size() - 1), option);\r
-               builder.setParam("-newParam3");\r
-               assertEquals(builder.getCommands().get(builder.size() - 1), option);\r
-               builder.setParam("-prm5", "prm5Value");\r
-               assertTrue(builder.hasParam("-prm5"));\r
-       }\r
-\r
-       @Test\r
-       public void testSpaceDelimiterExecutable() {\r
-               CommandBuilder<Muscle> cbuilder = new CommandBuilder<Muscle>(" ");\r
-               cbuilder.addParams(Arrays.asList("-clwstrict", "-quiet", "-verbose",\r
-                               "-log", "EXEC_STAT_FILE"));\r
-       }\r
-\r
-       @Test\r
-       public void testOptionsToCommand() {\r
-               try {\r
-                       RunnerConfig<Mafft> rconf = ConfExecutable\r
-                                       .getRunnerOptions(Mafft.class);\r
-                       CommandBuilder<Mafft> cbuilder = CommandBuilder.newCommandBuilder(\r
-                                       rconf.getArguments(), Mafft.KEY_VALUE_SEPARATOR);\r
-                       String comm = "";\r
-                       for (String val : cbuilder.getCommands()) {\r
-                               assertFalse(val.contains(cbuilder.nameValueSeparator));\r
-                               comm += val + cbuilder.nameValueSeparator;\r
-                       }\r
-                       assertEquals(cbuilder.getCommandString(), comm);\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/client/PathValidatorTester.java b/testsrc/compbio/engine/client/PathValidatorTester.java
deleted file mode 100644 (file)
index f6867f7..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.client;\r
-\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-import java.net.URISyntaxException;\r
-import java.net.URL;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.client.PathValidator;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.SysPrefs;\r
-\r
-public class PathValidatorTester {\r
-\r
-       @Test\r
-       public void testIsAbsolutePath() {\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       /*\r
-                        * slash(\) has to be prefixed with another slash to produce a\r
-                        * single slash\r
-                        */\r
-                       assertTrue(PathValidator.isAbsolutePath("d:\\temp"));\r
-                       assertFalse(PathValidator.isAbsolutePath("/home"));\r
-               } else {\r
-                       assertFalse(PathValidator.isAbsolutePath("d:\\temp"));\r
-                       assertTrue(PathValidator.isAbsolutePath("/home"));\r
-               }\r
-               assertFalse(PathValidator.isAbsolutePath("home"));\r
-       }\r
-\r
-       @Test\r
-       public void testGetClassPath() {\r
-               String clname = ClustalW.class.getSimpleName();\r
-               System.out.println("%" + clname);\r
-               URL url = ClustalW.class.getResource(clname + ".class");\r
-               URL url2 = ClassLoader.getSystemResource("Engine.local.properties");\r
-\r
-               try {\r
-                       File f = new File(url.toURI());\r
-                       System.out.println("&" + f.getAbsolutePath());\r
-                       System.out.println("&" + f.getCanonicalPath());\r
-                       System.out.println("&" + f.getParent());\r
-               } catch (URISyntaxException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-               System.out.println("!!" + url2);\r
-               System.out.println("!" + url.getFile());\r
-               System.out.println("!" + System.getProperty("java.class.path", null));\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/cluster/drmaa/ClusterSessionTester.java b/testsrc/compbio/engine/cluster/drmaa/ClusterSessionTester.java
deleted file mode 100644 (file)
index d72337b..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.cluster.drmaa;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.Job;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.Util;\r
-\r
-public class ClusterSessionTester {\r
-\r
-       @Test(sequential = true, groups = { AllTestSuit.test_group_cluster,\r
-                       AllTestSuit.test_group_engine })\r
-       public void testTaskList() {\r
-               ClustalW cl = new ClustalW();\r
-\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> clw = Configurator\r
-                                       .configureExecutable(cl, Executable.ExecProvider.Cluster);\r
-                       ClusterRunner jr = ClusterRunner.getInstance(clw);\r
-                       String jobId = jr.submitJob();\r
-                       ClusterSession cs = ClusterSession.getInstance();\r
-                       // this only holds for sequential execution\r
-                       //assertEquals(cs.jobs.size(), 1);\r
-                       assertTrue(Job.getByTaskId(jobId, cs.jobs) != null);\r
-                       assertEquals(Job.getByTaskId(jobId, cs.jobs).getConfExecutable(),\r
-                                       clw);\r
-                       jr.cancelJob(jobId);\r
-                       // this only holds for sequential execution\r
-                       assertEquals(cs.jobs.size(), 0);\r
-\r
-                       clw = Configurator.configureExecutable(cl,\r
-                                       Executable.ExecProvider.Cluster);\r
-                       assertFalse(Util.isEmpty(clw.getWorkDirectory()));\r
-                       AsyncExecutor aengine = Configurator.getAsyncEngine(clw);\r
-                       jobId = aengine.submitJob(clw);\r
-                       assertEquals(cs.jobs.size(), 1);\r
-                       assertTrue(Job.getByTaskId(jobId, cs.jobs) != null);\r
-                       assertEquals(Job.getByTaskId(jobId, cs.jobs).getConfExecutable(),\r
-                                       clw);\r
-                       assertFalse(Util.isEmpty(compbio.engine.Configurator\r
-                                       .getWorkDirectory(jobId)));\r
-                       String workDir = clw.getWorkDirectory();\r
-                       assertEquals(workDir, compbio.engine.Configurator\r
-                                       .getWorkDirectory(jobId));\r
-\r
-                       aengine.getResults(jobId);\r
-                       assertEquals(cs.jobs.size(), 0);\r
-                       assertFalse(Util.isEmpty(clw.getWorkDirectory()));\r
-                       // after job has been removed from the list (e.g when completed)\r
-                       // reference to a work directory can still be obtained by other\r
-                       // means\r
-                       assertFalse(Util.isEmpty(compbio.engine.Configurator\r
-                                       .getWorkDirectory(jobId)));\r
-                       assertEquals(compbio.engine.Configurator.getWorkDirectory(jobId),\r
-                                       workDir);\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/cluster/drmaa/DrmaaAsyncClusterEngineTester.java b/testsrc/compbio/engine/cluster/drmaa/DrmaaAsyncClusterEngineTester.java
deleted file mode 100644 (file)
index 922aa90..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.cluster.drmaa;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.SysPrefs;\r
-\r
-public class DrmaaAsyncClusterEngineTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381.fasta";\r
-       public static String large_test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "1000x3000Dna.fasta";\r
-       public static String cluster_test_outfile = "TO1381.clustal.cluster.out";\r
-\r
-       /**\r
-        * This test uses ClustalW executable as runnable to testing, thus depends\r
-        * on its correct functioning\r
-        */\r
-       @Test(groups = { AllTestSuit.test_group_cluster,\r
-                       AllTestSuit.test_group_engine })\r
-       public void testSubmit() {\r
-               ClustalW clustal = new ClustalW();\r
-               assertFalse("Cluster execution can only be in unix environment",\r
-                               SysPrefs.isWindows);\r
-               clustal.setInput(test_input).setOutput(cluster_test_outfile);\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClustal = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       AsyncExecutor runner = new AsyncClusterRunner();\r
-                       assertNotNull("Runner is NULL", runner);\r
-                       String jobId = runner.submitJob(confClustal);\r
-                       assertEquals("Input was not set!", test_input, clustal.getInput());\r
-                       assertNotNull("JobId is null", jobId);\r
-                       JobStatus status = runner.getJobStatus(jobId);\r
-                       assertTrue("Status of the process is wrong!",\r
-                                       status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
-                       JobStatus info = runner.getJobStatus(jobId);\r
-                       assertNotNull("JobInfo is null", info);\r
-                       Executable<?> result = runner.getResults(jobId);\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = ResultNotAvailableException.class, groups = {\r
-                       AllTestSuit.test_group_cluster, AllTestSuit.test_group_engine })\r
-       // expectedExceptions = ResultNotAvailableException.class,\r
-       public void testCancel() throws ResultNotAvailableException {\r
-               ClustalW clustal = new ClustalW();\r
-               assertFalse("Cluster execution can only be in unix environment",\r
-                               SysPrefs.isWindows);\r
-               clustal.setInput(large_test_input).setOutput(cluster_test_outfile);\r
-\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClustal = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       AsyncClusterRunner runner = new AsyncClusterRunner();\r
-                       String jobId = runner.submitJob(confClustal);\r
-                       assertNotNull("Runner is NULL", runner);\r
-                       // assertNotNull("JobId is null", jobId1);\r
-                       Thread.sleep(200);\r
-                       JobStatus status = runner.getJobStatus(jobId);\r
-                       assertTrue("Status of the process is wrong!",\r
-                                       status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
-                       assertFalse("Status of the process is wrong!",\r
-                                       status == JobStatus.FINISHED);\r
-                       runner.cancelJob(jobId);\r
-                       // This is never NULL as long as the job has started!\r
-                       ConfiguredExecutable<?> exec = runner.getResults(jobId);\r
-                       assertNull(exec.getResults());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail("Interupted exception caught:" + e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_cluster,\r
-                       AllTestSuit.test_group_engine })\r
-       public void testGetJobStatus() {\r
-               ClustalW clustal = new ClustalW();\r
-               assertFalse("Cluster execution can only be in unix environment",\r
-                               SysPrefs.isWindows);\r
-               clustal.setInput(test_input).setOutput(cluster_test_outfile);\r
-\r
-               try {\r
-                       AsyncClusterRunner runner = new AsyncClusterRunner();\r
-                       ConfiguredExecutable<ClustalW> confClustal = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       String jobId = runner.submitJob(confClustal);\r
-                       assertNotNull("Runner is NULL", runner);\r
-                       AsyncClusterRunner runner2 = new AsyncClusterRunner();\r
-\r
-                       boolean hasRun = false;\r
-                       boolean hasPended = false;\r
-                       Thread.sleep(500); \r
-                       JobStatus status = runner2.getJobStatus(jobId);\r
-                       while (status != JobStatus.FINISHED) {\r
-                               if (status == JobStatus.CANCELLED) {\r
-                                       fail("Job is not cancelled!");\r
-                               }\r
-                               if (status == JobStatus.FAILED) {\r
-                                       fail("Job should not fail!");\r
-                               }\r
-                               if (status == JobStatus.RUNNING) {\r
-                                       hasRun = true;\r
-                               }\r
-                               if (status == JobStatus.PENDING) {\r
-                                       hasPended = true;\r
-                               }\r
-                               if (status == JobStatus.UNDEFINED) {\r
-                                       System.out.println("Wrong status (UNDEFINED) reported by cluster engine!");\r
-                                       break;\r
-                               }\r
-                               status = runner2.getJobStatus(jobId);\r
-                       }\r
-                       assertTrue(hasRun);\r
-                       assertTrue(hasPended);\r
-                       assertTrue(hasRun);\r
-                       // Bear in mind that if the task were not put in the queue\r
-                       // immediately\r
-                       // the status could be UNDEFINED!\r
-                       // assertFalse(hasUndefined);\r
-                       AsyncClusterRunner runner3 = new AsyncClusterRunner();\r
-                       Executable<?> exec = runner3.getResults(jobId);\r
-                       assertNotNull(exec);\r
-                       // Now try collecting result for the second time\r
-                       exec=null;\r
-                       Thread.sleep(1000);\r
-                       exec = runner3.getResults(jobId);\r
-                       assertNotNull(exec);\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java b/testsrc/compbio/engine/cluster/drmaa/DrmaaClusterEngineTester.java
deleted file mode 100644 (file)
index eb5ead2..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.cluster.drmaa;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.text.ParseException;\r
-\r
-import org.ggf.drmaa.DrmaaException;\r
-import org.ggf.drmaa.JobInfo;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.sequence.Alignment;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.EngineUtil;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobExecutionException;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.SysPrefs;\r
-\r
-public class DrmaaClusterEngineTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381.fasta";\r
-       public static String cluster_test_outfile = "TO1381.clustal.cluster.out";\r
-\r
-       /**\r
-        * This test uses ClustalW executable as runnable to testing, thus depends\r
-        * on its correct functioning\r
-        */\r
-       @Test(groups = { AllTestSuit.test_group_cluster,\r
-                       AllTestSuit.test_group_engine })\r
-       public void testSubmit() {\r
-               ClustalW clustal = new ClustalW();\r
-               assertFalse("Cluster execution can only be in unix environment",\r
-                               SysPrefs.isWindows);\r
-               clustal.setInput(test_input).setOutput(cluster_test_outfile);\r
-\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal,\r
-                                                       Executable.ExecProvider.Cluster);\r
-                       assertNotNull(confClust.getWorkDirectory());\r
-\r
-                       ClusterRunner runner = ClusterRunner.getInstance(confClust);\r
-                       assertEquals("Input was not set!", test_input, clustal.getInput());\r
-                       assertNotNull("Runner is NULL", runner);\r
-                       runner.executeJob();\r
-                       // assertNotNull("JobId is null", jobId1);\r
-                       JobStatus status = runner.getJobStatus();\r
-                       assertTrue("Status of the process is wrong!",\r
-                                       status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
-                       JobInfo info = runner.getJobInfo();\r
-\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.STARTED));\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-\r
-                       ConfiguredExecutable<?> confExec = runner.waitForResult();\r
-                       // At this point results are marked as collected\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-\r
-                       assertNotNull("JobInfo is null", info);\r
-                       StatisticManager sm = new StatisticManager(info);\r
-                       assertNotNull("Statistics manager is null", sm);\r
-\r
-                       try {\r
-\r
-                               String exits = sm.getExitStatus();\r
-                               assertNotNull("Exit status is null", exits);\r
-                               // cut 4 trailing zeros from the number\r
-                               int exitsInt = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse(exits)\r
-                                               .intValue();\r
-                               assertEquals("Exit status is not 0", 0, exitsInt);\r
-                               System.out.println(sm.getAllStats());\r
-\r
-                       } catch (ParseException e) {\r
-                               e.printStackTrace();\r
-                               fail("Parse Exception: " + e.getMessage());\r
-                       }\r
-                       assertTrue("Process exited:", sm.hasExited());\r
-                       assertFalse("Process aborted:", sm.wasAborted());\r
-                       assertFalse("Process hasdump:", sm.hasDump());\r
-                       assertFalse("Process signaled:", sm.hasSignaled());\r
-\r
-                       Alignment al = confExec.getResults();\r
-                       assertNotNull(al);\r
-                       assertFalse("Could not remove some files whilst cleaning up ",\r
-                                       runner.cleanup());\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (JobExecutionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (DrmaaException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_cluster,\r
-                       AllTestSuit.test_group_engine })\r
-       public void testCancel() {\r
-               ClustalW clustal = new ClustalW();\r
-               assertFalse("Cluster execution can only be in unix environment",\r
-                               SysPrefs.isWindows);\r
-               clustal.setInput(test_input).setOutput(cluster_test_outfile);\r
-\r
-               try {\r
-\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal,\r
-                                                       Executable.ExecProvider.Cluster);\r
-                       assertNotNull(confClust.getWorkDirectory());\r
-\r
-                       ClusterRunner runner = ClusterRunner.getInstance(confClust);\r
-                       assertNotNull("Runner is NULL", runner);\r
-\r
-                       runner.executeJob();\r
-                       // assertNotNull("JobId is null", jobId1);\r
-                       Thread.sleep(500);\r
-                       JobStatus status = runner.getJobStatus();\r
-                       assertTrue("Status of the process is wrong!",\r
-                                       status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
-                       runner.cancelJob();\r
-                       Thread.sleep(200); // give fs time to write a file\r
-                       JobInfo info = runner.getJobInfo();\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.STARTED));\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (JobExecutionException e) {\r
-                       e.printStackTrace();\r
-                       fail("DrmaaException caught:" + e.getMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail("Interupted exception caught:" + e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/cluster/drmaa/UtilTester.java b/testsrc/compbio/engine/cluster/drmaa/UtilTester.java
deleted file mode 100644 (file)
index d8bf470..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.cluster.drmaa;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.text.ParseException;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.cluster.drmaa.ClusterEngineUtil;\r
-\r
-public class UtilTester {\r
-\r
-       @Test\r
-       public void testParser() {\r
-               try {\r
-                       Number n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("11.0000");\r
-                       assertNotNull(n);\r
-                       int t = n.intValue();\r
-                       assertEquals(11, t);\r
-                       n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("11.2300");\r
-                       assertNotNull(n);\r
-                       t = n.intValue();\r
-                       assertEquals(11, t);\r
-                       float f = n.floatValue();\r
-                       assertEquals(11.23f, f);\r
-                       n = ClusterEngineUtil.CLUSTER_STAT_IN_SEC.parse("0.0310");\r
-                       assertNotNull(n);\r
-                       f = n.floatValue();\r
-                       assertEquals(0.031f, f);\r
-               } catch (ParseException e) {\r
-                       e.printStackTrace();\r
-                       fail("Parsing failed: " + e.getMessage());\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/conf/DirectoryManagerTester.java b/testsrc/compbio/engine/conf/DirectoryManagerTester.java
deleted file mode 100644 (file)
index acde559..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.conf;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertTrue;\r
-\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.SysPrefs;\r
-\r
-public class DirectoryManagerTester {\r
-\r
-       @Test(invocationCount = 4, threadPoolSize = 4, sequential = false)\r
-       public void testGetDirectory() {\r
-               Set<Long> set = new HashSet<Long>();\r
-               for (int i = 0; i < 20000; i++) {\r
-                       long number = DirectoryManager.getNonRepeatableNumber();\r
-                       assertTrue(set.add(number));\r
-                       // Cannot rely on the length is the returned long, as precision is\r
-                       // implementation dependent\r
-                       // see testNanoTime method below\r
-                       // assertEquals(Long.toString(number).length(), 17);\r
-               }\r
-               String name = DirectoryManager.getTaskDirectory(ClustalW.class);\r
-               assertTrue(name.startsWith(ClustalW.class.getSimpleName()));\r
-       }\r
-\r
-       /*\r
-        * In fact the precision of System.nanoTime() varies depending on the JVM\r
-        * Sun 1.6.0_17 JVM gives the same precision on linux x64 as on windows x32\r
-        * but openjdk 1.6.x gives more digits on linux than sun JVM It looks like\r
-        * the precision is desided at runtime, so the number of digits returned is\r
-        * unknown\r
-        */\r
-       @Test(enabled = false)\r
-       public void testNanoTime() {\r
-               if (SysPrefs.isWindows) {\r
-                       assertEquals(Long.toString(System.nanoTime()).length(), 16);\r
-               } else {\r
-                       // This is not always true for Linux\r
-                       assertEquals(Long.toString(System.nanoTime()).length(), 14);\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/conf/PropertyHelperManagerTester.java b/testsrc/compbio/engine/conf/PropertyHelperManagerTester.java
deleted file mode 100644 (file)
index ab3aa42..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.conf;\r
-\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-\r
-import java.io.File;\r
-\r
-import org.testng.annotations.BeforeClass;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.util.PropertyHelper;\r
-\r
-public class PropertyHelperManagerTester {\r
-\r
-       PropertyHelper ph;\r
-\r
-       @BeforeClass(alwaysRun=true)\r
-       public void testLoadResources() {\r
-               ph = PropertyHelperManager.getPropertyHelper();\r
-               assertNotNull(ph);\r
-       }\r
-\r
-       @Test(groups = AllTestSuit.test_group_cluster)\r
-       public void testClusterEngineConf() {\r
-               // Below are the properties on cluster engine required for its\r
-               // functioning\r
-               validateDirProp("cluster.tmp.directory");\r
-       }\r
-\r
-       void validateDirProp(String propName) {\r
-               assertNotNull(ph);\r
-               assertNotNull(ph.getProperty(propName));\r
-               File tmp = new File(ph.getProperty(propName).trim());\r
-               assertTrue(tmp.exists());\r
-               assertTrue(tmp.isDirectory());\r
-               assertTrue(tmp.canRead());\r
-               assertTrue(tmp.canWrite());\r
-       }\r
-\r
-       void validateExecFileProp(String propName) {\r
-               validateFileProp(propName);\r
-               File tmp = new File(ph.getProperty(propName));\r
-               assertTrue(tmp.canExecute());\r
-       }\r
-\r
-       void validateFileProp(String propName) {\r
-               assertNotNull(ph.getProperty(propName));\r
-               File tmp = new File(ph.getProperty(propName));\r
-               assertTrue(tmp.exists());\r
-               assertTrue(tmp.isFile());\r
-               assertTrue(tmp.canRead());\r
-       }\r
-\r
-       @Test\r
-       public void validateClustalConfiguration() {\r
-               // Below are the properties on Clustal executable required for its\r
-               // functioning\r
-               // Executables could not be verified as full path is constructed only at\r
-               // runtime\r
-               assertNotNull("local.clustalw.bin.windows");\r
-               assertNotNull("local.clustalw.bin");\r
-               assertNotNull("cluster.clustalw.bin");\r
-               validateFileProp("clustalw.presets.file");\r
-               validateFileProp("clustalw.parameters.file");\r
-               //validateFileProp("clustalw.limits.file");\r
-       }\r
-\r
-       @Test\r
-       public void validateMuscleConfiguration() {\r
-               assertNotNull("local.muscle.bin.windows");\r
-               assertNotNull("local.muscle.bin");\r
-               assertNotNull("cluster.muscle.bin");\r
-               validateFileProp("muscle.presets.file");\r
-               validateFileProp("muscle.parameters.file");\r
-               //validateFileProp("muscle.limits.file");\r
-       }\r
-\r
-       @Test\r
-       public void validateTcoffeeConfiguration() {\r
-               assertNotNull("local.tcoffee.bin.windows");\r
-               assertNotNull("local.tcoffee.bin");\r
-               assertNotNull("cluster.tcoffee.bin");\r
-               validateFileProp("tcoffee.presets.file");\r
-               validateFileProp("tcoffee.parameters.file");\r
-               //validateFileProp("tcoffee.limits.file");\r
-       }\r
-\r
-       @Test\r
-       public void validateMafftConfiguration() {\r
-               assertNotNull("local.mafft.bin.windows");\r
-               assertNotNull("local.mafft.bin");\r
-               assertNotNull("cluster.mafft.bin");\r
-               validateFileProp("mafft.presets.file");\r
-               validateFileProp("mafft.parameters.file");\r
-               //validateFileProp("mafft.limits.file");\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/conf/RunnerConfigMarshallerTester.java b/testsrc/compbio/engine/conf/RunnerConfigMarshallerTester.java
deleted file mode 100644 (file)
index db2ac48..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.conf;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.JAXBException;\r
-import javax.xml.validation.Schema;\r
-import javax.xml.validation.Validator;\r
-\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-import org.xml.sax.SAXException;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.Option;\r
-import compbio.metadata.Parameter;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.metadata.ValueConstrain;\r
-import compbio.metadata.WrongParameterException;\r
-import compbio.runner.msa.Mafft;\r
-\r
-public class RunnerConfigMarshallerTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "MafftParameters.xml";\r
-       public static String test_schema_output = "RunnerConfigSchema.xml";\r
-       public static String test_output = AllTestSuit.OUTPUT_DIR_ABSOLUTE + "MafftParameters.out.xml";\r
-\r
-       public static String invalidDoc = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "InvalidMafftParameters.xml";\r
-\r
-       RunnerConfig<Mafft> rconfig = null;\r
-       Parameter<Mafft> matrixParam = null;\r
-       RunnerConfigMarshaller<Mafft> pmarshaller = null;\r
-\r
-       @BeforeMethod\r
-       public void setup() {\r
-               // write some parameters programmatically\r
-               try {\r
-                       rconfig = new RunnerConfig<Mafft>();\r
-                       rconfig.setRunnerClassName(Mafft.class.getName());\r
-                       List<Option<Mafft>> prms = new ArrayList<Option<Mafft>>();\r
-\r
-                       Parameter<Mafft> p1 = new Parameter<Mafft>("Type", "Type of the sequence (PROTEIN or DNA)");\r
-                       // TODO publish help on a compbio web site\r
-\r
-                       p1.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-                       p1.addPossibleValues("PROTEIN", "DNA");\r
-                       p1.setOptionName("-TYPE");\r
-                       p1.setRequired(false);\r
-\r
-                       /*\r
-                        * -MATRIX= :Protein weight matrix=BLOSUM, PAM, GONNET, ID or\r
-                        * filename\r
-                        */\r
-                       Option<Mafft> p2 = new Option<Mafft>("MATRIX", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-\r
-                       p2.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-                       p2.addOptionNames("-jtree"); // "-retree"\r
-                       p2.setRequired(false);\r
-\r
-                       Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-                       p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-                       p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID");\r
-                       // This attribute is required by strict schema\r
-                       p3.setOptionName("--AAMATRIX");\r
-                       p3.setRequired(true);\r
-                       p3.setDefaultValue("pam");\r
-                       ValueConstrain vc = new ValueConstrain();\r
-                       vc.setType(ValueConstrain.Type.Float);\r
-                       vc.setMin("-10.12");\r
-                       vc.setMax("0");\r
-                       p3.setValidValue(vc);\r
-\r
-                       prms.add(p1);\r
-                       prms.add(p2);\r
-                       prms.add(p3);\r
-                       matrixParam = p3;\r
-                       rconfig.setOptions(prms);\r
-\r
-                       pmarshaller = new RunnerConfigMarshaller<Mafft>(RunnerConfig.class, Parameter.class, Option.class, ValueConstrain.class);\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test()\r
-       public void testMarshalling() {\r
-\r
-               File outfile = new File(this.test_output);\r
-               try {\r
-                       pmarshaller.write(rconfig, new FileOutputStream(outfile));\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-               assertTrue("Output file expected, but nothing found!", outfile.exists());\r
-               outfile.delete();\r
-       }\r
-\r
-       @Test()\r
-       public void testUnMarshalling() {\r
-\r
-               File outfile = new File(this.test_output);\r
-               try {\r
-                       pmarshaller.write(rconfig, new FileOutputStream(outfile));\r
-\r
-                       RunnerConfig<?> rconfig = pmarshaller.read(new FileInputStream(outfile), RunnerConfig.class, Parameter.class, Option.class,\r
-                                       ValueConstrain.class);\r
-                       assertNotNull(rconfig);\r
-                       assertEquals(rconfig.getParameters().size(), this.rconfig.getParameters().size());\r
-                       assertEquals(rconfig.getRunnerClassName(), this.rconfig.getRunnerClassName());\r
-                       assertTrue(matrixParam.equals(rconfig.getArgument("MATRIX1")));\r
-                       assertFalse(matrixParam.equals(rconfig.getArgument("Type")));\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-               // outfile.delete();\r
-       }\r
-\r
-       @Test()\r
-       public void testValidation() {\r
-               try {\r
-                       System.out.println("CCCC " + rconfig);\r
-                       // write schema\r
-                       pmarshaller.generateSchema(AllTestSuit.OUTPUT_DIR_ABSOLUTE, test_schema_output);\r
-\r
-                       File schemafile = new File(AllTestSuit.OUTPUT_DIR_ABSOLUTE, test_schema_output);\r
-                       assertTrue(schemafile.exists());\r
-                       // document is NOT valid even against a loose schema as elements in\r
-                       // java are annotated as required\r
-                       Validator looseValidator = RunnerConfigMarshaller.getValidator(schemafile.getAbsolutePath());\r
-\r
-                       // write output xml file\r
-                       File outfile = new File(this.test_output);\r
-                       pmarshaller.write(rconfig, new FileOutputStream(outfile));\r
-\r
-                       assertTrue("Invalid output is NOT expected", RunnerConfigMarshaller.validate(looseValidator, test_output));\r
-\r
-                       Schema strictSchema = RunnerConfigMarshaller.getSchema(AllTestSuit.TEST_DATA_PATH_ABSOLUTE + File.separator\r
-                                       + "RunnerConfigSchema.xsd");\r
-\r
-                       Validator strictVal = RunnerConfigMarshaller.getValidator(strictSchema);\r
-\r
-                       // document is invalid against strict schema\r
-                       assertFalse("Invalid output is expected", RunnerConfigMarshaller.validate(strictVal, invalidDoc));\r
-\r
-                       // schemafile.delete();\r
-                       // outfile.delete();\r
-\r
-               } catch (MalformedURLException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (SAXException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test(expectedExceptions = JAXBException.class)\r
-       public void testValidationOnMarshalling() throws SAXException, JAXBException, MalformedURLException {\r
-               // This is not valid parameter\r
-               Parameter<Mafft> p = new Parameter<Mafft>("MATRIXXX", "Protein weight matrix");\r
-               // This attribute is required by strict schema\r
-               // p.setOptionName("-M");\r
-               p.setRequired(true);\r
-               rconfig.addParameter(p);\r
-               try {\r
-\r
-                       // strict schema invalidate this document and throw an exception\r
-                       // just discard the output\r
-                       pmarshaller.writeAndValidate(rconfig, AllTestSuit.TEST_DATA_PATH_ABSOLUTE + File.separator + "RunnerConfigSchema.xsd",\r
-                                       new ByteArrayOutputStream());\r
-\r
-                       fail("Exception has been thrown before this place in unreachable");\r
-\r
-               } catch (MalformedURLException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test()\r
-       public void testSchemaFromCodeGeneration() {\r
-               try {\r
-\r
-                       pmarshaller.generateSchema(AllTestSuit.OUTPUT_DIR_ABSOLUTE, test_schema_output);\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-               File schemafile = new File(AllTestSuit.OUTPUT_DIR_ABSOLUTE, test_schema_output);\r
-               assertTrue("Schema file expected but not found", schemafile.exists());\r
-               assertTrue("Schema file seems to be empty", schemafile.length() > 50);\r
-               // schemafile.delete();\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java b/testsrc/compbio/engine/local/AsyncLocalRunnerTester.java
deleted file mode 100644 (file)
index 271d0e9..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.local;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertNotSame;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.util.concurrent.CancellationException;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.sequence.Alignment;\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.EngineUtil;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Muscle;\r
-import compbio.util.SysPrefs;\r
-\r
-public class AsyncLocalRunnerTester {\r
-\r
-       // Input path must be absolute to avoid coping input in working directory\r
-       public static String unix_test_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH + "TO1381.fasta";\r
-\r
-       public static String unix_test_AVG_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH\r
-                       + "50x500Protein.fasta";\r
-\r
-       public static String unix_test_LARGE_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH\r
-                       + "200x500Protein.fasta";\r
-\r
-       // Output file will be located in the task working directory, thus only name\r
-       // is required\r
-       public static String unix_test_outfile = "TO1381.alignment.out";\r
-       public static String cluster_test_outfile = "TO1381.alignment.cluster.out";\r
-\r
-       // Input path must be absolute to avoid coping input in working directory\r
-       public static String win_test_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH + "TO1381.fasta";\r
-\r
-       public static String win_test_LARGE_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH\r
-                       + "200x500Protein.fasta";\r
-\r
-       public static String win_test_AVG_input = AllTestSuit.CURRENT_DIRECTORY\r
-                       + File.separator + AllTestSuit.TEST_DATA_PATH\r
-                       + "50x500Protein.fasta";\r
-\r
-       // Output file will be located in the task working directory, thus only name\r
-       // is required\r
-       public static String win_test_outfile = "TO1381.alignment.out";\r
-\r
-       @Test(expectedExceptions = { CancellationException.class,\r
-                       ResultNotAvailableException.class }, groups = { AllTestSuit.test_group_engine })\r
-       public void testCancelLocally() throws ResultNotAvailableException {\r
-               System.out.println("Running testCancelLocally");\r
-               ClustalW clustal = new ClustalW();\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       clustal.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       clustal.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-               AsyncExecutor lr = new AsyncLocalRunner();\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       String jobId = lr.submitJob(confClust);\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       assertNotSame(lr.getJobStatus(jobId), JobStatus.FINISHED,\r
-                                       "Job has finished already. Too late to test cancel!");\r
-                       lr.cancelJob(jobId);\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> clustalr = lr.getResults(jobId);\r
-                       // @see AsyncLocalRunner.cleanup documents\r
-                       // assertTrue(lr.cleanup(jobId));\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(invocationCount = 5, threadPoolSize = 4, groups = { AllTestSuit.test_group_engine })\r
-       public void testSubmitLocally() {\r
-               System.out.println("Running testSubmitLocally()");\r
-               Muscle muscle = new Muscle();\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       muscle.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       muscle.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-               AsyncExecutor lr = new AsyncLocalRunner();\r
-               try {\r
-                       ConfiguredExecutable<Muscle> confMuscle = Configurator\r
-                                       .configureExecutable(muscle);\r
-                       String jobId = lr.submitJob(confMuscle);\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       // assertNotSame("Job has finished already. Too late to test cancel!",\r
-                       // JobStatus.FINISHED, lr.getJobStatus(jobId));\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> muscler = lr.getResults(jobId);\r
-                       Alignment al = confMuscle.getResults();\r
-                       assertNotNull(al);\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(invocationCount = 5, threadPoolSize = 4, groups = { AllTestSuit.test_group_engine })\r
-       public void testGetStatus() {\r
-               System.out.println("Running testGetStatus");\r
-               Muscle muscle = new Muscle();\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       muscle.setInput(win_test_AVG_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       muscle.setInput(unix_test_AVG_input).setOutput(unix_test_outfile);\r
-               }\r
-               AsyncExecutor lr = new AsyncLocalRunner();\r
-               try {\r
-                       ConfiguredExecutable<Muscle> confMuscle = Configurator\r
-                                       .configureExecutable(muscle);\r
-                       String jobId = lr.submitJob(confMuscle);\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       JobStatus status = lr.getJobStatus(jobId);\r
-                       while (status == JobStatus.UNDEFINED) {\r
-                               assertTrue(status == JobStatus.UNDEFINED);\r
-                               Thread.sleep(100);\r
-                               status = lr.getJobStatus(jobId);\r
-                       }\r
-                       while (status != JobStatus.FINISHED) {\r
-                               Thread.sleep(500);\r
-                               assertTrue(status == JobStatus.RUNNING);\r
-                               status = lr.getJobStatus(jobId);\r
-                       }\r
-                       // assert that we get here, means that the job reached FINISHED\r
-                       // status\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> muscler = lr.getResults(jobId);\r
-                       /*\r
-                        * After results were obtained the task were removed for the queue,\r
-                        * and it status could not be determined\r
-                        */\r
-                       // Make sure list has been updated\r
-                       Thread.sleep(200);\r
-                       status = lr.getJobStatus(jobId);\r
-                       assertTrue(status == JobStatus.FINISHED);\r
-\r
-                       Alignment al = confMuscle.getResults();\r
-\r
-                       assertNotNull(al);\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = CancellationException.class, groups = { AllTestSuit.test_group_engine })\r
-       public void testMultipleCancelLocally() {\r
-               System.out.println("Running testMultipleCancelLocally()");\r
-               ClustalW clustal = new ClustalW();\r
-               ClustalW clustal2 = new ClustalW();\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       clustal.setInput(win_test_input).setOutput(win_test_outfile);\r
-                       clustal2.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       clustal.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-                       clustal2.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClustal1 = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       ConfiguredExecutable<ClustalW> confClustal2 = Configurator\r
-                                       .configureExecutable(clustal2);\r
-                       AsyncLocalRunner lr = new AsyncLocalRunner();\r
-                       AsyncLocalRunner lr2 = new AsyncLocalRunner();\r
-\r
-                       String jobId1 = lr.submitJob(confClustal1);\r
-                       String jobId2 = lr2.submitJob(confClustal2);\r
-\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       assertNotSame(lr.getJobStatus(jobId1), JobStatus.FINISHED,\r
-                                       "Job has finished already. Too late to test cancel!");\r
-                       lr.cancelJob(jobId1);\r
-                       // Thread.sleep(10);\r
-                       assertNotSame(lr2.getJobStatus(jobId2), JobStatus.FINISHED,\r
-                                       "Job has finished already. Too late to test cancel!");\r
-                       lr2.cancelJob(jobId2);\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> clustalr = lr.getResults(jobId1);\r
-                       Executable<?> clustalr2 = lr2.getResults(jobId2);\r
-\r
-                       assertTrue(lr.cleanup(jobId1));\r
-                       assertTrue(lr2.cleanup(jobId2));\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine })\r
-       public void testCancelCompletedTaskLocally() {\r
-               System.out.println("Running testCancelCompletedTaskLocally");\r
-               ClustalW clustal = new ClustalW();\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       clustal.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       clustal.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClustal1 = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       AsyncLocalRunner lr = new AsyncLocalRunner();\r
-                       String jobId = lr.submitJob(confClustal1);\r
-                       Thread.currentThread();\r
-                       Thread.sleep(3000); // wait for 100ms\r
-                       assertEquals(lr.getJobStatus(jobId), JobStatus.FINISHED,\r
-                                       "Job has not finished!");\r
-                       lr.cancelJob(jobId);\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> clustalr = lr.getResults(jobId);\r
-                       assertNotNull(clustalr);\r
-\r
-                       assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(),\r
-                                       JobStatus.STARTED));\r
-                       assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertTrue(EngineUtil.isMarked(confClustal1.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertFalse(EngineUtil.isMarked(confClustal1.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine })\r
-       public void testAsyncRetrievOperation() {\r
-               System.out.println("Running testAsyncOperation()");\r
-               Muscle muscle = new Muscle();\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       muscle.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       muscle.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-\r
-               try {\r
-                       ConfiguredExecutable<Muscle> confMuscle = Configurator\r
-                                       .configureExecutable(muscle);\r
-                       AsyncExecutor lr = new AsyncLocalRunner();\r
-                       String jobId = lr.submitJob(confMuscle);\r
-                       AsyncLocalRunner as = new AsyncLocalRunner();\r
-                       ConfiguredExecutable<Muscle> muscler = (ConfiguredExecutable<Muscle>) as\r
-                                       .getResults(jobId);\r
-                       assertNotNull(muscler);\r
-                       Alignment al1 = muscler.getResults();\r
-\r
-                       assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(),\r
-                                       JobStatus.STARTED));\r
-                       assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertTrue(EngineUtil.isMarked(muscler.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertFalse(EngineUtil.isMarked(muscler.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       assertFalse(EngineUtil.isMarked(muscler.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-                       Alignment al2 = confMuscle.getResults();\r
-                       assertNotNull(al1);\r
-                       assertNotNull(al2);\r
-                       assertTrue(al1.equals(al2));\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_engine })\r
-       public void testAsyncCancelOperation() {\r
-               System.out.println("Running testAsyncOperation()");\r
-               Muscle muscle = new Muscle();\r
-\r
-               if (SysPrefs.isWindows) {\r
-                       System.out.println("Working in WINDOWS environment");\r
-                       muscle.setInput(win_test_input).setOutput(win_test_outfile);\r
-               } else {\r
-                       System.out.println("Working in UNIX environment");\r
-                       muscle.setInput(unix_test_input).setOutput(unix_test_outfile);\r
-               }\r
-\r
-               try {\r
-                       ConfiguredExecutable<Muscle> confMuscle = Configurator\r
-                                       .configureExecutable(muscle);\r
-                       AsyncExecutor lr = new AsyncLocalRunner();\r
-                       String jobId = lr.submitJob(confMuscle);\r
-                       // This call causes CancellationException to be thrown\r
-                       AsyncLocalRunner as = new AsyncLocalRunner();\r
-                       assertTrue(as.getJobStatus(jobId) != JobStatus.FINISHED);\r
-                       as.cancelJob(jobId);\r
-                       assertTrue(as.getJobStatus(jobId) == JobStatus.CANCELLED);\r
-\r
-                       assertTrue(EngineUtil.isMarked(confMuscle.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       // could be both\r
-                       // assertFalse(Util.isMarked(confMuscle.getWorkDirectory(),\r
-                       // Util.StatFileType.STARTED));\r
-                       assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertFalse(EngineUtil.isMarked(confMuscle.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-                       // Executable<?> muscler = as.getResult(jobId);\r
-                       // assertNotNull(muscler);\r
-                       // Alignment al = muscle.getResults();\r
-                       // assertNotNull(al);\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/local/EngineResourcesLeakTester.java b/testsrc/compbio/engine/local/EngineResourcesLeakTester.java
deleted file mode 100644 (file)
index 08e194c..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-package compbio.engine.local;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.AsyncExecutor;\r
-import compbio.engine.Configurator;\r
-import compbio.engine.SubmissionManager;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Muscle;\r
-\r
-public class EngineResourcesLeakTester {\r
-\r
-       static int numberOfExecutions = 50;\r
-\r
-       @Test(groups = { AllTestSuit.test_group_long })\r
-       public void loadEngineRetrieveResultsManyTimes() {\r
-\r
-               List<String> idlist = new ArrayList<String>();\r
-               ClustalW clu = new ClustalW();\r
-               clu.setInput(AllTestSuit.test_input_real);\r
-               try {\r
-                       for (int i = 0; i < numberOfExecutions; i++) {\r
-                               ConfiguredExecutable<ClustalW> cclustal = Configurator\r
-                                               .configureExecutable(clu, Executable.ExecProvider.Local);\r
-                               AsyncExecutor engine = Configurator.getAsyncEngine(cclustal);\r
-                               String jobId = engine.submitJob(cclustal);\r
-                               assertNotNull(jobId);\r
-                               Thread.sleep(50);\r
-                               assertNotNull(SubmissionManager.getTask(jobId));\r
-                               assertTrue(idlist.add(jobId));\r
-                       }\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-               assertEquals(idlist.size(), numberOfExecutions);\r
-               // assertEquals(SubmissionManager.submittedTasks.size(),\r
-               // numberOfExecutions * 2);\r
-\r
-               try {\r
-                       while (true) {\r
-                               int doneCounter = 0;\r
-                               for (String taskId : idlist) {\r
-                                       AsyncExecutor engine = Configurator.getAsyncEngine(taskId);\r
-                                       JobStatus status = engine.getJobStatus(taskId);\r
-                                       System.out.println("Status for job: " + taskId + " "\r
-                                                       + status);\r
-\r
-                                       if (status == JobStatus.FINISHED) {\r
-                                               assertNotNull(taskId);\r
-                                               System.out.println(taskId);\r
-                                               // System.out.println(SubmissionManager.submittedTasks);\r
-                                               // assertNotNull(SubmissionManager.getTask(taskId));\r
-                                               Thread.sleep(200); // let buffers to be written\r
-                                               ConfiguredExecutable<ClustalW> confclust = (ConfiguredExecutable<ClustalW>) engine\r
-                                                               .getResults(taskId);\r
-                                               assertNotNull(confclust);\r
-                                               assertNotNull(confclust.getResults());\r
-                                               doneCounter++;\r
-                                       }\r
-                               }\r
-                               if (doneCounter == numberOfExecutions) {\r
-                                       break;\r
-                               }\r
-                       }\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_long  })\r
-       public void loadEngineRetrieveResultsOnce() {\r
-\r
-               Map<String, Boolean> idlist = new HashMap<String, Boolean>();\r
-               Muscle muscle = new Muscle();\r
-               muscle.setInput(AllTestSuit.test_input_real);\r
-               muscle.setOutput("muscle.out");\r
-               try {\r
-                       for (int i = 0; i < numberOfExecutions; i++) {\r
-                               ConfiguredExecutable<Muscle> cmuscle = Configurator\r
-                                               .configureExecutable(muscle,\r
-                                                               Executable.ExecProvider.Local);\r
-                               AsyncExecutor engine = Configurator.getAsyncEngine(cmuscle);\r
-                               String jobId = engine.submitJob(cmuscle);\r
-                               assertNotNull(jobId);\r
-                               Thread.sleep(50);\r
-                               assertNotNull(SubmissionManager.getTask(jobId));\r
-                               assertTrue(idlist.put(jobId, false) == null);\r
-                       }\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-               assertEquals(idlist.size(), numberOfExecutions);\r
-               // assertEquals(SubmissionManager.submittedTasks.size(), 20);\r
-\r
-               try {\r
-                       int doneCounter = 0;\r
-                       while (true) {\r
-                               if (doneCounter == numberOfExecutions) {\r
-                                       break;\r
-                               }\r
-                               for (String taskId : idlist.keySet()) {\r
-                                       Thread.sleep(50); // slow checking down\r
-                                       AsyncExecutor engine = Configurator.getAsyncEngine(taskId);\r
-                                       JobStatus status = engine.getJobStatus(taskId);\r
-                                       System.out.println("Status for job: " + taskId + " "\r
-                                                       + status);\r
-\r
-                                       if (status == JobStatus.FINISHED) {\r
-                                               assertNotNull(taskId);\r
-                                               if (idlist.get(taskId)) {\r
-                                                       continue;\r
-                                               }\r
-                                               System.out.println(taskId);\r
-                                               // System.out.println(SubmissionManager.submittedTasks);\r
-                                               // assertNotNull(SubmissionManager.getTask(taskId));\r
-                                               Thread.sleep(100);// let the buffers to write things\r
-                                               ConfiguredExecutable<ClustalW> confclust = (ConfiguredExecutable<ClustalW>) engine\r
-                                                               .getResults(taskId);\r
-                                               assertNotNull(confclust);\r
-                                               assertNotNull(confclust.getResults());\r
-                                               idlist.put(taskId, true);\r
-                                               doneCounter++;\r
-                                       }\r
-                               }\r
-                       }\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/engine/local/LocalRunnerTester.java b/testsrc/compbio/engine/local/LocalRunnerTester.java
deleted file mode 100644 (file)
index 13dfed0..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.engine.local;\r
-\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.AssertJUnit.assertNotSame;\r
-import static org.testng.AssertJUnit.assertNull;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.util.concurrent.CancellationException;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.Configurator;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable;\r
-import compbio.engine.client.EngineUtil;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobExecutionException;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.runner.msa.ClustalW;\r
-\r
-public class LocalRunnerTester {\r
-\r
-       public static String cluster_test_outfile = "TO1381.clustal.cluster.out"; // "/homes/pvtroshin/TO1381.clustal.cluster.out\r
-       // go up 2 directories from workspace: workspace/clustengine\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381.fasta";\r
-       public static String test_outfile = "TO1381.clustal.out";\r
-\r
-       @Test(expectedExceptions = CancellationException.class, groups = { AllTestSuit.test_group_engine })\r
-       public void testCancelLocally() {\r
-               ClustalW clustal = new ClustalW();\r
-               clustal.setInput(test_input).setOutput(test_outfile);\r
-\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       LocalRunner lr = new LocalRunner(confClust);\r
-\r
-                       lr.executeJob();\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       assertNotSame("Job has finished already. Too late to test cancel!",\r
-                                       JobStatus.FINISHED, lr.getJobStatus());\r
-                       lr.cancelJob();\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> clustalr = lr.waitForResult();\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.CANCELLED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.STARTED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.COLLECTED));\r
-                       assertTrue(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.FINISHED));\r
-                       assertFalse(EngineUtil.isMarked(confClust.getWorkDirectory(),\r
-                                       JobStatus.SUBMITTED));\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JobExecutionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = { CancellationException.class,\r
-                       JobExecutionException.class }, groups = { AllTestSuit.test_group_engine })\r
-       public void testMultipleCancelLocally() throws JobExecutionException {\r
-               ClustalW clustal = new ClustalW();\r
-               ClustalW clustal2 = new ClustalW();\r
-               clustal.setInput(test_input).setOutput(test_outfile);\r
-               clustal2.setInput(test_input).setOutput(test_outfile);\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal);\r
-                       ConfiguredExecutable<ClustalW> confClust2 = Configurator\r
-                                       .configureExecutable(clustal2);\r
-\r
-                       LocalRunner lr = new LocalRunner(confClust);\r
-                       LocalRunner lr2 = new LocalRunner(confClust2);\r
-\r
-                       lr.executeJob();\r
-                       lr2.executeJob();\r
-\r
-                       // Thread.sleep(10); //wait for 100ms\r
-                       assertNotSame("Job has finished already. Too late to test cancel!",\r
-                                       JobStatus.FINISHED, lr.getJobStatus());\r
-                       lr.cancelJob();\r
-                       // Thread.sleep(10);\r
-                       assertNotSame("Job has finished already. Too late to test cancel!",\r
-                                       JobStatus.FINISHED, lr2.getJobStatus());\r
-                       lr2.cancelJob();\r
-                       // This call causes CancellationException to be thrown\r
-                       Executable<?> clustalr = lr.waitForResult();\r
-                       Executable<?> clustalr2 = lr2.waitForResult();\r
-\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = { CancellationException.class }, groups = { AllTestSuit.test_group_engine })\r
-       public void testCancelCompletedTaskLocally() throws JobExecutionException {\r
-               ClustalW clustal = new ClustalW();\r
-               clustal.setInput(test_input).setOutput(test_outfile);\r
-\r
-               try {\r
-                       ConfiguredExecutable<ClustalW> confClust = Configurator\r
-                                       .configureExecutable(clustal, Executable.ExecProvider.Local);\r
-                       LocalRunner lr = new LocalRunner(confClust);\r
-                       lr.executeJob();\r
-                       Thread.currentThread();\r
-                       Thread.sleep(30); // wait for 100ms\r
-                       assertNotSame("Job has not finished!", JobStatus.FINISHED, lr\r
-                                       .getJobStatus());\r
-                       lr.cancelJob();\r
-                       // This call causes ResultNotAvailableException to be thrown\r
-                       ConfiguredExecutable<?> clustalr = lr.waitForResult();\r
-                       assertNull(clustalr.getResults());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/metadata/AllTestSuit.java b/testsrc/compbio/metadata/AllTestSuit.java
deleted file mode 100644 (file)
index 8e9d9aa..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- * Copyright (c) 2013 Alexander Sherstnev\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS)\r
- *   @version: 2.5     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.metadata;\r
-\r
-import java.io.File;\r
-import compbio.util.SysPrefs;\r
-\r
-public class AllTestSuit {\r
-       public final static String test_group_cluster = "cluster";\r
-       public final static String test_group_runner = "runner";\r
-       public final static String test_group_non_windows = "non_windows";\r
-       public final static String test_group_windows_only = "windows_only";\r
-       public final static String test_group_engine = "engine";\r
-       public final static String test_group_long = "performance";\r
-       public final static String test_group_webservices = "webservices";\r
-\r
-       // For this to work execution must start from the project directory!\r
-       public static final String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + File.separator;\r
-       public static final String TEST_DATA_PATH = "testsrc" + File.separator + "testdata" + File.separator;\r
-       public static final String TEST_DATA_PATH_ABSOLUTE = AllTestSuit.CURRENT_DIRECTORY + TEST_DATA_PATH;\r
-\r
-       // For cluster execution paths MUST BE ABSOLUTE as cluster hosts will not be\r
-       // able to access the task otherwise\r
-       public static final String OUTPUT_DIR_ABSOLUTE = AllTestSuit.CURRENT_DIRECTORY + "local_jobsout" + File.separator;\r
-       public static final String RUNNER_TEST_LOGGER = "RunnerLogger";\r
-\r
-       public static final String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "TO1381.fasta";\r
-       public static final String test_alignment_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "TO1381.fasta.aln";\r
-       public static final String test_input_real = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "50x500Protein.fasta";\r
-       public static final String test_input_dna = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "3dnaseqs.fasta";\r
-       public static final String test_input_large = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "1000x3000Dna.fasta";\r
-       \r
-       public static final String test_input_aln = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "unfolded_RF00031.aln";\r
-\r
-}\r
diff --git a/testsrc/compbio/metadata/OptionCombinatorTester.java b/testsrc/compbio/metadata/OptionCombinatorTester.java
deleted file mode 100644 (file)
index 6a85aeb..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.metadata;\r
-\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-\r
-import javax.xml.bind.JAXBException;\r
-\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.conf.RunnerConfigMarshaller;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.runner.OptionCombinator;\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.runner.msa.Mafft;\r
-import compbio.runner.msa.Muscle;\r
-\r
-public class OptionCombinatorTester {\r
-\r
-       static final String mafftConfigFile = AllTestSuit.TEST_DATA_PATH\r
-                       + "MafftParameters.xml";\r
-\r
-       static final String muscleConfigFile = AllTestSuit.TEST_DATA_PATH\r
-                       + "MuscleParameters.xml";\r
-\r
-       static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH\r
-                       + "ClustalParameters.xml";\r
-\r
-       RunnerConfig<Mafft> mafftConfig = null;\r
-       RunnerConfig<Mafft> muscleConfig = null;\r
-       RunnerConfig<Mafft> clustalConfig = null;\r
-\r
-       @BeforeMethod\r
-       @SuppressWarnings("unchecked")\r
-       void setup() {\r
-               try {\r
-                       RunnerConfigMarshaller<Mafft> mf = new RunnerConfigMarshaller<Mafft>(\r
-                                       RunnerConfig.class);\r
-                       mafftConfig = mf.read(\r
-                                       new FileInputStream(new File(mafftConfigFile)),\r
-                                       RunnerConfig.class);\r
-                       RunnerConfigMarshaller<Muscle> musclemarsh = new RunnerConfigMarshaller<Muscle>(\r
-                                       RunnerConfig.class);\r
-                       muscleConfig = musclemarsh.read(new FileInputStream(new File(\r
-                                       muscleConfigFile)), RunnerConfig.class);\r
-\r
-                       RunnerConfigMarshaller<ClustalW> clustalmarsh = new RunnerConfigMarshaller<ClustalW>(\r
-                                       RunnerConfig.class);\r
-                       clustalConfig = clustalmarsh.read(new FileInputStream(new File(\r
-                                       clustalConfigFile)), RunnerConfig.class);\r
-\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void testgetAllOptions() {\r
-               OptionCombinator opc = new OptionCombinator(mafftConfig);\r
-               System.out.println(opc.getOptionsAtRandom());\r
-               OptionCombinator muscleOpc = new OptionCombinator(muscleConfig);\r
-               System.out.println("Mucle " + muscleOpc.getOptionsAtRandom());\r
-               OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);\r
-               System.out.println("Clustal " + clustalOpc.getOptionsAtRandom());\r
-\r
-       }\r
-\r
-       @Test\r
-       public void testgetAllParameters() {\r
-               OptionCombinator opc = new OptionCombinator(mafftConfig);\r
-               System.out.println(opc.getAllParameters());\r
-               OptionCombinator muscleOpc = new OptionCombinator(muscleConfig);\r
-               System.out.println("Muscle : " + muscleOpc.getAllParameters());\r
-               OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);\r
-               System.out.println("Clustal : " + clustalOpc.getAllParameters());\r
-       }\r
-}\r
diff --git a/testsrc/compbio/metadata/OptionMarshallerTester.java b/testsrc/compbio/metadata/OptionMarshallerTester.java
deleted file mode 100644 (file)
index b681729..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.metadata;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertNotNull;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.FileOutputStream;\r
-import java.io.IOException;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.JAXBContext;\r
-import javax.xml.bind.JAXBElement;\r
-import javax.xml.bind.JAXBException;\r
-import javax.xml.bind.Unmarshaller;\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-import org.xml.sax.SAXException;\r
-\r
-import compbio.engine.conf.RunnerConfigMarshaller;\r
-import compbio.runner.msa.Mafft;\r
-\r
-public class OptionMarshallerTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "MafftParameters.xml";\r
-       public static String test_schema_output = "NextGenMafftOptionsSchema.xml";\r
-       public static String test_output = "MafftOptions.xml.out";\r
-       public static String reWrittenInput = AllTestSuit.OUTPUT_DIR_ABSOLUTE + "rewrittenMafftParams.xml";\r
-\r
-       RunnerConfig<Mafft> rconfig = null;\r
-       Option<Mafft> matrixParam = null;\r
-\r
-       @BeforeMethod()\r
-       public void setup() {\r
-               // write some parameters programmatically\r
-               try {\r
-                       rconfig = new RunnerConfig<Mafft>();\r
-                       rconfig.setRunnerClassName(Mafft.class.getName());\r
-                       List<Option<Mafft>> prms = new ArrayList<Option<Mafft>>();\r
-\r
-                       Parameter<Mafft> p1 = new Parameter<Mafft>("Type", "Type of the sequence (PROTEIN or DNA)");\r
-                       // TODO publish help on a compbio web site\r
-\r
-                       p1.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-                       p1.addPossibleValues("PROTEIN", "DNA");\r
-                       p1.setOptionName("-TYPE");\r
-                       p1.setRequired(false);\r
-\r
-                       /*\r
-                        * -MATRIX= :Protein weight matrix=BLOSUM, PAM, GONNET, ID or\r
-                        * filename\r
-                        */\r
-                       Option<Mafft> p2 = new Option<Mafft>("MATRIX", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-\r
-                       p2.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-                       p2.addOptionNames("-jtree");\r
-                       p2.addOptionNames("-jfasta");\r
-                       p2.setRequired(false);\r
-\r
-                       Parameter<Mafft> p3 = new Parameter<Mafft>("MATRIX2", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-                       p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-                       p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID");\r
-                       // This attribute is required by strict schema\r
-                       p3.setOptionName("-MATRIX");\r
-                       p3.setRequired(true);\r
-                       p3.setDefaultValue("id");\r
-                       ValueConstrain vc = new ValueConstrain();\r
-                       vc.setType(ValueConstrain.Type.Float);\r
-                       vc.setMin("-10.12");\r
-                       vc.setMax("0");\r
-                       p3.setValidValue(vc);\r
-\r
-                       prms.add(p1);\r
-                       prms.add(p2);\r
-                       prms.add(p3);\r
-                       matrixParam = p2;\r
-                       rconfig.setOptions(prms);\r
-\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = { javax.xml.bind.MarshalException.class })\r
-       public void testMarshalling() throws JAXBException {\r
-\r
-               File outfile = new File(AllTestSuit.OUTPUT_DIR_ABSOLUTE, test_output);\r
-               try {\r
-                       RunnerConfigMarshaller<Mafft> rmarsh = new RunnerConfigMarshaller<Mafft>(RunnerConfig.class);\r
-\r
-                       // This throws an exception\r
-                       // I am not sure why\r
-                       rmarsh.writeAndValidate(rconfig, AllTestSuit.TEST_DATA_PATH_ABSOLUTE + File.separator + "RunnerConfigSchema.xsd",\r
-                                       new FileOutputStream(outfile));\r
-\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (SAXException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-               assertTrue("Output file expected, but nothing found!", outfile.exists());\r
-               // outfile.delete();\r
-       }\r
-\r
-       @Test()\r
-       public void testUnMarshalling() {\r
-               try {\r
-                       File input = new File(this.test_input);\r
-                       assertTrue(input.exists());\r
-                       JAXBContext ctx = JAXBContext.newInstance(RunnerConfig.class);\r
-                       Unmarshaller um = ctx.createUnmarshaller();\r
-                       JAXBElement<RunnerConfig> rconfig = um.unmarshal(new StreamSource(input), RunnerConfig.class);\r
-                       RunnerConfig<Mafft> runner = rconfig.getValue();\r
-                       assertNotNull(runner);\r
-                       System.out.println(runner);\r
-                       assertFalse(runner.options.isEmpty());\r
-                       assertFalse(runner.parameters.isEmpty());\r
-                       assertEquals(7, runner.options.size());\r
-                       assertEquals(8, runner.parameters.size());\r
-                       Option<Mafft> stypeOption = runner.getArgument("Sequence type");\r
-                       System.out.println(stypeOption);\r
-                       assertNotNull(stypeOption);\r
-                       assertFalse(stypeOption.isRequired);\r
-                       assertEquals("--auto", stypeOption.defaultValue);\r
-                       assertEquals(2, stypeOption.optionNames.size());\r
-\r
-                       assertEquals(" ", runner.getPrmSeparator());\r
-                       Option<Mafft> guidetrOption = runner.getArgument("Guide tree rebuild");\r
-                       Parameter<Mafft> guidetr = (Parameter<Mafft>) guidetrOption;\r
-                       ValueConstrain constraint = guidetr.getValidValue();\r
-                       assertEquals("Integer", constraint.type.toString());\r
-                       assertEquals(1, constraint.getMin());\r
-                       assertEquals(100, constraint.getMax());\r
-\r
-                       RunnerConfigMarshaller<Mafft> rmarsh = new RunnerConfigMarshaller<Mafft>(RunnerConfig.class);\r
-                       // Now see if we can write a valid document back discard the actual\r
-                       // output only validation is important here\r
-                       rmarsh.write(rconfig, new FileOutputStream(new File(reWrittenInput)));\r
-                       RunnerConfig<Mafft> rc = rmarsh.readAndValidate(new FileInputStream(new File(reWrittenInput)), RunnerConfig.class);\r
-                       assertEquals(runner, rc);\r
-\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (SAXException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/metadata/PresetTester.java b/testsrc/compbio/metadata/PresetTester.java
deleted file mode 100644 (file)
index 0b5a0a3..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-\r
-package compbio.metadata;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.JAXBContext;\r
-import javax.xml.bind.JAXBElement;\r
-import javax.xml.bind.JAXBException;\r
-import javax.xml.bind.Unmarshaller;\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.testng.annotations.BeforeTest;\r
-import org.testng.annotations.Test;\r
-import org.xml.sax.SAXException;\r
-\r
-import compbio.engine.conf.RunnerConfigMarshaller;\r
-import compbio.runner.msa.Mafft;\r
-\r
-public class PresetTester {\r
-\r
-    public static final String input = AllTestSuit.TEST_DATA_PATH\r
-           + "MafftPresets.xml";\r
-    public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-           + "MafftParameters.xml";\r
-\r
-    PresetManager<Mafft> presets = null;\r
-    RunnerConfig<Mafft> rconfParams = null;\r
-\r
-    @BeforeTest(enabled = true)\r
-    public void loadPresets() {\r
-       try {\r
-           // Load Preset definitions\r
-           RunnerConfigMarshaller<Mafft> rconfigPresets = new RunnerConfigMarshaller<Mafft>(\r
-                   PresetManager.class);\r
-           File infile = new File(input);\r
-           assertTrue(infile.exists());\r
-           presets = rconfigPresets.read(new FileInputStream(infile),\r
-                   PresetManager.class);\r
-           assertNotNull(presets);\r
-           assertFalse(presets.preset.isEmpty());\r
-\r
-           // Load Parameters definitions\r
-           File input = new File(this.test_input);\r
-           assertTrue(input.exists());\r
-           JAXBContext ctx = JAXBContext.newInstance(RunnerConfig.class);\r
-           Unmarshaller um = ctx.createUnmarshaller();\r
-           JAXBElement<RunnerConfig> rconfigParams = um.unmarshal(\r
-                   new StreamSource(input), RunnerConfig.class);\r
-           rconfParams = rconfigParams.getValue();\r
-           assertNotNull(rconfParams);\r
-\r
-       } catch (JAXBException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       } catch (FileNotFoundException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       }\r
-    }\r
-\r
-    @Test\r
-    public void marshallPreset() {\r
-       try {\r
-           RunnerConfigMarshaller<Mafft> rconfig = new RunnerConfigMarshaller<Mafft>(\r
-                   PresetManager.class);\r
-           PresetManager<Mafft> pman = getPresets();\r
-           assertNotNull(pman);\r
-           rconfig.readAndValidate(new FileInputStream(new File(input)),\r
-                   PresetManager.class);\r
-       } catch (JAXBException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       } catch (IOException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       } catch (SAXException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       }\r
-    }\r
-\r
-    @Test\r
-    public void validatePresets() {\r
-       assertNotNull(presets);\r
-       assertEquals(presets.getPresets().size(), 6);\r
-       try {\r
-           for (Preset<Mafft> pr : presets.getPresets()) {\r
-               List<Option<Mafft>> options;\r
-               options = pr.getArguments(rconfParams);\r
-               assertFalse(options.isEmpty());\r
-               if (pr.name.equals("L-INS-i (Accuracy-oriented)")) {\r
-                   assertEquals(options.size(), 2);\r
-                   Option<Mafft> o = options.get(0);\r
-                   if (o.name.equals("Pairwise alignment computation method")) {\r
-                       List<String> onames = o.getOptionNames();\r
-                       boolean match = false;\r
-                       for (String oname : onames) {\r
-                           if (oname.equals("--localpair")) {\r
-                               match = true;\r
-                               break;\r
-                           }\r
-                       }\r
-                       assertTrue(match);\r
-                   }\r
-               }\r
-               if (pr.name.equals("NW-NS-PartTree-1 (Speed oriented)")) {\r
-                   assertEquals(options.size(), 4);\r
-               }\r
-           }\r
-       } catch (WrongParameterException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       }\r
-    }\r
-\r
-    @Test\r
-    public void testPresetWithMuptiOptions() {\r
-       assertNotNull(presets);\r
-       assertEquals(presets.getPresets().size(), 6);\r
-       try {\r
-           for (Preset<Mafft> pr : presets.getPresets()) {\r
-               List<Option<Mafft>> options;\r
-               options = pr.getArguments(rconfParams);\r
-               assertFalse(options.isEmpty());\r
-               if (pr.name.equals("E-INS-i (Accuracy-oriented)")) {\r
-                   assertEquals(options.size(), 3);\r
-                   Option<Mafft> o = options.get(0);\r
-                   if (o.name.equals("Pairwise alignment computation method")) {\r
-                       List<String> onames = o.getOptionNames();\r
-                       boolean match = false;\r
-                       for (String oname : onames) {\r
-                           if (oname.equals("--genafpair")) {\r
-                               match = true;\r
-                               break;\r
-                           }\r
-                       }\r
-                       assertTrue(match);\r
-                   }\r
-               }\r
-               if (pr.name.equals("NW-NS-PartTree-1 (Speed oriented)")) {\r
-                   assertEquals(options.size(), 4);\r
-               }\r
-           }\r
-       } catch (WrongParameterException e) {\r
-           e.printStackTrace();\r
-           fail(e.getMessage());\r
-       }\r
-    }\r
-\r
-    private static PresetManager<Mafft> getPresets() {\r
-       Preset<Mafft> preset1 = new Preset<Mafft>();\r
-       preset1.name = "L-INS-i (Accuracy-oriented)";\r
-       preset1.description = "dsfjkg fdjksghkjsgdfh jksdfg sdfgkjhsdfgk kjsdfg ";\r
-\r
-       List<String> optionNames = new ArrayList<String>();\r
-       optionNames.add("--localpair");\r
-       optionNames.add("--maxiterate 1000");\r
-       preset1.option = optionNames;\r
-       PresetManager<Mafft> prman = new PresetManager<Mafft>();\r
-       prman.preset = Collections.singletonList(preset1);\r
-       prman.runnerClassName = Mafft.class.getCanonicalName();\r
-\r
-       return prman;\r
-    }\r
-}\r
diff --git a/testsrc/compbio/metadata/RunnerConfigTester.java b/testsrc/compbio/metadata/RunnerConfigTester.java
deleted file mode 100644 (file)
index 99549e1..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-package compbio.metadata;\r
-\r
-import static org.testng.AssertJUnit.assertEquals;\r
-import static org.testng.AssertJUnit.assertFalse;\r
-import static org.testng.AssertJUnit.assertTrue;\r
-import static org.testng.AssertJUnit.fail;\r
-\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.JAXBException;\r
-import javax.xml.bind.ValidationException;\r
-\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.conf.RunnerConfigMarshaller;\r
-import compbio.runner.msa.Mafft;\r
-\r
-public class RunnerConfigTester {\r
-\r
-       public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "MafftParameters.xml";\r
-\r
-       RunnerConfig<Mafft> rconfig = null;\r
-\r
-       @BeforeMethod\r
-       public void setup() {\r
-               try {\r
-                       rconfig = new RunnerConfig<Mafft>();\r
-                       rconfig.setRunnerClassName(Mafft.class.getName());\r
-                       List<Option<Mafft>> prms = new ArrayList<Option<Mafft>>();\r
-\r
-                       RunnerConfigMarshaller<Mafft> pmarshaller = new RunnerConfigMarshaller<Mafft>(RunnerConfig.class, Parameter.class,\r
-                                       Option.class, ValueConstrain.class);\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test\r
-       public void testValidate() {\r
-               try {\r
-                       rconfig.validate();\r
-               } catch (ValidationException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IllegalStateException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = WrongParameterException.class)\r
-       public void testCreateParameter() throws WrongParameterException {\r
-               Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-               p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID");\r
-               // This attribute is required by strict schema\r
-               p3.setOptionName("--AAMATRIX");\r
-               p3.setRequired(true);\r
-               // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED\r
-               // IN WITHIN POSSIBLE VALUES\r
-               p3.setDefaultValue("pam22");\r
-               String com = p3.toCommand(" ");\r
-               System.out.println("AAAAAAAAAAAAAA!" + com);\r
-       }\r
-\r
-       @Test()\r
-       public void testParameterToCommand() throws WrongParameterException {\r
-               Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-               p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID");\r
-               // This attribute is required by strict schema\r
-               p3.setOptionName("--AAMATRIX");\r
-               p3.setRequired(true);\r
-               // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED\r
-               // IN WITHIN POSSIBLE VALUES\r
-               p3.setDefaultValue("PAM");\r
-               String com = p3.toCommand("=");\r
-               assertTrue(com.startsWith("--AAMATRIX"));\r
-               assertTrue(com.endsWith("PAM"));\r
-               assertTrue(com.contains("="));\r
-               p3.setDefaultValue("ID");\r
-               com = p3.toCommand("=");\r
-               assertFalse(com.endsWith("PAM"));\r
-               assertFalse(com.contains("PAM"));\r
-       }\r
-\r
-       @Test(expectedExceptions = ValidationException.class)\r
-       public void testOptionNoDefaultValidate() throws ValidationException {\r
-               Option<Mafft> p3 = new Option<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-               p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB")));\r
-               p3.setRequired(true);\r
-               // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED\r
-               // IN WITHIN POSSIBLE VALUES\r
-               p3.validate();\r
-       }\r
-\r
-       @Test(expectedExceptions = WrongParameterException.class)\r
-       public void testOptionSetInvalidValue() throws WrongParameterException {\r
-\r
-               Option<Mafft> p3 = new Option<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-               p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB")));\r
-               p3.setRequired(true);\r
-               // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED\r
-               // IN WITHIN POSSIBLE VALUES\r
-               p3.setDefaultValue("AAA");\r
-       }\r
-\r
-       @Test()\r
-       public void testOptionToCommand() {\r
-               try {\r
-                       Option<Mafft> p3 = new Option<Mafft>("Matrix1", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-                       p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-\r
-                       p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB")));\r
-                       p3.setRequired(true);\r
-                       // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED\r
-                       // IN WITHIN POSSIBLE VALUES\r
-                       p3.setDefaultValue("--BBBB");\r
-                       p3.validate();\r
-                       String com = p3.toCommand("=");\r
-                       assertEquals("--BBBB", com);\r
-                       p3.setDefaultValue("--ABMAT");\r
-                       com = p3.toCommand("=");\r
-                       assertEquals("--ABMAT", com);\r
-               } catch (ValidationException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = IllegalStateException.class)\r
-       public void testCreateNumParameterWithoutValidValue() throws MalformedURLException {\r
-               try {\r
-                       Parameter<Mafft> p4 = new Parameter<Mafft>("Matrix", "DNA weight matrix");\r
-                       // This is causing exception is ValidValue constrain is not defined\r
-                       // for\r
-                       // numeric value\r
-                       p4.setDefaultValue("5");\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test()\r
-       public void testCreateParameterWithValidValueConstrain() throws MalformedURLException {\r
-               Parameter<Mafft> p4 = new Parameter<Mafft>("Matrix", "DNA weight matrix");\r
-               ValueConstrain vc = new ValueConstrain();\r
-               vc.setType(ValueConstrain.Type.Float);\r
-               vc.setMin("0");\r
-               vc.setMax("10");\r
-               p4.setValidValue(vc);\r
-               try {\r
-                       p4.setDefaultValue("5");\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = WrongParameterException.class)\r
-       public void testValidateLowerBoundaryConstrainCheck() throws WrongParameterException {\r
-               Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-               // This attribute is required by strict schema\r
-               p3.setOptionName("--AAMATRIX");\r
-               p3.setRequired(true);\r
-\r
-               ValueConstrain vc = new ValueConstrain();\r
-               vc.setType(ValueConstrain.Type.Float);\r
-               vc.setMin("-10.12");\r
-               vc.setMax("0");\r
-               p3.setValidValue(vc);\r
-               // THIS IS CAUSING EXCEPTION\r
-               p3.setDefaultValue("-11.0");\r
-       }\r
-\r
-       @Test(expectedExceptions = WrongParameterException.class)\r
-       public void testValidateUpperBoundaryConstrainCheck() throws WrongParameterException {\r
-               Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-               // TODO publish help on a compbio web site\r
-               p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-               // This attribute is required by strict schema\r
-               p3.setOptionName("--AAMATRIX");\r
-               p3.setRequired(true);\r
-\r
-               ValueConstrain vc = new ValueConstrain();\r
-               vc.setType(ValueConstrain.Type.Float);\r
-               vc.setMin("-10.12");\r
-               vc.setMax("0");\r
-               p3.setValidValue(vc);\r
-               // THIS IS CAUSING EXCEPTION\r
-               p3.setDefaultValue("1");\r
-       }\r
-\r
-       @Test()\r
-       public void testValidateBoundaryConstrainCheck() {\r
-               try {\r
-                       Parameter<Mafft> p3 = new Parameter<Mafft>("Matrix1", "Protein weight matrix");\r
-                       // TODO publish help on a compbio web site\r
-                       p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html");\r
-                       // This attribute is required by strict schema\r
-                       p3.setOptionName("--AAMATRIX");\r
-                       p3.setRequired(true);\r
-\r
-                       ValueConstrain vc = new ValueConstrain();\r
-                       vc.setType(ValueConstrain.Type.Float);\r
-                       vc.setMin("-10.12");\r
-                       p3.setValidValue(vc);\r
-                       // Max value boundary is not defined so 1 is valid\r
-                       p3.setDefaultValue("1");\r
-                       p3.validate();\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ValidationException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(expectedExceptions = ValidationException.class)\r
-       public void testValidateValueConstrain() throws ValidationException {\r
-               ValueConstrain vc = new ValueConstrain();\r
-               vc.setType(ValueConstrain.Type.Float);\r
-               // NO BOUNDARIES DEFINED\r
-               vc.validate();\r
-       }\r
-}\r
diff --git a/testsrc/compbio/stat/collector/ExecutionStatCollectorTester.java b/testsrc/compbio/stat/collector/ExecutionStatCollectorTester.java
deleted file mode 100644 (file)
index b99b36c..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-package compbio.stat.collector;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertFalse;\r
-import static org.testng.Assert.assertTrue;\r
-\r
-import java.io.File;\r
-import java.util.Date;\r
-import java.util.concurrent.Executors;\r
-import java.util.concurrent.ScheduledExecutorService;\r
-import java.util.concurrent.ScheduledFuture;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.stat.collector.JobDirectory;\r
-\r
-public class ExecutionStatCollectorTester {\r
-\r
-       final static String LOCAL_JOBS = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "ljobs";\r
-       final static String CLUSTER_JOBS = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "jobs";\r
-       @Test\r
-       public void testCollectStat() {\r
-               ExecutionStatCollector local_jobs = new ExecutionStatCollector(\r
-                               LOCAL_JOBS, 1);\r
-               ExecutionStatCollector cl_jobs = new ExecutionStatCollector(\r
-                               CLUSTER_JOBS, 24);\r
-               \r
-               // Collect statistics prior to call getStats()!\r
-               local_jobs.collectStatistics();\r
-               cl_jobs.collectStatistics();\r
-               \r
-               StatProcessor local_stats = local_jobs.getStats();\r
-               StatProcessor cl_stats = cl_jobs.getStats();\r
-               \r
-               assertEquals(local_stats.getJobNumber(), 12);\r
-               // ClustalW#1015343425414965 - empty\r
-               assertEquals(local_stats.getIncompleteJobs().size(), 1);\r
-               assertEquals(local_stats.getFailedJobs().size(), 0);\r
-               assertEquals(local_stats.getAbandonedJobs().size(), 1);\r
-\r
-       }\r
-\r
-       @Test\r
-       public void testUpdateStatTester() {\r
-\r
-               ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);\r
-               ScheduledFuture<?> sf = executor.scheduleAtFixedRate(\r
-                               new ExecutionStatCollector(LOCAL_JOBS, 1), 1, 10,\r
-                               TimeUnit.SECONDS);\r
-\r
-               try {\r
-                       Thread.sleep(1000 * 35);\r
-                       executor.shutdown();\r
-                       executor.awaitTermination(300, TimeUnit.SECONDS);\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       /**\r
-        * This test will fail in time as it relies on last access time for file in\r
-        * the filesystem! This OK as it has been tested by then.\r
-        * \r
-        */\r
-       @Test (enabled = false)\r
-       public void testHasTimedOut() {\r
-               ExecutionStatCollector ecol = new ExecutionStatCollector(LOCAL_JOBS, 1);\r
-               File f = new File(LOCAL_JOBS + File.separator\r
-                               + "ClustalW#1015373448154965");\r
-               File timedOut = new File(LOCAL_JOBS + File.separator\r
-                               + "Mafft#7868649707286965");\r
-\r
-               JobDirectory jd = new JobDirectory(f);\r
-               JobDirectory timedOutDir = new JobDirectory(timedOut);\r
-               System.out.println("! " + new Date(f.lastModified()));\r
-\r
-               assertTrue((System.currentTimeMillis() - f.lastModified())\r
-                               / (1000 * 60 * 60) < 1);\r
-               assertFalse((System.currentTimeMillis() - timedOut.lastModified())\r
-                               / (1000 * 60 * 60) < 1);\r
-               assertFalse(ecol.hasTimedOut(jd));\r
-               assertTrue(ecol.hasTimedOut(timedOutDir));\r
-       }\r
-\r
-       @Test\r
-       public void testHasCompleted() {\r
-               ExecutionStatCollector ecol_no_timeout = new ExecutionStatCollector(\r
-                               LOCAL_JOBS, 10000000);\r
-               ExecutionStatCollector ecol = new ExecutionStatCollector(LOCAL_JOBS, 1);\r
-\r
-               File normal = new File(LOCAL_JOBS + File.separator\r
-                               + "ClustalW#100368900075204");\r
-               File finished = new File(LOCAL_JOBS + File.separator\r
-                               + "ClustalW#1015373448154965");\r
-               File cancelled = new File(LOCAL_JOBS + File.separator\r
-                               + "Mafft#7918237850044965");\r
-               File noresult = new File(LOCAL_JOBS + File.separator\r
-                               + "ClustalW#1015343425414965");\r
-\r
-               JobDirectory dnormal = new JobDirectory(normal);\r
-               JobDirectory dfinished = new JobDirectory(finished);\r
-               JobDirectory dcancelled = new JobDirectory(cancelled);\r
-\r
-               JobDirectory dnoresult = new JobDirectory(noresult);\r
-\r
-               assertTrue(ecol.hasCompleted(dnormal));\r
-               assertTrue(ecol.hasCompleted(dfinished));\r
-               assertTrue(ecol.hasCompleted(dcancelled));\r
-\r
-               assertTrue(ecol.hasCompleted(dnoresult));\r
-               assertFalse(ecol_no_timeout.hasCompleted(dnoresult));\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/stat/collector/StatDBTester.java b/testsrc/compbio/stat/collector/StatDBTester.java
deleted file mode 100644 (file)
index 85bc81d..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-package compbio.stat.collector;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-\r
-import java.sql.SQLException;\r
-import java.sql.Timestamp;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.List;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.BeforeClass;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.stat.servlet.util.StatCollection;\r
-import compbio.stat.servlet.util.Totals;\r
-import compbio.ws.client.Services;\r
-\r
-public class StatDBTester {\r
-       StatDB statdb;\r
-       Timestamp from;\r
-       Timestamp to;\r
-       \r
-       @BeforeClass(alwaysRun=true )\r
-       public void init() {\r
-               try {\r
-                       statdb = new StatDB(true);\r
-                       Calendar fromCal = Calendar.getInstance();\r
-                       fromCal.set(2011, 4, 1);\r
-                                               \r
-                       Calendar toCal = Calendar.getInstance();\r
-                       toCal.set(2011, 5, 1);\r
-                       from = new Timestamp(fromCal.getTimeInMillis());\r
-                       to = new Timestamp(toCal.getTimeInMillis());\r
-                       \r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       /*\r
-        * This test fails if run with other tests. This is likely due to the fact that StatDB \r
-        * is initialised with connection to other then the test database from StatCollector class.\r
-        * TODO look at this\r
-        */\r
-       @Test(enabled = false)\r
-       public void testReadYearData() {\r
-               Calendar cal = Calendar.getInstance();\r
-               cal.set(2010, 4, 1);\r
-               try {\r
-                       List<JobStat> jobs = statdb.readData(\r
-                                       new Timestamp(cal.getTimeInMillis()), to, Services.MuscleWS, false);\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 1294);\r
-                       // statdb.shutdownDBServer();\r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-\r
-       /*\r
-        * This test fails if run with other tests. This is likely due to the fact that StatDB \r
-        * is initialised with connection to other then the test database from StatCollector class.\r
-        * TODO look at this\r
-        */\r
-       @Test(enabled =false)\r
-       public void testReadOneMonthData() {\r
-               try {\r
-                       List<JobStat> jobs = statdb.readData(from, to, Services.TcoffeeWS, false);\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 36);\r
-\r
-                       jobs = statdb.readData(from,to, Services.ClustalWS,false);\r
-\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 137);\r
-\r
-                       jobs = statdb.readData(from, to, Services.MafftWS,false);\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 136);\r
-\r
-                       jobs = statdb.readData(from,to, Services.ProbconsWS,false);\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 9);\r
-\r
-                       jobs = statdb.readData(from,to, Services.MuscleWS,false);\r
-                       assertNotNull(jobs);\r
-                       assertEquals(jobs.size(), 63);\r
-\r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       /*\r
-        * This test fails if run with other tests. This is likely due to the fact that StatDB \r
-        * is initialised with connection to other then the test database from StatCollector class.\r
-        * TODO look at this\r
-        */\r
-       @Test(enabled=false)\r
-       public void testGetEarliestRecord() {\r
-               try {\r
-                       Date earliestRec = statdb.getEarliestRecord();\r
-                       \r
-                       assertEquals(1278543600000L, earliestRec.getTime());\r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test(sequential=true)\r
-       public void testVerifyJobsCount() {\r
-\r
-               try {\r
-                       Calendar cal = Calendar.getInstance();\r
-                       cal.add(Calendar.MONTH, -5);\r
-                       Timestamp from = new Timestamp(cal.getTimeInMillis());\r
-                       cal.add(Calendar.MONTH, 1);\r
-                       Timestamp to = new Timestamp(cal.getTimeInMillis());\r
-                       StatCollection sc = StatCollection.newStatCollecton(from, to);\r
-                       Totals t = Totals.sumStats(sc.getAllStat());\r
-\r
-                       //System.out.println(sc.getAllStat());\r
-                       \r
-                       assertEquals(t.getTotal(), statdb.getTotalJobsCount(from, to));\r
-                       assertEquals(t.getAbandoned(), statdb.getAbandonedCount(from, to));\r
-                       assertEquals(t.getCancelled(), statdb.getCancelledCount(from, to));\r
-                       assertEquals(t.getIncomplete(), statdb.getIncompleteCount(from, to));\r
-\r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/testsrc/compbio/stat/collector/TestInputFilter.java b/testsrc/compbio/stat/collector/TestInputFilter.java
deleted file mode 100644 (file)
index 23203e1..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package compbio.stat.collector;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class TestInputFilter {\r
-\r
-       final static String FASTA_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381.fasta";\r
-       final static String ALN_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "TO1381L.aln";\r
-       final static String TEST_FASTA_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "test_input.fasta";\r
-       final static String TEST_ALIGNMENT_INPUT = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                       + "test_input.aln";\r
-       @Test\r
-       public void TestInputFilter() {\r
-               InputFilter ifilter = new InputFilter();\r
-               try {\r
-                       // Makes sure real files are accepted\r
-                       Assert.assertTrue(ifilter.accept(new File(FASTA_INPUT)));\r
-                       Assert.assertTrue(ifilter.accept(new File(ALN_INPUT)));\r
-\r
-                       // .. and test files are not\r
-                       Assert.assertFalse(ifilter.accept(new File(TEST_ALIGNMENT_INPUT)));\r
-                       Assert.assertFalse(ifilter.accept(new File(TEST_FASTA_INPUT)));\r
-                       // does not matter if the file is empty, it is still not a test\r
-                       // file!\r
-                       Assert.assertTrue(ifilter.accept(File.createTempFile("aaa", "bbb")));\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/stat/servlet/util/StatCollectionTester.java b/testsrc/compbio/stat/servlet/util/StatCollectionTester.java
deleted file mode 100644 (file)
index 830ce05..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package compbio.stat.servlet.util;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.GregorianCalendar;\r
-import java.util.Map;\r
-\r
-import org.testng.Assert;\r
-import org.testng.annotations.Test;\r
-\r
-public class StatCollectionTester {\r
-\r
-       @Test\r
-       public void testGetStats() {\r
-               Map<Date, Totals> stats;\r
-               Calendar cal = GregorianCalendar.getInstance();\r
-               cal.add(Calendar.MONTH, -3);\r
-\r
-               try {\r
-                       stats = StatCollection.getStats(cal.getTime());\r
-\r
-               } catch (SQLException e) {\r
-                       e.printStackTrace();\r
-                       Assert.fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/ws/client/AAConWSClientExample.java b/testsrc/compbio/ws/client/AAConWSClientExample.java
deleted file mode 100644 (file)
index 23eaf36..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-package compbio.ws.client;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.io.Writer;\r
-import java.util.List;\r
-\r
-import compbio.data.msa.SequenceAnnotation;\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.ScoreManager;\r
-import compbio.data.sequence.SequenceUtil;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.Preset;\r
-import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.UnsupportedRuntimeException;\r
-import compbio.metadata.WrongParameterException;\r
-import compbio.runner.conservation.AACon;\r
-\r
-/**\r
- * AAConWS client example\r
- */\r
-public class AAConWSClientExample {\r
-\r
-       /*\r
-        * Input sequences. For the simplicity keep them in the class\r
-        */\r
-       static final String input = ">Foo      \r\n"\r
-                       + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAV\r\n"\r
-                       + "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQL\r\n"\r
-                       + "LPEEPYITAQLLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLAC\r\n"\r
-                       + "ARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQM\r\n"\r
-                       + "HLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEV\r\n"\r
-                       + "FALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSR\r\n"\r
-                       + "VVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADA\r\n"\r
-                       + "RLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVL\r\n"\r
-                       + "TTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRES\r\n"\r
-                       + "GVFEMDGFADDFGALLQALARRHGWLGI\r\n"\r
-                       + "\r\n"\r
-                       + ">Bar                    \r\n"\r
-                       + "-----------------------------------MGDTTAGEMAVQRGLALH-------\r\n"\r
-                       + "---------QQRHAEAAVLLQQASDAAPEHPGIALWL-HALEDAGQAEAAAA-YTRAHQL\r\n"\r
-                       + "LPEEPYITAQLLN--------------------AVAQGVGAVEPFAFLSEDASAAE----\r\n"\r
-                       + "----------SVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQM\r\n"\r
-                       + "HLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEV\r\n"\r
-                       + "FALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSR\r\n"\r
-                       + "VVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADA\r\n"\r
-                       + "RLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVL\r\n"\r
-                       + "TTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRES\r\n"\r
-                       + "GVFEMDGFADDFGALLQALARRHGWLGI\r\n"\r
-                       + "\r\n"\r
-                       + ">Noname             \r\n"\r
-                       + "-MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAV\r\n"\r
-                       + "ARLGRVRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALED--------------HQL\r\n"\r
-                       + "LPEEPYITAQLDVLSAQVR-------------AAVAQGVGAVEPFAFLSEDASAAEQLAC\r\n"\r
-                       + "ARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQM\r\n"\r
-                       + "HLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEV\r\n"\r
-                       + "FALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSR\r\n"\r
-                       + "VVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEADA\r\n"\r
-                       + "RLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVL\r\n"\r
-                       + "TTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRES\r\n"\r
-                       + "I---------------------------";\r
-\r
-       public static void main(String[] args) throws UnsupportedRuntimeException,\r
-                       JobSubmissionException, WrongParameterException,\r
-                       FileNotFoundException, IOException, ResultNotAvailableException,\r
-                       InterruptedException {\r
-\r
-               /*\r
-                * Annotation interface for AAConWS web service instance\r
-                */\r
-               SequenceAnnotation<AACon> client = (SequenceAnnotation<AACon>) Jws2Client\r
-                               .connect("http://www.compbio.dundee.ac.uk/aacon",\r
-                                               Services.AAConWS);\r
-\r
-               /* Get the list of available presets */\r
-               PresetManager presetman = client.getPresets();\r
-\r
-               /* Get the Preset object by preset name */\r
-               Preset preset = presetman.getPresetByName("Complete conservation");\r
-\r
-               /*\r
-                * Load sequences in FASTA format from the file You can use something\r
-                * like new FileInputStream() to load sequence from the file\r
-                */\r
-               List<FastaSequence> fastalist = SequenceUtil\r
-                               .readFasta(new ByteArrayInputStream(input.getBytes()));\r
-\r
-               /*\r
-                * Submit loaded sequences for an alignment using preset. The job\r
-                * identifier is returned by this method, you can retrieve the results\r
-                * with it sometime later.\r
-                */\r
-               String jobId = client.presetAnalize(fastalist, preset);\r
-\r
-               /* This method will block for the duration of the calculation */\r
-               ScoreManager result = client.getAnnotation(jobId);\r
-\r
-               /*\r
-                * This is a better way of obtaining results, it does not involve\r
-                * holding the connection open for the duration of the calculation,\r
-                * Besides, as the University of Dundee public server will reset the\r
-                * connection after 10 minutes of idling, this is the only way to obtain\r
-                * the results of long running task from our public server.\r
-                */\r
-               // while (client.getJobStatus(jobId) != JobStatus.FINISHED) {\r
-               // Thread.sleep(1000); // wait a second, then recheck the status\r
-               // }\r
-\r
-               /* Output the alignment to standard out */\r
-               Writer writer = new PrintWriter(System.out, true);\r
-               IOHelper.writeOut(writer, result);\r
-               writer.close();\r
-               // Score.write(result, System.out);\r
-\r
-               /* Alternatively, you can record retrieved alignment into the file */\r
-               // FileOutputStream out = new FileOutputStream("result.txt");\r
-               // Score.write(result, out);\r
-               // out.close();\r
-       }\r
-}\r
diff --git a/testsrc/compbio/ws/client/TestAAConWS.java b/testsrc/compbio/ws/client/TestAAConWS.java
deleted file mode 100644 (file)
index d54e67f..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-package compbio.ws.client;\r
-\r
-import static org.testng.Assert.assertEquals;\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.fail;\r
-import static org.testng.Assert.assertTrue;\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.net.ConnectException;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.xml.ws.WebServiceException;\r
-\r
-import org.testng.annotations.BeforeTest;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.msa.JABAService;\r
-import compbio.data.msa.SequenceAnnotation;\r
-import compbio.data.sequence.ConservationMethod;\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.ScoreManager;\r
-import compbio.data.sequence.SequenceUtil;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.LimitExceededException;\r
-import compbio.metadata.Option;\r
-import compbio.metadata.Preset;\r
-import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.metadata.UnsupportedRuntimeException;\r
-import compbio.metadata.WrongParameterException;\r
-import compbio.runner.conservation.AACon;\r
-import compbio.util.SysPrefs;\r
-\r
-public class TestAAConWS {\r
-\r
-       SequenceAnnotation<AACon> msaws;\r
-\r
-       @BeforeTest(groups = {AllTestSuit.test_group_webservices})\r
-       void initConnection() {\r
-               /*\r
-                * URL url = null; try { url = new\r
-                * URL("http://localhost:8080/jabaws/AAConWS?wsdl"); } catch\r
-                * (MalformedURLException e) { e.printStackTrace();\r
-                * fail(e.getLocalizedMessage()); } String namespace =\r
-                * "http://msa.data.compbio/01/12/2010/"; QName qname = new\r
-                * QName(namespace, "AAConWS"); Service serv = Service.create(url,\r
-                * qname); msaws = serv.getPort(new QName(namespace, "AAConWSPort"),\r
-                * Annotation.class);\r
-                */try {\r
-                       JABAService client = Jws2Client.connect(\r
-                                       "http://localhost:8080/jabaws", Services.AAConWS);\r
-                       msaws = (SequenceAnnotation<AACon>) client;\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testAnalize() throws FileNotFoundException, IOException {\r
-\r
-               /*\r
-                * MsaWS msaws = serv.getPort(new QName(\r
-                * "http://msa.data.compbio/01/01/2010/", "ClustalWSPort"),\r
-                * MsaWS.class);\r
-                */\r
-               // Annotation<AACon> msaws = serv.getPort(new QName(namespace,\r
-               // "ClustalWSPort"), Annotation.class);\r
-\r
-               // List<FastaSequence> fsl = SequenceUtil.readFasta(new FileInputStream(\r
-               // AAConTester.test_alignment_input));\r
-\r
-               String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory()\r
-                               + File.separator;\r
-\r
-               List<FastaSequence> fsl = SequenceUtil.readFasta(new FileInputStream(\r
-                               CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata"\r
-                                               + File.separator + "TO1381.fasta.aln"));\r
-\r
-               try {\r
-                       System.out.println("Pres: " + msaws.getPresets().getPresets());\r
-                       String jobId = msaws.analize(fsl);\r
-                       System.out.println("J: " + jobId);\r
-                       ScoreManager result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 1);\r
-\r
-                       assertEquals(result.asSet().iterator().next().getMethod(),\r
-                                       ConservationMethod.SHENKIN.toString());\r
-                       List<Float> scores = result.asSet().iterator().next().getScores();\r
-                       assertNotNull(scores);\r
-                       assertEquals(scores.size(), 568);\r
-\r
-                       // Using presets\r
-                       PresetManager<AACon> presets = msaws.getPresets();\r
-                       jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Quick conservation"));\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 13);\r
-\r
-                       jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Slow conservation"));\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 5);\r
-\r
-                       jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Complete conservation"));\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 18);\r
-\r
-               } catch (UnsupportedRuntimeException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (LimitExceededException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testRecoverArgsForPreset() throws Exception {\r
-               PresetManager<AACon> presets = msaws.getPresets();\r
-               for (Preset<AACon> preset:presets.getPresets())\r
-               {\r
-                       List<Option<AACon>> args = preset.getArguments(msaws.getRunnerOptions());\r
-                       List opts = preset.getOptions();\r
-                       assertTrue(args.size()>=opts.size(),"Couldn't recover all Option items for preset "+preset.getName());\r
-               }\r
-       }\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testPresetAnalize() throws FileNotFoundException, IOException {\r
-\r
-               String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory()\r
-                               + File.separator;\r
-\r
-               List<FastaSequence> fsl = SequenceUtil.readFasta(new FileInputStream(\r
-                               CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata"\r
-                                               + File.separator + "TO1381.fasta.aln"));\r
-\r
-               try {\r
-                       System.out.println("Pres: " + msaws.getPresets().getPresets());\r
-\r
-                       // Using presets\r
-                       PresetManager<AACon> presets = msaws.getPresets();\r
-                       String jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Quick conservation"));\r
-                       ScoreManager result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 13);\r
-\r
-                       jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Slow conservation"));\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 5);\r
-\r
-                       jobId = msaws.presetAnalize(fsl,\r
-                                       presets.getPresetByName("Complete conservation"));\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 18);\r
-\r
-               } catch (UnsupportedRuntimeException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (LimitExceededException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testCustomAnalize() throws FileNotFoundException, IOException {\r
-\r
-               String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory()\r
-                               + File.separator;\r
-\r
-               List<FastaSequence> fsl = SequenceUtil.readFasta(new FileInputStream(\r
-                               CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata"\r
-                                               + File.separator + "TO1381.fasta.aln"));\r
-\r
-               // Using options\r
-               RunnerConfig<AACon> options = msaws.getRunnerOptions();\r
-               // System.out.println(options.getArguments());\r
-\r
-               try {\r
-                       List<Option<AACon>> args = new ArrayList<Option<AACon>>();\r
-                       Option<AACon> arg,normarg;\r
-                       args.add(arg=options.getArgument("SMERFS"));\r
-                       args.add(normarg=options.getArgument("Normalize"));\r
-                       arg.setValue(arg.getPossibleValues().get(0));\r
-                       // options.getArgument("SMERFS Column Scoring Method")\r
-                       // .setDefaultValue("MAX_SCORE");\r
-                       // options.getArgument("SMERFS Gap Threshhold").setDefaultValue("1");\r
-                       String jobId = msaws.customAnalize(fsl, args);\r
-                       ScoreManager result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 1);\r
-                       assertEquals(result.asSet().iterator().next().getScores().get(0),\r
-                                       0.698f);\r
-                       args.remove(normarg); // remove normalization argument\r
-                       // System.out.println(options);\r
-                       jobId = msaws.customAnalize(fsl, args);\r
-                       result = msaws.getAnnotation(jobId);\r
-                       assertNotNull(result);\r
-                       assertEquals(result.asSet().size(), 1);\r
-                       assertEquals(result.asSet().iterator().next().getScores().get(0),\r
-                                       0.401f);\r
-\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (UnsupportedRuntimeException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (LimitExceededException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-}\r
diff --git a/testsrc/compbio/ws/client/TestIUPredWS.java b/testsrc/compbio/ws/client/TestIUPredWS.java
deleted file mode 100644 (file)
index 158b9ae..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-package compbio.ws.client;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.fail;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.ConnectException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.ws.WebServiceException;
-
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import compbio.data.msa.JABAService;
-import compbio.data.msa.SequenceAnnotation;
-import compbio.data.sequence.ConservationMethod;
-import compbio.data.sequence.FastaSequence;
-import compbio.data.sequence.ScoreManager;
-import compbio.data.sequence.SequenceUtil;
-import compbio.metadata.AllTestSuit;
-import compbio.metadata.JobSubmissionException;
-import compbio.metadata.LimitExceededException;
-import compbio.metadata.Option;
-import compbio.metadata.PresetManager;
-import compbio.metadata.ResultNotAvailableException;
-import compbio.metadata.RunnerConfig;
-import compbio.metadata.UnsupportedRuntimeException;
-import compbio.metadata.WrongParameterException;
-import compbio.runner.conservation.AACon;
-import compbio.util.SysPrefs;
-import compbio.ws.server.IUPredWS;
-
-public class TestIUPredWS {
-
-       SequenceAnnotation<IUPredWS> msaws;
-
-       @BeforeTest(groups = {AllTestSuit.test_group_webservices})
-       void initConnection() {
-               /*
-                * URL url = null; try { url = new
-                * URL("http://localhost:8080/jabaws/AAConWS?wsdl"); } catch
-                * (MalformedURLException e) { e.printStackTrace();
-                * fail(e.getLocalizedMessage()); } String namespace =
-                * "http://msa.data.compbio/01/12/2010/"; QName qname = new
-                * QName(namespace, "AAConWS"); Service serv = Service.create(url,
-                * qname); msaws = serv.getPort(new QName(namespace, "AAConWSPort"),
-                * Annotation.class);
-                */try {
-                       JABAService client = Jws2Client.connect(
-                                       "http://localhost:8080/jabaws", Services.IUPredWS);
-                       msaws = (SequenceAnnotation<IUPredWS>) client;
-               } catch (ConnectException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (WebServiceException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               }
-       }
-
-       @Test(groups = {AllTestSuit.test_group_webservices})
-       public void testCustomAnalize() throws FileNotFoundException, IOException {
-
-               String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory()
-                               + File.separator;
-
-               List<FastaSequence> fsl = SequenceUtil.readFasta(new FileInputStream(
-                               CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata"
-                                               + File.separator + "TO1381.fasta"));
-
-               try {
-                       List<Option<IUPredWS>> opts=new ArrayList<Option<IUPredWS>>();
-                       opts.add(msaws.getRunnerOptions().getArgumentByOptionName("Long"));
-                       String jobId = msaws.customAnalize(fsl,opts);
-                       System.out.println("J: " + jobId);
-                       ScoreManager result = msaws.getAnnotation(jobId);
-                       assertNotNull(result);
-//                     assertEquals(result.asSet().size(), 1);
-
-               } catch (UnsupportedRuntimeException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (LimitExceededException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (JobSubmissionException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (ResultNotAvailableException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (WrongParameterException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               }
-
-       }
-}
diff --git a/testsrc/compbio/ws/client/TestRNAalifoldWS.java b/testsrc/compbio/ws/client/TestRNAalifoldWS.java
deleted file mode 100644 (file)
index cafe9cb..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-       package compbio.ws.client;
-
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.fail;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.ConnectException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.ws.WebServiceException;
-
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import compbio.data.msa.JABAService;
-import compbio.data.msa.SequenceAnnotation;
-import compbio.data.sequence.Alignment;
-import compbio.data.sequence.ClustalAlignmentUtil;
-import compbio.data.sequence.FastaSequence;
-import compbio.data.sequence.RNAStructScoreManager;
-import compbio.data.sequence.UnknownFileFormatException;
-import compbio.metadata.AllTestSuit;
-import compbio.metadata.JobSubmissionException;
-import compbio.metadata.LimitExceededException;
-import compbio.metadata.Option;
-import compbio.metadata.ResultNotAvailableException;
-import compbio.metadata.UnsupportedRuntimeException;
-import compbio.metadata.WrongParameterException;
-import compbio.ws.server.RNAalifoldWS;
-
-
-public class TestRNAalifoldWS {
-       
-       SequenceAnnotation<RNAalifoldWS> foldws;
-//     RNAalifoldWS foldws;
-       
-       @BeforeTest(groups = {AllTestSuit.test_group_webservices})
-       void initConnection() {
-               
-               try {
-                       JABAService client = Jws2Client.connect(
-                                       "http://localhost:8080/jabaws", Services.RNAalifoldWS);
-//                     foldws = (RNAalifoldWS) client;
-                       foldws = (SequenceAnnotation<RNAalifoldWS>) client;
-               } catch (ConnectException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (WebServiceException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               }
-       }
-
-       
-       @Test(groups = {AllTestSuit.test_group_webservices})
-       public void testFold() throws FileNotFoundException, IOException,
-                       UnknownFileFormatException {
-               
-               Alignment aln = ClustalAlignmentUtil.readClustalFile(new FileInputStream(
-                               AllTestSuit.test_input_aln));
-               
-               List<FastaSequence> fsl = aln.getSequences();
-               
-               try {
-                       List<Option<RNAalifoldWS>> options  = new ArrayList<Option<RNAalifoldWS>>();
-                       options.add(foldws.getRunnerOptions().getArgumentByOptionName("--mis"));
-                       options.add(foldws.getRunnerOptions().getArgumentByOptionName("-p"));
-                       options.add(foldws.getRunnerOptions().getArgumentByOptionName("--MEA"));
-                       
-                       System.out.println("TestRNAalifoldWS: print options: " + options.toString());
-                       
-                       String jobId = foldws.customAnalize(fsl, options);
-                       System.out.println("J: " + jobId);
-                       RNAStructScoreManager result = (RNAStructScoreManager)foldws.getAnnotation(jobId);
-
-                       Writer writer = new OutputStreamWriter(System.out);
-                       result.writeOut(writer);
-                       
-                       assertNotNull(result);
-                       
-               } catch (UnsupportedRuntimeException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (LimitExceededException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (JobSubmissionException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (ResultNotAvailableException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               } catch (WrongParameterException e) {
-                       e.printStackTrace();
-                       fail(e.getMessage());
-               }
-       }
-}
-       
-
-
diff --git a/testsrc/compbio/ws/client/WSTesterTester.java b/testsrc/compbio/ws/client/WSTesterTester.java
deleted file mode 100644 (file)
index 3671e1b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-package compbio.ws.client;\r
-\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.PrintWriter;\r
-import java.net.ConnectException;\r
-import javax.xml.ws.WebServiceException;\r
-import org.testng.annotations.Test;\r
-import compbio.metadata.AllTestSuit;\r
-\r
-public class WSTesterTester {\r
-\r
-       public static final String SERVER = "http://localhost:8080/jabaws";\r
-       // public static final String SERVER = "http://192.168.202.130/jabaws";\r
-\r
-       // public static final String SERVER =\r
-       // "http://nanna.cluster.lifesci.dundee.ac.uk:8080/jaba";\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testAllWindowsWS() {\r
-               WSTester tester = new WSTester(SERVER,\r
-                               new PrintWriter(System.out, true));\r
-               try {\r
-                       assertTrue(tester.checkService(Services.AAConWS));\r
-                       assertTrue(tester.checkService(Services.JronnWS));\r
-                       assertTrue(tester.checkService(Services.ClustalWS));\r
-                       assertTrue(tester.checkService(Services.MuscleWS));\r
-                       assertTrue(tester.checkService(Services.ClustalOWS));\r
-                       assertTrue(tester.checkService(Services.IUPredWS));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-\r
-               // Will throw UnsupportedRuntimeException on windows\r
-               // ws = Jws2Client.connect(SERVER, Services.MafftWS);\r
-               // assertTrue(tester.checkService(ws));\r
-\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testAllWS() {\r
-               WSTester tester = new WSTester(SERVER, new PrintWriter(System.out));\r
-               try {\r
-                       for (Services service : Services.values()) {\r
-                               assertTrue(tester.checkService(service));\r
-                       }\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-       }\r
-\r
-}\r
diff --git a/testsrc/compbio/ws/server/RegistryWSTester.java b/testsrc/compbio/ws/server/RegistryWSTester.java
deleted file mode 100644 (file)
index 34f7b6c..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-package compbio.ws.server;\r
-\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.assertTrue;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.io.IOException;\r
-import java.net.ConnectException;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-import java.util.Set;\r
-\r
-import javax.xml.ws.WebServiceException;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.data.msa.MsaWS;\r
-import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.SequenceUtil;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.ChunkHolder;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.ws.client.Jws2Client;\r
-import compbio.ws.client.Services;\r
-import compbio.ws.client.WSTesterTester;\r
-\r
-public class RegistryWSTester {\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices,\r
-                       AllTestSuit.test_group_windows_only})\r
-       public void testGetSupportedServices() {\r
-               try {\r
-                       compbio.data.msa.RegistryWS reg = Jws2Client\r
-                                       .connectToRegistry(WSTesterTester.SERVER);\r
-                       System.out.println(reg.getSupportedServices());\r
-                       Set<Services> supserv = reg.getSupportedServices();\r
-                       assertTrue(supserv.containsAll(Arrays.asList(new Services[]{\r
-                                       Services.AAConWS, Services.ClustalOWS, Services.IUPredWS,\r
-                                       Services.MuscleWS, Services.ClustalWS, Services.JronnWS})));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testTestService() {\r
-               compbio.data.msa.RegistryWS reg = null;\r
-               try {\r
-                       reg = Jws2Client.connectToRegistry(WSTesterTester.SERVER);\r
-                       assertNotNull(reg.testService(Services.AAConWS));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(dependsOnMethods = {"testTestService"}, groups = {AllTestSuit.test_group_webservices})\r
-       public void testIsOperating() {\r
-               try {\r
-                       compbio.data.msa.RegistryWS reg = Jws2Client\r
-                                       .connectToRegistry(WSTesterTester.SERVER);\r
-                       assertTrue(reg.isOperating(Services.AAConWS));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(dependsOnMethods = {"testTestService"}, groups = {AllTestSuit.test_group_webservices})\r
-       public void testGetLastTestedOn() {\r
-               try {\r
-                       compbio.data.msa.RegistryWS reg = Jws2Client\r
-                                       .connectToRegistry(WSTesterTester.SERVER);\r
-                       assertNotNull(reg.getLastTestedOn(Services.AAConWS));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(dependsOnMethods = {"testTestService"}, groups = {AllTestSuit.test_group_webservices})\r
-       public void testGetLastTested() {\r
-               try {\r
-                       Thread.sleep(1000);\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getMessage());\r
-               }\r
-               try {\r
-                       compbio.data.msa.RegistryWS reg = Jws2Client\r
-                                       .connectToRegistry(WSTesterTester.SERVER);\r
-                       System.out.println(reg.getLastTested(Services.AAConWS));\r
-                       assertTrue(reg.getLastTested(Services.AAConWS) > 0);\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testTestAllServices() {\r
-               try {\r
-                       compbio.data.msa.RegistryWS reg = Jws2Client\r
-                                       .connectToRegistry(WSTesterTester.SERVER);\r
-                       System.out.println(reg.testAllServices());\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testProgressReporting() {\r
-               MsaWS service = null;\r
-               try {\r
-                       service = (MsaWS) Jws2Client.connect(\r
-                                       "http://www.compbio.dundee.ac.uk/jabaws",\r
-                                       // "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jabaws",\r
-                                       Services.ProbconsWS);\r
-                       File input = new File(AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
-                                       + "200x500Protein.fasta");\r
-                       assertTrue(input.exists());\r
-                       List<FastaSequence> fs = SequenceUtil\r
-                                       .readFasta(new FileInputStream(input));\r
-                       String jobId = service.align(fs);\r
-                       Thread.sleep(5000);\r
-                       ChunkHolder pos = null;\r
-                       while (service.getJobStatus(jobId) == JobStatus.RUNNING) {\r
-                               if (pos == null) {\r
-                                       pos = service.pullExecStatistics(jobId, 0);\r
-                               } else {\r
-                                       pos = service.pullExecStatistics(jobId,\r
-                                                       pos.getNextPosition());\r
-                               }\r
-                               Thread.sleep(10);\r
-                               System.out.print(pos.getChunk());\r
-                       }\r
-                       System.out.println();\r
-                       System.out.println(service.getResult(jobId));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IOException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = {AllTestSuit.test_group_webservices})\r
-       public void testPullRunningJob() {\r
-               MsaWS service = null;\r
-               try {\r
-                       service = (MsaWS) Jws2Client.connect(\r
-                                       "http://webserv1.cluster.lifesci.dundee.ac.uk:8089/jabaws",\r
-                                       Services.ProbconsWS);\r
-                       String jobId = "@Probcons#158079030012566";\r
-                       ChunkHolder pos = null;\r
-                       while (service.getJobStatus(jobId) == JobStatus.RUNNING) {\r
-                               if (pos == null) {\r
-                                       pos = service.pullExecStatistics(jobId, 0);\r
-                               } else {\r
-                                       pos = service.pullExecStatistics(jobId,\r
-                                                       pos.getNextPosition());\r
-                               }\r
-                               Thread.sleep(10);\r
-                               System.out.print(pos.getChunk());\r
-                       }\r
-                       System.out.println();\r
-                       System.out.println(service.getResult(jobId));\r
-               } catch (ConnectException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (WebServiceException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (InterruptedException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-}\r