1 package jalview.ws.rest;
3 import static org.testng.AssertJUnit.assertEquals;
4 import org.testng.annotations.Test;
5 import java.util.Vector;
7 import jalview.bin.Cache;
9 public class RestClientTest
12 * Refactored 'as is' from main method
15 public void testGetRestClient()
18 * Load test properties file (readonly) so as not to overwrite the real one
20 Cache.loadProperties("test/src/jalview/io/testProps.jvprops");
22 RestClient[] clients = RestClient.getRestClients();
23 System.out.println("Got " + clients.length + " clients.");
25 Vector<String> urls = new Vector<String>();
26 for (RestClient cl : clients)
28 System.out.println("" + (++i) + ": " + cl.service.toString());
29 urls.add(cl.service.toString());
31 RestClient.setRsbsServices(urls);
33 RestClient[] restClients = RestClient.getRestClients();
34 assertEquals("", clients.length, restClients.length);
37 * Check the two lists hold 'equal' (albeit different) objects. Ordering
38 * should be the same as getRestClients returns the list in the same order
39 * as setRsbsServices sets it.
41 for (i = 0; i < clients.length; i++)
44 * RestServiceDescription.equals() compares numerous fields
46 assertEquals(clients[i].getRestDescription(),
47 restClients[i].getRestDescription());