2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ws.gui;
23 import jalview.bin.Cache;
24 import jalview.gui.JvOptionPane;
25 import jalview.gui.WsJobParameters;
26 import jalview.util.MessageManager;
27 import jalview.ws.jabaws.JalviewJabawsTestUtils;
28 import jalview.ws.jws2.JabaPreset;
29 import jalview.ws.jws2.Jws2Discoverer;
30 import jalview.ws.jws2.jabaws2.Jws2Instance;
31 import jalview.ws.params.ParamDatastoreI;
33 import java.awt.BorderLayout;
34 import java.awt.event.WindowAdapter;
35 import java.awt.event.WindowEvent;
36 import java.util.ArrayList;
37 import java.util.Iterator;
38 import java.util.List;
40 import javax.swing.JFrame;
41 import javax.swing.JPanel;
43 import org.testng.annotations.BeforeClass;
44 import org.testng.annotations.Test;
46 import compbio.metadata.Argument;
47 import compbio.metadata.Preset;
48 import compbio.metadata.PresetManager;
50 public class Jws2ParamView
53 @BeforeClass(alwaysRun = true)
54 public void setUpJvOptionPane()
56 JvOptionPane.setInteractiveMode(false);
57 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
61 * which services to test
63 public static List<String> serviceTests = new ArrayList<>();
66 * which presets to test for services
68 public static List<String> presetTests = new ArrayList<>();
71 serviceTests.add("AAConWS".toLowerCase());
74 public static Jws2Discoverer disc = null;
76 @BeforeClass(alwaysRun = true)
77 public static void setUpBeforeClass() throws Exception
79 Cache.loadProperties("test/jalview/io/testProps.jvprops");
81 disc = JalviewJabawsTestUtils.getJabawsDiscoverer();
85 * This test marked Interactive as it appears to need user action to complete
89 @Test(groups = { "Interactive" }, enabled = true)
90 public void testJws2Gui()
92 Iterator<String> presetEnum = presetTests.iterator();
93 for (Jws2Instance service : disc.getServices())
95 if (serviceTests.size() == 0
96 || serviceTests.contains(service.serviceType.toLowerCase()))
98 List<Preset> prl = null;
100 if (presetEnum.hasNext())
102 PresetManager prman = service.getPresets();
105 pr = prman.getPresetByName(presetEnum.next());
108 // just grab the last preset.
109 prl = prman.getPresets();
115 PresetManager prman = service.getPresets();
118 prl = prman.getPresets();
121 Iterator<Preset> en = (prl == null) ? null : prl.iterator();
122 while (en != null && en.hasNext())
132 WsJobParameters pgui = new WsJobParameters((ParamDatastoreI) null,
133 service, new JabaPreset(service, pr),
134 (List<Argument>) null);
135 JFrame jf = new JFrame(MessageManager
136 .formatMessage("label.ws_parameters_for", new String[]
137 { service.getActionText() }));
138 jf.setSize(700, 800);
139 JPanel cont = new JPanel(new BorderLayout());
141 cont.setPreferredSize(pgui.getPreferredSize());
142 cont.add(pgui, BorderLayout.CENTER);
143 jf.setLayout(new BorderLayout());
144 jf.add(cont, BorderLayout.CENTER);
147 final Thread thr = Thread.currentThread();
150 * This seems to need a user to manually inspect / test / close the
151 * GUI for each service tested. Not standalone JUnit.
153 jf.addWindowListener(new WindowAdapter()
156 public void windowClosing(WindowEvent e)
162 boolean inter = false;
167 Thread.sleep(10 * 1000);
168 } catch (InterruptedException e)