1 /* Copyright (c) 2009 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
18 package compbio.runner._impl;
\r
20 import static org.testng.AssertJUnit.assertFalse;
\r
21 import static org.testng.AssertJUnit.assertNotNull;
\r
22 import static org.testng.AssertJUnit.assertTrue;
\r
23 import static org.testng.AssertJUnit.fail;
\r
25 import java.text.ParseException;
\r
27 import org.ggf.drmaa.DrmaaException;
\r
28 import org.ggf.drmaa.JobInfo;
\r
29 import org.testng.annotations.Test;
\r
31 import compbio.engine.cluster.drmaa.ClusterUtil;
\r
32 import compbio.engine.cluster.drmaa.JobRunner;
\r
33 import compbio.engine.cluster.drmaa.StatisticManager;
\r
34 import compbio.metadata.AllTestSuit;
\r
35 import compbio.metadata.JobExecutionException;
\r
36 import compbio.metadata.JobStatus;
\r
37 import compbio.metadata.JobSubmissionException;
\r
39 public class RonnTester {
\r
41 public static String test_input = "/homes/pvtroshin/one_prot";
\r
42 public static String test_outfile = "/homes/pvtroshin/TO1381.ronn.out";
\r
43 public static String test_outDir = "/homes/pvtroshin/RONN";
\r
46 public void testGetTestCommand() {
\r
47 System.out.println(Ronn.getTestCommand());
\r
50 @Test(enabled = false, groups = { AllTestSuit.test_group_cluster,
\r
51 AllTestSuit.test_group_runner })
\r
52 public void testBuildCommand() {
\r
53 Ronn ronn = new Ronn(AllTestSuit.OUTPUT_DIR_ABSOLUTE);
\r
54 // TODO ronn.setInput(test_input).setOutput(test_outfile);
\r
55 // ronn.setParameters(new ArrayList<String>());
\r
58 JobRunner runner = JobRunner.getInstance(null);
\r
59 assertNotNull("Runner is NULL", runner);
\r
60 // runner.setWorkDirectory(test_outDir);
\r
61 runner.executeJob();
\r
62 // assertNotNull(jobId1);
\r
63 JobStatus status = runner.getJobStatus();
\r
64 assertTrue(status == JobStatus.PENDING
\r
65 || status == JobStatus.RUNNING);
\r
66 JobInfo info = runner.getJobInfo();
\r
67 assertNotNull(info);
\r
68 StatisticManager sm = new StatisticManager(info);
\r
71 String time_s = sm.getCalculationTime();
\r
72 assertNotNull(time_s);
\r
73 float time = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(time_s)
\r
75 assertTrue(time > 0);
\r
76 String exits = sm.getExitStatus();
\r
77 assertNotNull(exits);
\r
78 int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)
\r
80 // assertEquals(0, exitsInt);
\r
81 System.out.println(sm.getAllStats());
\r
83 } catch (ParseException e) {
\r
84 e.printStackTrace();
\r
85 fail("Parse Exception: " + e.getLocalizedMessage());
\r
88 assertTrue(sm.hasExited());
\r
89 assertFalse(sm.wasAborted());
\r
90 assertFalse(sm.hasDump());
\r
91 assertFalse(sm.hasSignaled());
\r
93 } catch (DrmaaException e) {
\r
94 e.printStackTrace();
\r
95 fail(e.getLocalizedMessage());
\r
96 } catch (JobSubmissionException e) {
\r
97 e.printStackTrace();
\r
98 fail(e.getLocalizedMessage());
\r
99 } catch (JobExecutionException e) {
\r
100 e.printStackTrace();
\r
101 fail(e.getLocalizedMessage());
\r