1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.bin; |
22 |
|
|
23 |
|
import java.util.Date; |
24 |
|
import java.util.List; |
25 |
|
|
26 |
|
import org.testng.Assert; |
27 |
|
import org.testng.annotations.AfterClass; |
28 |
|
import org.testng.annotations.AfterMethod; |
29 |
|
import org.testng.annotations.BeforeClass; |
30 |
|
import org.testng.annotations.DataProvider; |
31 |
|
import org.testng.annotations.Test; |
32 |
|
|
33 |
|
import jalview.api.AlignViewportI; |
34 |
|
import jalview.datamodel.AlignmentAnnotation; |
35 |
|
import jalview.datamodel.AlignmentI; |
36 |
|
import jalview.datamodel.SequenceI; |
37 |
|
import jalview.gui.AlignFrame; |
38 |
|
import jalview.gui.AlignmentPanel; |
39 |
|
import jalview.gui.Desktop; |
40 |
|
import jalview.gui.JvOptionPane; |
41 |
|
import jalview.gui.StructureViewerBase; |
42 |
|
|
43 |
|
@Test |
|
|
| 93.5% |
Uncovered Elements: 4 (62) |
Complexity: 13 |
Complexity Density: 0.28 |
|
44 |
|
public class CommandsTest2 |
45 |
|
{ |
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
46 |
1 |
@BeforeClass(alwaysRun = true)... |
47 |
|
public static void setUpBeforeClass() throws Exception |
48 |
|
{ |
49 |
1 |
Cache.loadProperties("test/jalview/bin/commandsTest.jvprops"); |
50 |
1 |
Date oneHourFromNow = new Date( |
51 |
|
System.currentTimeMillis() + 3600 * 1000); |
52 |
1 |
Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow); |
53 |
1 |
if (Desktop.instance != null) |
54 |
1 |
Desktop.instance.closeAll_actionPerformed(null); |
55 |
|
|
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
1 |
@AfterClass(alwaysRun = true)... |
59 |
|
public static void resetProps() |
60 |
|
{ |
61 |
1 |
Cache.loadProperties("test/jalview/testProps.jvprops"); |
62 |
|
} |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
64 |
1 |
@BeforeClass(alwaysRun = true)... |
65 |
|
public void setUpJvOptionPane() |
66 |
|
{ |
67 |
1 |
JvOptionPane.setInteractiveMode(false); |
68 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
69 |
|
} |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
10 |
@AfterMethod(alwaysRun = true)... |
72 |
|
public void tearDown() |
73 |
|
{ |
74 |
10 |
Desktop.closeDesktop(); |
75 |
|
} |
76 |
|
|
|
|
| 93.2% |
Uncovered Elements: 3 (44) |
Complexity: 7 |
Complexity Density: 0.19 |
1PASS
|
|
77 |
10 |
@Test(... |
78 |
|
groups = |
79 |
|
{ "Functional", "testTask1" }, |
80 |
|
dataProvider = "structureOpeningArgsParams", |
81 |
|
singleThreaded = true) |
82 |
|
public void structureOpeningArgsTest(String cmdLine, int seqNum, |
83 |
|
int annNum, int viewerNum) |
84 |
|
{ |
85 |
10 |
String[] args = cmdLine.split("\\s+"); |
86 |
|
|
87 |
10 |
CommandsTest.callJalviewMain(args); |
88 |
17 |
while (Desktop.instance != null |
89 |
|
&& Desktop.instance.operationsAreInProgress()) |
90 |
|
{ |
91 |
7 |
try |
92 |
|
{ |
93 |
|
|
94 |
7 |
Thread.sleep(viewerNum * 50); |
95 |
|
} catch (InterruptedException e) |
96 |
|
{ |
97 |
0 |
e.printStackTrace(); |
98 |
|
} |
99 |
|
} |
100 |
10 |
; |
101 |
|
|
102 |
10 |
AlignFrame[] afs = Desktop.getDesktopAlignFrames(); |
103 |
10 |
Assert.assertNotNull(afs); |
104 |
10 |
Assert.assertTrue(afs.length > 0); |
105 |
|
|
106 |
10 |
AlignFrame af = afs[0]; |
107 |
10 |
Assert.assertNotNull(af); |
108 |
|
|
109 |
10 |
AlignmentPanel ap = af.alignPanel; |
110 |
10 |
Assert.assertNotNull(ap); |
111 |
|
|
112 |
10 |
AlignmentI al = ap.getAlignment(); |
113 |
10 |
Assert.assertNotNull(al); |
114 |
|
|
115 |
10 |
List<SequenceI> seqs = al.getSequences(); |
116 |
10 |
Assert.assertNotNull(seqs); |
117 |
|
|
118 |
10 |
Assert.assertEquals(seqs.size(), seqNum, "Wrong number of sequences"); |
119 |
|
|
120 |
10 |
AlignViewportI av = ap.getAlignViewport(); |
121 |
10 |
Assert.assertNotNull(av); |
122 |
|
|
123 |
10 |
AlignmentAnnotation[] aas = al.getAlignmentAnnotation(); |
124 |
10 |
int visibleAnn = 0; |
125 |
10 |
int dcount = 0; |
126 |
10 |
for (AlignmentAnnotation aa : aas) |
127 |
|
{ |
128 |
73 |
if (aa.visible) |
129 |
57 |
visibleAnn++; |
130 |
|
} |
131 |
|
|
132 |
10 |
Assert.assertEquals(visibleAnn, annNum, |
133 |
|
"Wrong number of visible annotations"); |
134 |
|
|
135 |
10 |
if (viewerNum > -1) |
136 |
|
{ |
137 |
10 |
List<StructureViewerBase> openViewers = Desktop.instance |
138 |
|
.getStructureViewers(ap, null); |
139 |
10 |
Assert.assertNotNull(openViewers); |
140 |
10 |
int count = 0; |
141 |
10 |
for (StructureViewerBase svb : openViewers) |
142 |
|
{ |
143 |
13 |
if (svb.isVisible()) |
144 |
13 |
count++; |
145 |
|
} |
146 |
10 |
Assert.assertEquals(count, viewerNum, |
147 |
|
"Wrong number of structure viewers opened"); |
148 |
|
} |
149 |
|
} |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
1 |
@DataProvider(name = "structureOpeningArgsParams")... |
152 |
|
public Object[][] structureOpeningArgsParams() |
153 |
|
{ |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
1 |
return new Object[][] { |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
{ "--gui --nonews --nosplash --debug " |
165 |
|
+ "--append=examples/uniref50.fa " |
166 |
|
+ "--colour=gecos-flower " |
167 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
168 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
169 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
170 |
|
15, 7, 1 }, |
171 |
|
{ "--gui --nonews --nosplash --debug " |
172 |
|
+ "--append=examples/uniref50.fa " |
173 |
|
+ "--colour=gecos-flower " |
174 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
175 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
176 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops2 ", |
177 |
|
15, 4, 1 }, |
178 |
|
{ "--gui --nonews --nosplash --debug " |
179 |
|
+ "--append=examples/uniref50.fa " |
180 |
|
+ "--colour=gecos-flower " |
181 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
182 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
183 |
|
+ "--noshowssannotations " |
184 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
185 |
|
15, 4, 1 }, |
186 |
|
{ "--gui --nonews --nosplash --debug " |
187 |
|
+ "--append=examples/uniref50.fa " |
188 |
|
+ "--colour=gecos-flower " |
189 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
190 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
191 |
|
+ "--noshowannotations " |
192 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
193 |
|
15, 3, 1 }, |
194 |
|
{ "--gui --nonews --nosplash --debug " |
195 |
|
+ "--append=examples/uniref50.fa " |
196 |
|
+ "--colour=gecos-flower " |
197 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
198 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
199 |
|
+ "--noshowannotations " + "--noshowssannotations " |
200 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
201 |
|
15, 0, 1 }, |
202 |
|
{ "--gui --nonews --nosplash --debug " |
203 |
|
+ "--append=examples/uniref50.fa " |
204 |
|
+ "--colour=gecos-flower " |
205 |
|
+ "--structure=[seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.cif " |
206 |
|
+ "--paematrix=examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json " |
207 |
|
+ "--noshowannotations " + "--noshowssannotations " |
208 |
|
+ "--props=test/jalview/bin/commandsTest2.jvprops1 ", |
209 |
|
15, 0, 1 }, |
210 |
|
{ "--gui --nonews --nosplash --debug --nowebservicediscovery --props=test/jalview/bin/commandsTest.jvprops --argfile=test/jalview/bin/commandsTest2.argfile1 ", |
211 |
|
16, 19, 3 }, |
212 |
|
{ "--gui --nonews --nosplash --debug --nowebservicediscovery --props=test/jalview/bin/commandsTest.jvprops --argfile=test/jalview/bin/commandsTest2.argfile2 ", |
213 |
|
16, 0, 2 }, |
214 |
|
{ "--gui --nonews --nosplash --debug --nowebservicediscovery --props=test/jalview/bin/commandsTest.jvprops --open=./examples/test_fab41.result/sample.a2m " |
215 |
|
+ "--allstructures " |
216 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " |
217 |
|
+ "--structureviewer=none " |
218 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_2_model_4.pdb " |
219 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_3_model_2.pdb", |
220 |
|
16, 10, 0 }, |
221 |
|
{ "--gui --nonews --nosplash --debug --nowebservicediscovery --props=test/jalview/bin/commandsTest.jvprops --open=./examples/test_fab41.result/sample.a2m " |
222 |
|
+ "--allstructures " |
223 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb " |
224 |
|
+ "--noallstructures " + "--structureviewer=none " |
225 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_2_model_4.pdb " |
226 |
|
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_3_model_2.pdb", |
227 |
|
16, 10, 2 }, |
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
}; |
232 |
|
} |
233 |
|
} |