Remove JABAWS testing code
[proteocache.git] / testsrc / compbio / casscode / msa / ProbconsParametersTester.java
diff --git a/testsrc/compbio/casscode/msa/ProbconsParametersTester.java b/testsrc/compbio/casscode/msa/ProbconsParametersTester.java
deleted file mode 100644 (file)
index dd9a009..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-/* 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
-\r
-package compbio.runner.msa;\r
-\r
-import static org.testng.Assert.assertNotNull;\r
-import static org.testng.Assert.fail;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileNotFoundException;\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import javax.xml.bind.JAXBException;\r
-import javax.xml.bind.ValidationException;\r
-\r
-import org.apache.log4j.Level;\r
-import org.apache.log4j.Logger;\r
-import org.testng.annotations.BeforeMethod;\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.engine.Configurator;\r
-import compbio.engine.SyncExecutor;\r
-import compbio.engine.client.ConfiguredExecutable;\r
-import compbio.engine.client.Executable.ExecProvider;\r
-import compbio.engine.conf.RunnerConfigMarshaller;\r
-import compbio.metadata.AllTestSuit;\r
-import compbio.metadata.JobExecutionException;\r
-import compbio.metadata.JobSubmissionException;\r
-import compbio.metadata.Option;\r
-import compbio.metadata.Parameter;\r
-import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
-import compbio.metadata.RunnerConfig;\r
-import compbio.runner.OptionCombinator;\r
-import compbio.runner.msa.Probcons;\r
-import compbio.util.Util;\r
-\r
-public class ProbconsParametersTester {\r
-\r
-       static final String probconsConfigFile = AllTestSuit.TEST_DATA_PATH\r
-                       + "ProbconsParameters.xml";\r
-\r
-       public static String test_outfile = "TO1381.probcons.out";\r
-\r
-       private static Logger log = Logger\r
-                       .getLogger(AllTestSuit.RUNNER_TEST_LOGGER);\r
-       static {\r
-               log.setLevel(Level.INFO);\r
-       }\r
-\r
-       PresetManager<Probcons> presets = null;\r
-       RunnerConfig<Probcons> probconsConfig = null;\r
-       OptionCombinator probconsOpc = null;\r
-\r
-       @BeforeMethod(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void setup() {\r
-               try {\r
-                       // Load parameters\r
-                       RunnerConfigMarshaller<Probcons> mafftmarsh = new RunnerConfigMarshaller<Probcons>(\r
-                                       RunnerConfig.class);\r
-                       probconsConfig = mafftmarsh.read(new FileInputStream(new File(\r
-                                       probconsConfigFile)), RunnerConfig.class);\r
-                       probconsOpc = new OptionCombinator(probconsConfig);\r
-\r
-               } catch (JAXBException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (FileNotFoundException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-\r
-       }\r
-\r
-       @Test\r
-       public void testConfiguration() {\r
-               try {\r
-                       this.probconsConfig.validate();\r
-               } catch (ValidationException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (IllegalStateException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testDefaultParameters() {\r
-               Probcons mafft = new Probcons();\r
-               mafft.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
-\r
-               try {\r
-                       // For local execution use relavive\r
-                       ConfiguredExecutable<Probcons> confMafft = Configurator\r
-                                       .configureExecutable(mafft, ExecProvider.Cluster);\r
-                       SyncExecutor sexecutor = Configurator.getSyncEngine(confMafft);\r
-                       sexecutor.executeJob();\r
-                       confMafft = (ConfiguredExecutable<Probcons>) sexecutor\r
-                                       .waitForResult();\r
-                       assertNotNull(confMafft.getResults());\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JobExecutionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testOptions() {\r
-               test(probconsOpc.getAllOptions());\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testParameters() {\r
-               List<Parameter<?>> params = probconsOpc.getAllParameters();\r
-               Collections.shuffle(params);\r
-               test(params);\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testArguments() {\r
-               List<Option<?>> options = new ArrayList<Option<?>>(probconsConfig\r
-                               .getOptions());\r
-               options.addAll(probconsOpc.getAllParameters());\r
-               Collections.shuffle(options);\r
-               test(options);\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testConstrainedParametersMinValues() {\r
-               Map<Parameter<?>, String> params = probconsOpc\r
-                               .getAllConstrainedParametersWithBorderValues(true);\r
-               test(params);\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testConstrainedParametersMaxValues() {\r
-               Map<Parameter<?>, String> params = probconsOpc\r
-                               .getAllConstrainedParametersWithBorderValues(false);\r
-               test(params);\r
-       }\r
-\r
-       @Test(groups = { AllTestSuit.test_group_runner,\r
-                       AllTestSuit.test_group_non_windows })\r
-       public void testConstrainedParametersRandomValues() {\r
-               for (int i = 0; i < 20; i++) {\r
-                       Map<Parameter<?>, String> params = probconsOpc\r
-                                       .getAllConstrainedParametersWithRandomValues();\r
-                       List<Parameter<?>> paramList = new ArrayList<Parameter<?>>(params\r
-                                       .keySet());\r
-                       Collections.shuffle(paramList);\r
-                       List<Parameter<?>> subList = paramList.subList(0, Util\r
-                                       .getRandomNumber(1, paramList.size()));\r
-                       List<String> args = probconsOpc.parametersToCommandString(subList,\r
-                                       params);\r
-                       singleTest(args);\r
-               }\r
-       }\r
-\r
-       void test(Map<Parameter<?>, String> paramValue) {\r
-               List<Parameter<?>> paramList = new ArrayList<Parameter<?>>(paramValue\r
-                               .keySet());\r
-               for (int i = 0; i < paramValue.size(); i++) {\r
-                       List<String> args = probconsOpc.parametersToCommandString(\r
-                                       paramList, paramValue);\r
-                       singleTest(args);\r
-                       Collections.shuffle(paramList);\r
-               }\r
-               log.info("NUMBER OF COBINATION TESTED: " + paramValue.size());\r
-       }\r
-\r
-       void test(List<? extends Option<?>> params) {\r
-               for (int i = 0; i < params.size(); i++) {\r
-                       List<String> args = probconsOpc.argumentsToCommandString(params);\r
-                       singleTest(args);\r
-                       Collections.shuffle(params);\r
-               }\r
-               log.info("NUMBER OF COBINATION TESTED: " + params.size());\r
-       }\r
-\r
-       void singleTest(List<String> params) {\r
-               try {\r
-                       log.info("Using arguments: " + params);\r
-                       Probcons mafft = new Probcons();\r
-                       mafft.setInput(AllTestSuit.test_input).setOutput(test_outfile);\r
-\r
-                       // For local execution use relative\r
-                       ConfiguredExecutable<Probcons> confMafft = Configurator\r
-                                       .configureExecutable(mafft, ExecProvider.Local);\r
-                       // Add options to the executable\r
-                       confMafft.addParameters(params);\r
-\r
-                       SyncExecutor sexecutor = Configurator.getSyncEngine(confMafft);\r
-                       sexecutor.executeJob();\r
-                       ConfiguredExecutable<?> al = sexecutor.waitForResult();\r
-                       assertNotNull(al.getResults());\r
-                       /*\r
-                        * TODO File errors = new File(confMafft.getWorkDirectory(),\r
-                        * ExecutableWrapper.PROC_ERR_FILE); if (errors.length() != 0) {\r
-                        * log.error("PROBLEMS:\n " + FileUtil.readFileToString(errors)); }\r
-                        * assertTrue("Run with arguments : " + params + " FAILED!", errors\r
-                        * .length() == 0);\r
-                        */\r
-               } catch (JobSubmissionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (JobExecutionException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               } catch (ResultNotAvailableException e) {\r
-                       e.printStackTrace();\r
-                       fail(e.getLocalizedMessage());\r
-               }\r
-       }\r
-\r
-}\r