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
19 package compbio.metadata;
\r
21 import static org.testng.Assert.fail;
\r
23 import java.io.File;
\r
24 import java.io.FileInputStream;
\r
25 import java.io.FileNotFoundException;
\r
27 import javax.xml.bind.JAXBException;
\r
29 import org.testng.annotations.BeforeMethod;
\r
30 import org.testng.annotations.Test;
\r
32 import compbio.engine.conf.RunnerConfigMarshaller;
\r
33 import compbio.metadata.RunnerConfig;
\r
34 import compbio.runner.OptionCombinator;
\r
35 import compbio.runner.msa.ClustalW;
\r
36 import compbio.runner.msa.Mafft;
\r
37 import compbio.runner.msa.Muscle;
\r
39 public class OptionCombinatorTester {
\r
41 static final String mafftConfigFile = AllTestSuit.TEST_DATA_PATH
\r
42 + "MafftParameters.xml";
\r
44 static final String muscleConfigFile = AllTestSuit.TEST_DATA_PATH
\r
45 + "MuscleParameters.xml";
\r
47 static final String clustalConfigFile = AllTestSuit.TEST_DATA_PATH
\r
48 + "ClustalParameters.xml";
\r
50 RunnerConfig<Mafft> mafftConfig = null;
\r
51 RunnerConfig<Mafft> muscleConfig = null;
\r
52 RunnerConfig<Mafft> clustalConfig = null;
\r
55 @SuppressWarnings("unchecked")
\r
58 RunnerConfigMarshaller<Mafft> mf = new RunnerConfigMarshaller<Mafft>(
\r
59 RunnerConfig.class);
\r
60 mafftConfig = mf.read(
\r
61 new FileInputStream(new File(mafftConfigFile)),
\r
62 RunnerConfig.class);
\r
63 RunnerConfigMarshaller<Muscle> musclemarsh = new RunnerConfigMarshaller<Muscle>(
\r
64 RunnerConfig.class);
\r
65 muscleConfig = musclemarsh.read(new FileInputStream(new File(
\r
66 muscleConfigFile)), RunnerConfig.class);
\r
68 RunnerConfigMarshaller<ClustalW> clustalmarsh = new RunnerConfigMarshaller<ClustalW>(
\r
69 RunnerConfig.class);
\r
70 clustalConfig = clustalmarsh.read(new FileInputStream(new File(
\r
71 clustalConfigFile)), RunnerConfig.class);
\r
73 } catch (FileNotFoundException e) {
\r
74 e.printStackTrace();
\r
75 fail(e.getMessage());
\r
76 } catch (JAXBException e) {
\r
77 e.printStackTrace();
\r
78 fail(e.getMessage());
\r
83 public void testgetAllOptions() {
\r
84 OptionCombinator opc = new OptionCombinator(mafftConfig);
\r
85 System.out.println(opc.getOptionsAtRandom());
\r
86 OptionCombinator muscleOpc = new OptionCombinator(muscleConfig);
\r
87 System.out.println("Mucle " + muscleOpc.getOptionsAtRandom());
\r
88 OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);
\r
89 System.out.println("Clustal " + clustalOpc.getOptionsAtRandom());
\r
94 public void testgetAllParameters() {
\r
95 OptionCombinator opc = new OptionCombinator(mafftConfig);
\r
96 System.out.println(opc.getAllParameters());
\r
97 OptionCombinator muscleOpc = new OptionCombinator(muscleConfig);
\r
98 System.out.println("Muscle : " + muscleOpc.getAllParameters());
\r
99 OptionCombinator clustalOpc = new OptionCombinator(clustalConfig);
\r
100 System.out.println("Clustal : " + clustalOpc.getAllParameters());
\r