+++ /dev/null
-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