\r
public class PresetTester {\r
\r
- public static final String input = AllTestSuit.TEST_DATA_PATH\r
- + "MafftPresets.xml";\r
- public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
- + "MafftParameters.xml";\r
-\r
- PresetManager<Mafft> presets = null;\r
- RunnerConfig<Mafft> rconfParams = null;\r
-\r
- @BeforeTest(enabled = true)\r
- public void loadPresets() {\r
- try {\r
- // Load Preset definitions\r
- RunnerConfigMarshaller<Mafft> rconfigPresets = new RunnerConfigMarshaller<Mafft>(\r
- PresetManager.class);\r
- File infile = new File(input);\r
- assertTrue(infile.exists());\r
- presets = rconfigPresets.read(new FileInputStream(infile),\r
- PresetManager.class);\r
- assertNotNull(presets);\r
- assertFalse(presets.preset.isEmpty());\r
-\r
- // Load Parameters definitions\r
- File input = new File(this.test_input);\r
- assertTrue(input.exists());\r
- JAXBContext ctx = JAXBContext.newInstance(RunnerConfig.class);\r
- Unmarshaller um = ctx.createUnmarshaller();\r
- JAXBElement<RunnerConfig> rconfigParams = um.unmarshal(\r
- new StreamSource(input), RunnerConfig.class);\r
- rconfParams = rconfigParams.getValue();\r
- assertNotNull(rconfParams);\r
-\r
- } catch (JAXBException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (FileNotFoundException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
+ public static final String input = AllTestSuit.TEST_DATA_PATH\r
+ + "MafftPresets.xml";\r
+ public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE\r
+ + "MafftParameters.xml";\r
+\r
+ PresetManager<Mafft> presets = null;\r
+ RunnerConfig<Mafft> rconfParams = null;\r
+\r
+ @BeforeTest(enabled = true)\r
+ public void loadPresets() {\r
+ try {\r
+ // Load Preset definitions\r
+ RunnerConfigMarshaller<Mafft> rconfigPresets = new RunnerConfigMarshaller<Mafft>(\r
+ PresetManager.class);\r
+ File infile = new File(input);\r
+ assertTrue(infile.exists());\r
+ presets = rconfigPresets.read(new FileInputStream(infile),\r
+ PresetManager.class);\r
+ assertNotNull(presets);\r
+ assertFalse(presets.preset.isEmpty());\r
+\r
+ // Load Parameters definitions\r
+ File input = new File(this.test_input);\r
+ assertTrue(input.exists());\r
+ JAXBContext ctx = JAXBContext.newInstance(RunnerConfig.class);\r
+ Unmarshaller um = ctx.createUnmarshaller();\r
+ JAXBElement<RunnerConfig> rconfigParams = um.unmarshal(\r
+ new StreamSource(input), RunnerConfig.class);\r
+ rconfParams = rconfigParams.getValue();\r
+ assertNotNull(rconfParams);\r
+\r
+ } catch (JAXBException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (FileNotFoundException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
}\r
-\r
- @Test\r
- public void marshallPreset() {\r
- try {\r
- RunnerConfigMarshaller<Mafft> rconfig = new RunnerConfigMarshaller<Mafft>(\r
- PresetManager.class);\r
- PresetManager<Mafft> pman = getPresets();\r
- assertNotNull(pman);\r
- rconfig.readAndValidate(new FileInputStream(new File(input)),\r
- PresetManager.class);\r
- } catch (JAXBException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- } catch (SAXException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
- }\r
+ }\r
+\r
+ @Test\r
+ public void marshallPreset() {\r
+ try {\r
+ RunnerConfigMarshaller<Mafft> rconfig = new RunnerConfigMarshaller<Mafft>(\r
+ PresetManager.class);\r
+ PresetManager<Mafft> pman = getPresets();\r
+ assertNotNull(pman);\r
+ rconfig.readAndValidate(new FileInputStream(new File(input)),\r
+ PresetManager.class);\r
+ } catch (JAXBException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
+ } catch (SAXException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
}\r
-\r
- @Test\r
- public void validatePresets() {\r
- assertNotNull(presets);\r
- assertEquals(presets.getPresets().size(), 6);\r
- try {\r
- for (Preset<Mafft> pr : presets.getPresets()) {\r
- List<Option<Mafft>> options;\r
- options = pr.getArguments(rconfParams);\r
- assertFalse(options.isEmpty());\r
- if (pr.name.equals("L-INS-i (Accuracy-oriented)")) {\r
- assertEquals(options.size(), 2);\r
- Option<Mafft> o = options.get(0);\r
- if (o.name.equals("Pairwise alignment computation method")) {\r
- List<String> onames = o.getOptionNames();\r
- boolean match = false;\r
- for (String oname : onames) {\r
- if (oname.equals("--localpair")) {\r
- match = true;\r
- break;\r
- }\r
- }\r
- assertTrue(match);\r
- }\r
- }\r
- if (pr.name.equals("NW-NS-PartTree-1 (Speed oriented)")) {\r
- assertEquals(options.size(), 4);\r
- }\r
+ }\r
+\r
+ @Test\r
+ public void validatePresets() {\r
+ assertNotNull(presets);\r
+ assertEquals(presets.getPresets().size(), 6);\r
+ try {\r
+ for (Preset<Mafft> pr : presets.getPresets()) {\r
+ List<Option<Mafft>> options;\r
+ options = pr.getArguments(rconfParams);\r
+ assertFalse(options.isEmpty());\r
+ if (pr.name.equals("L-INS-i (Accuracy-oriented)")) {\r
+ assertEquals(options.size(), 2);\r
+ Option<Mafft> o = options.get(0);\r
+ if (o.name.equals("Pairwise alignment computation method")) {\r
+ List<String> onames = o.getOptionNames();\r
+ boolean match = false;\r
+ for (String oname : onames) {\r
+ if (oname.equals("--localpair")) {\r
+ match = true;\r
+ break;\r
+ }\r
}\r
- } catch (WrongParameterException e) {\r
- e.printStackTrace();\r
- fail(e.getMessage());\r
+ assertTrue(match);\r
+ }\r
+ }\r
+ if (pr.name.equals("NW-NS-PartTree-1 (Speed oriented)")) {\r
+ assertEquals(options.size(), 4);\r
}\r
+ }\r
+ } catch (WrongParameterException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
}\r
-\r
- private static PresetManager<Mafft> getPresets() {\r
- Preset<Mafft> preset1 = new Preset<Mafft>();\r
- preset1.name = "L-INS-i (Accuracy-oriented)";\r
- preset1.description = "dsfjkg fdjksghkjsgdfh jksdfg sdfgkjhsdfgk kjsdfg ";\r
-\r
- List<String> optionNames = new ArrayList<String>();\r
- optionNames.add("--localpair");\r
- optionNames.add("--maxiterate 1000");\r
- preset1.option = optionNames;\r
- PresetManager<Mafft> prman = new PresetManager<Mafft>();\r
- prman.preset = Collections.singletonList(preset1);\r
- prman.runnerClassName = Mafft.class.getCanonicalName();\r
-\r
- return prman;\r
+ }\r
+\r
+ @Test\r
+ public void testPresetWithMuptiOptions() {\r
+ assertNotNull(presets);\r
+ assertEquals(presets.getPresets().size(), 6);\r
+ try {\r
+ for (Preset<Mafft> pr : presets.getPresets()) {\r
+ List<Option<Mafft>> options;\r
+ options = pr.getArguments(rconfParams);\r
+ assertFalse(options.isEmpty());\r
+ if (pr.name.equals("E-INS-i (Accuracy-oriented)")) {\r
+ assertEquals(options.size(), 3);\r
+ Option<Mafft> o = options.get(0);\r
+ if (o.name.equals("Pairwise alignment computation method")) {\r
+ List<String> onames = o.getOptionNames();\r
+ boolean match = false;\r
+ for (String oname : onames) {\r
+ if (oname.equals("--genafpair")) {\r
+ match = true;\r
+ break;\r
+ }\r
+ }\r
+ assertTrue(match);\r
+ }\r
+ }\r
+ if (pr.name.equals("NW-NS-PartTree-1 (Speed oriented)")) {\r
+ assertEquals(options.size(), 4);\r
+ }\r
+ }\r
+ } catch (WrongParameterException e) {\r
+ e.printStackTrace();\r
+ fail(e.getMessage());\r
}\r
+ }\r
+\r
+ private static PresetManager<Mafft> getPresets() {\r
+ Preset<Mafft> preset1 = new Preset<Mafft>();\r
+ preset1.name = "L-INS-i (Accuracy-oriented)";\r
+ preset1.description = "dsfjkg fdjksghkjsgdfh jksdfg sdfgkjhsdfgk kjsdfg ";\r
+\r
+ List<String> optionNames = new ArrayList<String>();\r
+ optionNames.add("--localpair");\r
+ optionNames.add("--maxiterate 1000");\r
+ preset1.option = optionNames;\r
+ PresetManager<Mafft> prman = new PresetManager<Mafft>();\r
+ prman.preset = Collections.singletonList(preset1);\r
+ prman.runnerClassName = Mafft.class.getCanonicalName();\r
+\r
+ return prman;\r
+ }\r
}\r