b1ab6bef2e827b37d652cd75929ef20ebfb4bed1
[jabaws.git] / testsrc / compbio / engine / cluster / dundee / _QueueTester.java
1 /* Copyright (c) 2009 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
4  * \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
7  * \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
11  * \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
14  * \r
15  * Any republication or derived work distributed in source code form\r
16  * must include this copyright and license notice.\r
17  */\r
18 package compbio.engine.cluster.dundee;\r
19 \r
20 import static org.testng.AssertJUnit.assertEquals;\r
21 import static org.testng.AssertJUnit.assertNotSame;\r
22 import static org.testng.AssertJUnit.assertTrue;\r
23 \r
24 import java.net.UnknownServiceException;\r
25 \r
26 import org.testng.annotations.Test;\r
27 \r
28 import compbio.runner._NativeSpecHelper;\r
29 \r
30 public class _QueueTester {\r
31         @Test\r
32         public void testQueue() {\r
33                 _NativeSpecHelper queueHelper = new _NativeSpecHelper(2000, 9);\r
34 \r
35                 assertEquals(_Queue.PRIBIT64, queueHelper.getApproprieteQueue());\r
36                 queueHelper.setQueue("bigmem.q");\r
37                 assertEquals(_Queue.BIGMEM.toString(), queueHelper.getQueue());\r
38                 queueHelper.setQueue("devel.q");\r
39                 assertNotSame(_Queue.DEVEL, queueHelper.getApproprieteQueue());\r
40                 boolean hasfailed = false;\r
41                 try {\r
42                         queueHelper.getNativeSpec();\r
43                 } catch (UnknownServiceException e) {\r
44                         hasfailed = true;\r
45                 }\r
46                 assertTrue(hasfailed);\r
47 \r
48                 queueHelper = new _NativeSpecHelper(14000, 9);\r
49                 assertEquals(_Queue.PRIBIT64, queueHelper.getApproprieteQueue());\r
50                 queueHelper.setRequiredMemory(14001);\r
51                 assertEquals(_Queue.BIGMEM, queueHelper.getApproprieteQueue());\r
52                 queueHelper.setRequiredMemory(32000);\r
53                 hasfailed = false;\r
54                 try {\r
55                         assertEquals(_Queue.BIGMEM, queueHelper.getApproprieteQueue());\r
56                 } catch (UnsupportedOperationException e) {\r
57                         hasfailed = true;\r
58                 }\r
59                 assertTrue(hasfailed);\r
60                 queueHelper = new _NativeSpecHelper(8000);\r
61                 assertEquals(_Queue.BIT64, queueHelper.getApproprieteQueue());\r
62         }\r
63 }\r