--- /dev/null
+/* 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.engine.conf;\r
+\r
+import static org.testng.Assert.assertNotNull;\r
+import static org.testng.Assert.assertTrue;\r
+\r
+import java.io.File;\r
+\r
+import org.testng.annotations.BeforeClass;\r
+import org.testng.annotations.Test;\r
+\r
+import compbio.metadata.AllTestSuit;\r
+import compbio.util.PropertyHelper;\r
+\r
+public class PropertyHelperManagerTester {\r
+\r
+ PropertyHelper ph;\r
+\r
+ @BeforeClass(alwaysRun=true)\r
+ public void testLoadResources() {\r
+ ph = PropertyHelperManager.getPropertyHelper();\r
+ assertNotNull(ph);\r
+ }\r
+\r
+ @Test(groups = AllTestSuit.test_group_cluster)\r
+ public void testClusterEngineConf() {\r
+ // Below are the properties on cluster engine required for its\r
+ // functioning\r
+ validateDirProp("cluster.tmp.directory");\r
+ }\r
+\r
+ void validateDirProp(String propName) {\r
+ assertNotNull(ph);\r
+ assertNotNull(ph.getProperty(propName));\r
+ File tmp = new File(ph.getProperty(propName).trim());\r
+ assertTrue(tmp.exists());\r
+ assertTrue(tmp.isDirectory());\r
+ assertTrue(tmp.canRead());\r
+ assertTrue(tmp.canWrite());\r
+ }\r
+\r
+ void validateExecFileProp(String propName) {\r
+ validateFileProp(propName);\r
+ File tmp = new File(ph.getProperty(propName));\r
+ assertTrue(tmp.canExecute());\r
+ }\r
+\r
+ void validateFileProp(String propName) {\r
+ assertNotNull(ph.getProperty(propName));\r
+ File tmp = new File(ph.getProperty(propName));\r
+ assertTrue(tmp.exists());\r
+ assertTrue(tmp.isFile());\r
+ assertTrue(tmp.canRead());\r
+ }\r
+\r
+ @Test\r
+ public void validateClustalConfiguration() {\r
+ // Below are the properties on Clustal executable required for its\r
+ // functioning\r
+ // Executables could not be verified as full path is constructed only at\r
+ // runtime\r
+ assertNotNull("local.clustalw.bin.windows");\r
+ assertNotNull("local.clustalw.bin");\r
+ assertNotNull("cluster.clustalw.bin");\r
+ validateFileProp("clustalw.presets.file");\r
+ validateFileProp("clustalw.parameters.file");\r
+ //validateFileProp("clustalw.limits.file");\r
+ }\r
+\r
+ @Test\r
+ public void validateMuscleConfiguration() {\r
+ assertNotNull("local.muscle.bin.windows");\r
+ assertNotNull("local.muscle.bin");\r
+ assertNotNull("cluster.muscle.bin");\r
+ validateFileProp("muscle.presets.file");\r
+ validateFileProp("muscle.parameters.file");\r
+ //validateFileProp("muscle.limits.file");\r
+ }\r
+\r
+ @Test\r
+ public void validateTcoffeeConfiguration() {\r
+ assertNotNull("local.tcoffee.bin.windows");\r
+ assertNotNull("local.tcoffee.bin");\r
+ assertNotNull("cluster.tcoffee.bin");\r
+ validateFileProp("tcoffee.presets.file");\r
+ validateFileProp("tcoffee.parameters.file");\r
+ //validateFileProp("tcoffee.limits.file");\r
+ }\r
+\r
+ @Test\r
+ public void validateMafftConfiguration() {\r
+ assertNotNull("local.mafft.bin.windows");\r
+ assertNotNull("local.mafft.bin");\r
+ assertNotNull("cluster.mafft.bin");\r
+ validateFileProp("mafft.presets.file");\r
+ validateFileProp("mafft.parameters.file");\r
+ //validateFileProp("mafft.limits.file");\r
+ }\r
+}\r