/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.ws.jws2;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
import jalview.bin.Cache;
import jalview.gui.JvOptionPane;
import jalview.ws.jabaws.JalviewJabawsTestUtils;
import jalview.ws.jws2.jabaws2.Jws2Instance;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
import compbio.metadata.WrongParameterException;
/*
* All methods in this class are set to the Network group because setUpBeforeClass will fail
* if there is no network.
*/
@Test(singleThreaded = true)
public class ParameterUtilsTest
{
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
/*
* To limit tests to specify services, add them to this list; leave list empty
* to test all
*/
private static List serviceTests = new ArrayList();
private static Jws2Discoverer disc = null;
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
serviceTests.add("AAConWS".toLowerCase());
Cache.loadProperties("test/jalview/io/testProps.jvprops");
Cache.initLogger();
disc = JalviewJabawsTestUtils.getJabawsDiscoverer();
}
@Test(groups = { "Network" })
public void testWriteParameterSet() throws WrongParameterException
{
for (Jws2Instance service : disc.getServices())
{
if (isForTesting(service))
{
List prl = null;
PresetManager prman = service.getPresets();
if (prman == null)
{
continue;
}
prl = prman.getPresets();
if (prl == null)
{
continue;
}
for (Preset pr : prl)
{
List writeparam = null;
List readparam = null;
writeparam = ParameterUtils.writeParameterSet(
pr.getArguments(service.getRunnerConfig()), " ");
List