/* Copyright (c) 2009 Peter Troshin * * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache * License for more details. * * A copy of the license is in apache_license.txt. It is also available here: * @see: http://www.apache.org/licenses/LICENSE-2.0.txt * * Any republication or derived work distributed in source code form * must include this copyright and license notice. */ package compbio.runner._impl; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.assertTrue; import static org.testng.AssertJUnit.fail; import java.text.ParseException; import org.ggf.drmaa.DrmaaException; import org.ggf.drmaa.JobInfo; import org.testng.annotations.Test; import compbio.engine.cluster.drmaa.ClusterUtil; import compbio.engine.cluster.drmaa.JobRunner; import compbio.engine.cluster.drmaa.StatisticManager; import compbio.metadata.AllTestSuit; import compbio.metadata.JobExecutionException; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; public class Tmhmm2Tester { public static String test_input = "/homes/pvtroshin/TO1381.fasta"; public static String test_outfile = "/homes/pvtroshin/TO1381.tmhmm2.out"; public static String test_outDir = "/homes/pvtroshin/HMM2"; @Test public void testGetTestCommand() { System.out.println(Tmhmm2.getTestCommand()); } @Test(enabled = false, groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner }) public void testBuildCommand() { Tmhmm2 hmm = new Tmhmm2(AllTestSuit.OUTPUT_DIR_ABSOLUTE); // TODO hmm.setInput(test_input).setOutput(test_outfile); // hmm.setParameters(new Tmhmm2().getParameters()); try { JobRunner runner = JobRunner.getInstance(null); assertNotNull("Runner is NULL", runner); // runner.setWorkDirectory(test_outDir); runner.executeJob(); // assertNotNull(jobId1); JobStatus status = runner.getJobStatus(); assertTrue(status == JobStatus.PENDING || status == JobStatus.RUNNING); JobInfo info = runner.getJobInfo(); assertNotNull(info); StatisticManager sm = new StatisticManager(info); assertNotNull(sm); try { String exits = sm.getExitStatus(); assertNotNull(exits); int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); // assertEquals(0, exitsInt); System.out.println(sm.getAllStats()); } catch (ParseException e) { e.printStackTrace(); fail("Parse Exception: " + e.getLocalizedMessage()); } assertTrue(sm.hasExited()); assertFalse(sm.wasAborted()); assertFalse(sm.hasDump()); assertFalse(sm.hasSignaled()); } catch (DrmaaException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } catch (JobSubmissionException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } catch (JobExecutionException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } } }