/* 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 NetNglycTester { public static String test_input = "/homes/pvtroshin/TO1381.fasta"; public static String test_outfile = "/homes/pvtroshin/TO1381.netNGlycout"; @Test() public void testGetTestCommand() { assertNotNull(Tmhmm2.getTestCommand()); } @Test(enabled = false, groups = { AllTestSuit.test_group_cluster, AllTestSuit.test_group_runner }) public void testBuildCommand() { NetNglyc netnGlyc = new NetNglyc(); // TODO netnGlyc.setInput(test_input).setOutput(test_outfile); try { JobRunner runner = JobRunner.getInstance(null); assertNotNull("Runner is NULL", runner); runner.executeJob(); assertNotNull("JobId is NULL"); JobStatus status = runner.getJobStatus(); assertTrue("Status of the job is wrong!", status == JobStatus.PENDING || status == JobStatus.RUNNING); JobInfo info = runner.getJobInfo(); assertNotNull("Cannot Obtain Job Info", info); StatisticManager sm = new StatisticManager(info); assertNotNull("StatisticManager is NULL", sm); String exits = sm.getExitStatus(); assertNotNull("Status is NULL", exits); int exitsInt = ClusterUtil.CLUSTER_STAT_IN_SEC.parse(exits) .intValue(); assertTrue("Time elapsed is greater than 0", exitsInt >= 0); System.out.println(sm.getAllStats()); assertTrue("Process exited:", sm.hasExited()); assertFalse("Process aborted:", sm.wasAborted()); assertFalse("Process hasdump:", sm.hasDump()); assertFalse("Process signaled:", sm.hasSignaled()); } catch (DrmaaException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } catch (ParseException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } catch (JobSubmissionException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } catch (JobExecutionException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); } } }