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 NetNglycTester {
\r
41 public static String test_input = "/homes/pvtroshin/TO1381.fasta";
\r
42 public static String test_outfile = "/homes/pvtroshin/TO1381.netNGlycout";
\r
45 public void testGetTestCommand() {
\r
46 assertNotNull(Tmhmm2.getTestCommand());
\r
49 @Test(enabled = false, groups = { AllTestSuit.test_group_cluster,
\r
50 AllTestSuit.test_group_runner })
\r
51 public void testBuildCommand() {
\r
52 NetNglyc netnGlyc = new NetNglyc();
\r
53 // TODO netnGlyc.setInput(test_input).setOutput(test_outfile);
\r
56 JobRunner runner = JobRunner.getInstance(null);
\r
57 assertNotNull("Runner is NULL", runner);
\r
58 runner.executeJob();
\r
59 assertNotNull("JobId is NULL");
\r
60 JobStatus status = runner.getJobStatus();
\r
61 assertTrue("Status of the job is wrong!",
\r
62 status == JobStatus.PENDING || status == JobStatus.RUNNING);
\r
63 JobInfo info = runner.getJobInfo();
\r
64 assertNotNull("Cannot Obtain Job Info", info);
\r
65 StatisticManager sm = new StatisticManager(info);
\r
66 assertNotNull("StatisticManager is NULL", sm);
\r
68 String exits = sm.getExitStatus();
\r
69 assertNotNull("Status is NULL", exits);
\r
70 int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits)
\r
72 assertTrue("Time elapsed is greater than 0", exitsInt >= 0);
\r
73 System.out.println(sm.getAllStats());
\r
75 assertTrue("Process exited:", sm.hasExited());
\r
76 assertFalse("Process aborted:", sm.wasAborted());
\r
77 assertFalse("Process hasdump:", sm.hasDump());
\r
78 assertFalse("Process signaled:", sm.hasSignaled());
\r
80 } catch (DrmaaException e) {
\r
81 e.printStackTrace();
\r
82 fail(e.getLocalizedMessage());
\r
83 } catch (ParseException e) {
\r
84 e.printStackTrace();
\r
85 fail(e.getLocalizedMessage());
\r
86 } catch (JobSubmissionException e) {
\r
87 e.printStackTrace();
\r
88 fail(e.getLocalizedMessage());
\r
89 } catch (JobExecutionException e) {
\r
90 e.printStackTrace();
\r
91 fail(e.getLocalizedMessage());
\r