+++ /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.assertEquals;\r
-import static org.testng.Assert.assertTrue;\r
-\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.testng.annotations.Test;\r
-\r
-import compbio.runner.msa.ClustalW;\r
-import compbio.util.SysPrefs;\r
-\r
-public class DirectoryManagerTester {\r
-\r
- @Test(invocationCount = 4, threadPoolSize = 4, sequential = false)\r
- public void testGetDirectory() {\r
- Set<Long> set = new HashSet<Long>();\r
- for (int i = 0; i < 20000; i++) {\r
- long number = DirectoryManager.getNonRepeatableNumber();\r
- assertTrue(set.add(number));\r
- // Cannot rely on the length is the returned long, as precision is\r
- // implementation dependent\r
- // see testNanoTime method below\r
- // assertEquals(Long.toString(number).length(), 17);\r
- }\r
- String name = DirectoryManager.getTaskDirectory(ClustalW.class);\r
- assertTrue(name.startsWith(ClustalW.class.getSimpleName()));\r
- }\r
-\r
- /*\r
- * In fact the precision of System.nanoTime() varies depending on the JVM\r
- * Sun 1.6.0_17 JVM gives the same precision on linux x64 as on windows x32\r
- * but openjdk 1.6.x gives more digits on linux than sun JVM It looks like\r
- * the precision is desided at runtime, so the number of digits returned is\r
- * unknown\r
- */\r
- @Test(enabled = false)\r
- public void testNanoTime() {\r
- if (SysPrefs.isWindows) {\r
- assertEquals(Long.toString(System.nanoTime()).length(), 16);\r
- } else {\r
- // This is not always true for Linux\r
- assertEquals(Long.toString(System.nanoTime()).length(), 14);\r
- }\r
- }\r
-\r
-}\r