merge
[taxeditor.git] / eu.etaxonomy.taxeditor.test / src / test / java / eu / etaxonomy / taxeditor / ui / dialogs / CdmServerInfoTest.java
1 // $Id$
2 /**
3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.taxeditor.ui.dialogs;
11
12 import java.util.List;
13
14 import org.junit.Assert;
15 import org.junit.Ignore;
16 import org.junit.Test;
17 import org.unitils.UnitilsJUnit4;
18
19 import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
20 import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
21 import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo;
22
23 /**
24 * @author cmathew
25 * @date 26 Jan 2015
26 *
27 */
28
29 public class CdmServerInfoTest extends UnitilsJUnit4 {
30
31 @Test
32 public void pingServersTest() {
33 List<CdmServerInfo> servers = CdmServerInfo.getCdmServers();
34 for(CdmServerInfo server : servers) {
35 server.pingServer();
36 }
37 }
38
39
40 @Ignore // this should be targetting integration or production
41 @Test
42 public void pingInstancesTest() {
43 CdmServerInfo csii = new CdmServerInfo("edit-test", "test.e-taxonomy.eu", 8080);
44 try {
45 csii.refreshInstances();
46 List<CdmInstanceInfo> instances = csii.getInstances();
47 for(CdmInstanceInfo instance : instances) {
48 Assert.assertTrue(csii.pingInstance(instance, 8080));
49 }
50 } catch (CDMServerException e) {
51 Assert.fail("Execption should not be thrown here");
52 }
53 }
54
55 @Test
56 public void refreshWrongInstancesTest() {
57 CdmServerInfo wrongCsii = new CdmServerInfo("local", "local", 8080);
58 try {
59 wrongCsii.refreshInstances();
60 List<CdmInstanceInfo> instances = wrongCsii.getInstances();
61 Assert.fail("Execption should be thrown here");
62 } catch (CDMServerException e) {
63
64 }
65 }
66
67 @Ignore // this should be targetting integration or production
68 @Test
69 public void refreshInstancesTest() throws CDMServerException {
70 CdmServerInfo cdmServerInfo = new CdmServerInfo("edit-test", "test.e-taxonomy.eu", 8080);
71 cdmServerInfo.refreshInstances();
72 List<CdmInstanceInfo> instances = cdmServerInfo.getInstances();
73 Assert.assertTrue(instances != null && !instances.isEmpty());
74 }
75
76 @Test
77 public void convertToServerConfigTest() {
78
79
80 }
81 }