+++ /dev/null
-/* 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.runner._impl;\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.engine.cluster.drmaa.ClusterUtil;\r
-import compbio.engine.cluster.drmaa.JobRunner;\r
-import compbio.engine.cluster.drmaa.StatisticManager;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobExecutionException;\r
-import compbio.metadata.JobStatus;\r
-import compbio.metadata.JobSubmissionException;\r
-\r
-/**\r
- * TODO this needs fixing! Executable does not work\r
- * \r
- * @author pvtroshin\r
- * \r
- */\r
-public class OBTester {\r
-\r
- public static String test_input = "/homes/pvtroshin/TO1381.fasta";\r
- public static String test_outfile = "/homes/pvtroshin/TO1381.OB.out";\r
-\r
- @Test\r
- public void testGetTestCommand() {\r
- System.out.println(OB.getTestCommand());\r
- }\r
-\r
- @Test\r
- public void testGetTestArgsCommand() {\r
- System.out.println(new OB().getTestArgs());\r
- }\r
-\r
- @Test(enabled = false, groups = { AllTestSuit.test_group_cluster,\r
- AllTestSuit.test_group_runner })\r
- public void testBuildCommand() {\r
- OB ob = new OB(AllTestSuit.OUTPUT_DIR_ABSOLUTE);\r
- // TODO ob.setInput(test_input).setOutput(test_outfile);\r
- // ob.setParameters(ob.getTestArgs());\r
-\r
- try {\r
- JobRunner runner = JobRunner.getInstance(null);\r
- assertNotNull("Runner is NULL", runner);\r
- runner.executeJob();\r
- // assertNotNull("Job id is null", jobId1);\r
- JobStatus status = runner.getJobStatus();\r
- assertTrue("Status is not queing but " + status,\r
- status == JobStatus.PENDING || status == JobStatus.RUNNING);\r
- JobInfo info = runner.getJobInfo();\r
- assertNotNull("JobInfo is null", info);\r
- StatisticManager sm = new StatisticManager(info);\r
- assertNotNull("Stat manager is null", sm);\r
- try {\r
- String time_s = sm.getCalculationTime();\r
- assertNotNull("Time is null", time_s);\r
- float time = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(time_s)\r
- .floatValue();\r
- String exits = sm.getExitStatus();\r
- assertNotNull("Exit status is null", exits);\r
- int exitsInt = ClusterUtil.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.getLocalizedMessage());\r
- }\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
- } catch (DrmaaException e) {\r
- e.printStackTrace();\r
- fail("Drmaa exception: " + e.getLocalizedMessage());\r
- } catch (JobSubmissionException e) {\r
- e.printStackTrace();\r
- fail("JobSubmission failure: " + e.getLocalizedMessage());\r
- } catch (JobExecutionException e) {\r
- e.printStackTrace();\r
- fail("JobSubmission failure: " + e.getLocalizedMessage());\r
- }\r
- }\r
-}\r