Project

General

Profile

Download (2.23 KB) Statistics
| Branch: | Tag: | Revision:
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.Test;
16
import org.unitils.UnitilsJUnit4;
17

    
18
import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
19
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
20
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo;
21

    
22
/**
23
 * @author cmathew
24
 * @date 26 Jan 2015
25
 *
26
 */
27

    
28
public class CdmServerInfoTest extends UnitilsJUnit4 {
29

    
30
    @Test
31
    public void pingServersTest() {
32
        List<CdmServerInfo> servers = CdmServerInfo.getCdmServers();
33
        for(CdmServerInfo server : servers) {
34
            server.pingServer();
35
        }
36
    }
37

    
38

    
39
    @Test
40
    public void pingInstancesTest() {
41
        CdmServerInfo csii = new CdmServerInfo("edit-test", "test.e-taxonomy.eu", 8080);
42
        try {
43
            csii.refreshInstances();
44
            List<CdmInstanceInfo> instances = csii.getInstances();
45
            for(CdmInstanceInfo instance : instances) {
46
                Assert.assertTrue(csii.pingInstance(instance, 8080));
47
            }
48
        } catch (CDMServerException e) {
49
            Assert.fail("Execption should not be thrown here");
50
        }
51
    }
52

    
53
    @Test
54
    public void refreshWrongInstancesTest() {
55
        CdmServerInfo wrongCsii = new CdmServerInfo("local", "local", 8080);
56
        try {
57
            wrongCsii.refreshInstances();
58
            List<CdmInstanceInfo> instances = wrongCsii.getInstances();
59
            Assert.fail("Execption should be thrown here");
60
        } catch (CDMServerException e) {
61

    
62
        }
63
    }
64

    
65
    @Test
66
    public void refreshInstancesTest() throws CDMServerException {
67
        CdmServerInfo cdmServerInfo = new CdmServerInfo("edit-test", "test.e-taxonomy.eu", 8080);
68
        cdmServerInfo.refreshInstances();
69
        List<CdmInstanceInfo> instances = cdmServerInfo.getInstances();
70
        Assert.assertTrue(instances != null && !instances.isEmpty());
71
    }
72

    
73
    @Test
74
    public void convertToServerConfigTest() {
75

    
76

    
77
    }
78
}
(1-1/2)