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.engine.conf;
\r
21 import static org.testng.Assert.assertNotNull;
\r
22 import static org.testng.Assert.assertTrue;
\r
24 import java.io.File;
\r
26 import org.testng.annotations.BeforeClass;
\r
27 import org.testng.annotations.Test;
\r
29 import compbio.metadata.AllTestSuit;
\r
30 import compbio.util.PropertyHelper;
\r
32 public class PropertyHelperManagerTester {
\r
36 @BeforeClass(alwaysRun=true)
\r
37 public void testLoadResources() {
\r
38 ph = PropertyHelperManager.getPropertyHelper();
\r
42 @Test(groups = AllTestSuit.test_group_cluster)
\r
43 public void testClusterEngineConf() {
\r
44 // Below are the properties on cluster engine required for its
\r
46 validateDirProp("cluster.tmp.directory");
\r
49 void validateDirProp(String propName) {
\r
51 assertNotNull(ph.getProperty(propName));
\r
52 File tmp = new File(ph.getProperty(propName));
\r
53 assertTrue(tmp.exists());
\r
54 assertTrue(tmp.isDirectory());
\r
55 assertTrue(tmp.canRead());
\r
56 assertTrue(tmp.canWrite());
\r
59 void validateExecFileProp(String propName) {
\r
60 validateFileProp(propName);
\r
61 File tmp = new File(ph.getProperty(propName));
\r
62 assertTrue(tmp.canExecute());
\r
65 void validateFileProp(String propName) {
\r
66 assertNotNull(ph.getProperty(propName));
\r
67 File tmp = new File(ph.getProperty(propName));
\r
68 assertTrue(tmp.exists());
\r
69 assertTrue(tmp.isFile());
\r
70 assertTrue(tmp.canRead());
\r
74 public void validateClustalConfiguration() {
\r
75 // Below are the properties on Clustal executable required for its
\r
77 // Executables could not be verified as full path is constructed only at
\r
79 assertNotNull("local.clustalw.bin.windows");
\r
80 assertNotNull("local.clustalw.bin");
\r
81 assertNotNull("cluster.clustalw.bin");
\r
82 validateFileProp("clustalw.presets.file");
\r
83 validateFileProp("clustalw.parameters.file");
\r
84 validateFileProp("clustalw.limits.file");
\r
88 public void validateMuscleConfiguration() {
\r
89 assertNotNull("local.muscle.bin.windows");
\r
90 assertNotNull("local.muscle.bin");
\r
91 assertNotNull("cluster.muscle.bin");
\r
92 validateFileProp("muscle.presets.file");
\r
93 validateFileProp("muscle.parameters.file");
\r
94 validateFileProp("muscle.limits.file");
\r
98 public void validateTcoffeeConfiguration() {
\r
99 assertNotNull("local.tcoffee.bin.windows");
\r
100 assertNotNull("local.tcoffee.bin");
\r
101 assertNotNull("cluster.tcoffee.bin");
\r
102 validateFileProp("tcoffee.presets.file");
\r
103 validateFileProp("tcoffee.parameters.file");
\r
104 validateFileProp("tcoffee.limits.file");
\r
108 public void validateMafftConfiguration() {
\r
109 assertNotNull("local.mafft.bin.windows");
\r
110 assertNotNull("local.mafft.bin");
\r
111 assertNotNull("cluster.mafft.bin");
\r
112 validateFileProp("mafft.presets.file");
\r
113 validateFileProp("mafft.parameters.file");
\r
114 validateFileProp("mafft.limits.file");
\r