X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=testsrc%2Fcompbio%2Fmetadata%2FRunnerConfigTester.java;fp=testsrc%2Fcompbio%2Fmetadata%2FRunnerConfigTester.java;h=99549e1bf92d74487732fe90a911e28a0d0c914c;hb=b9f54dfc066b99717d901ab5239513f891a7ee43;hp=3bf2368577d54a4be3d61cef9c4ee31566b013fd;hpb=2a4439190b9b6cf0f881d5d07531c25b057117d6;p=jabaws.git diff --git a/testsrc/compbio/metadata/RunnerConfigTester.java b/testsrc/compbio/metadata/RunnerConfigTester.java index 3bf2368..99549e1 100644 --- a/testsrc/compbio/metadata/RunnerConfigTester.java +++ b/testsrc/compbio/metadata/RunnerConfigTester.java @@ -40,8 +40,7 @@ import compbio.runner.msa.Mafft; public class RunnerConfigTester { - public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE - + "MafftParameters.xml"; + public static String test_input = AllTestSuit.TEST_DATA_PATH_ABSOLUTE + "MafftParameters.xml"; RunnerConfig rconfig = null; @@ -52,9 +51,8 @@ public class RunnerConfigTester { rconfig.setRunnerClassName(Mafft.class.getName()); List> prms = new ArrayList>(); - RunnerConfigMarshaller pmarshaller = new RunnerConfigMarshaller( - RunnerConfig.class, Parameter.class, Option.class, - ValueConstrain.class); + RunnerConfigMarshaller pmarshaller = new RunnerConfigMarshaller(RunnerConfig.class, Parameter.class, + Option.class, ValueConstrain.class); } catch (JAXBException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); @@ -76,88 +74,69 @@ public class RunnerConfigTester { @Test(expectedExceptions = WrongParameterException.class) public void testCreateParameter() throws WrongParameterException { - try { - Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID"); - // This attribute is required by strict schema - p3.setOptionName("--AAMATRIX"); - p3.setRequired(true); - // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED - // IN WITHIN POSSIBLE VALUES - p3.setDefaultValue("pam22"); - String com = p3.toCommand(" "); - System.out.println("AAAAAAAAAAAAAA!" + com); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID"); + // This attribute is required by strict schema + p3.setOptionName("--AAMATRIX"); + p3.setRequired(true); + // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED + // IN WITHIN POSSIBLE VALUES + p3.setDefaultValue("pam22"); + String com = p3.toCommand(" "); + System.out.println("AAAAAAAAAAAAAA!" + com); } @Test() public void testParameterToCommand() throws WrongParameterException { - try { - Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID"); - // This attribute is required by strict schema - p3.setOptionName("--AAMATRIX"); - p3.setRequired(true); - // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED - // IN WITHIN POSSIBLE VALUES - p3.setDefaultValue("PAM"); - String com = p3.toCommand("="); - assertTrue(com.startsWith("--AAMATRIX")); - assertTrue(com.endsWith("PAM")); - assertTrue(com.contains("=")); - p3.setDefaultValue("ID"); - com = p3.toCommand("="); - assertFalse(com.endsWith("PAM")); - assertFalse(com.contains("PAM")); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + p3.addPossibleValues("BLOSUM", "PAM", "GONNET", "ID"); + // This attribute is required by strict schema + p3.setOptionName("--AAMATRIX"); + p3.setRequired(true); + // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED + // IN WITHIN POSSIBLE VALUES + p3.setDefaultValue("PAM"); + String com = p3.toCommand("="); + assertTrue(com.startsWith("--AAMATRIX")); + assertTrue(com.endsWith("PAM")); + assertTrue(com.contains("=")); + p3.setDefaultValue("ID"); + com = p3.toCommand("="); + assertFalse(com.endsWith("PAM")); + assertFalse(com.contains("PAM")); } @Test(expectedExceptions = ValidationException.class) public void testOptionNoDefaultValidate() throws ValidationException { - try { - Option p3 = new Option("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + Option p3 = new Option("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB"))); - p3.setRequired(true); - // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED - // IN WITHIN POSSIBLE VALUES - p3.validate(); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB"))); + p3.setRequired(true); + // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED + // IN WITHIN POSSIBLE VALUES + p3.validate(); } @Test(expectedExceptions = WrongParameterException.class) public void testOptionSetInvalidValue() throws WrongParameterException { - try { - Option p3 = new Option("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB"))); - p3.setRequired(true); - // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED - // IN WITHIN POSSIBLE VALUES - p3.setDefaultValue("AAA"); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + Option p3 = new Option("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + + p3.setOptionNames(new HashSet(Arrays.asList("--AAMATRIX", "--ABMAT", "--BBBB"))); + p3.setRequired(true); + // THIS LINE IS CAUSING EXCEPTION AS DEFAULT VALUE MUST BE DEFINED + // IN WITHIN POSSIBLE VALUES + p3.setDefaultValue("AAA"); } @Test() @@ -178,9 +157,6 @@ public class RunnerConfigTester { p3.setDefaultValue("--ABMAT"); com = p3.toCommand("="); assertEquals("--ABMAT", com); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); } catch (ValidationException e) { e.printStackTrace(); fail(e.getMessage()); @@ -222,51 +198,39 @@ public class RunnerConfigTester { } @Test(expectedExceptions = WrongParameterException.class) - public void testValidateLowerBoundaryConstrainCheck() - throws WrongParameterException { - try { - Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - // This attribute is required by strict schema - p3.setOptionName("--AAMATRIX"); - p3.setRequired(true); + public void testValidateLowerBoundaryConstrainCheck() throws WrongParameterException { + Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + // This attribute is required by strict schema + p3.setOptionName("--AAMATRIX"); + p3.setRequired(true); - ValueConstrain vc = new ValueConstrain(); - vc.setType(ValueConstrain.Type.Float); - vc.setMin("-10.12"); - vc.setMax("0"); - p3.setValidValue(vc); - // THIS IS CAUSING EXCEPTION - p3.setDefaultValue("-11.0"); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + ValueConstrain vc = new ValueConstrain(); + vc.setType(ValueConstrain.Type.Float); + vc.setMin("-10.12"); + vc.setMax("0"); + p3.setValidValue(vc); + // THIS IS CAUSING EXCEPTION + p3.setDefaultValue("-11.0"); } @Test(expectedExceptions = WrongParameterException.class) - public void testValidateUpperBoundaryConstrainCheck() - throws WrongParameterException { - try { - Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); - // TODO publish help on a compbio web site - p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); - // This attribute is required by strict schema - p3.setOptionName("--AAMATRIX"); - p3.setRequired(true); + public void testValidateUpperBoundaryConstrainCheck() throws WrongParameterException { + Parameter p3 = new Parameter("Matrix1", "Protein weight matrix"); + // TODO publish help on a compbio web site + p3.setFurtherDetails("http://www.compbio.dundee.ac.uk/users/pvtroshin/ws/Index.html"); + // This attribute is required by strict schema + p3.setOptionName("--AAMATRIX"); + p3.setRequired(true); - ValueConstrain vc = new ValueConstrain(); - vc.setType(ValueConstrain.Type.Float); - vc.setMin("-10.12"); - vc.setMax("0"); - p3.setValidValue(vc); - // THIS IS CAUSING EXCEPTION - p3.setDefaultValue("1"); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); - } + ValueConstrain vc = new ValueConstrain(); + vc.setType(ValueConstrain.Type.Float); + vc.setMin("-10.12"); + vc.setMax("0"); + p3.setValidValue(vc); + // THIS IS CAUSING EXCEPTION + p3.setDefaultValue("1"); } @Test() @@ -286,9 +250,6 @@ public class RunnerConfigTester { // Max value boundary is not defined so 1 is valid p3.setDefaultValue("1"); p3.validate(); - } catch (MalformedURLException e) { - e.printStackTrace(); - fail(e.getMessage()); } catch (WrongParameterException e) { e.printStackTrace(); fail(e.getMessage());