1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal.selenium.tests.reference;
|
10
|
|
11
|
import java.net.MalformedURLException;
|
12
|
import java.util.List;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.junit.Before;
|
16
|
import org.junit.Test;
|
17
|
|
18
|
import eu.etaxonomy.dataportal.DataPortalSite;
|
19
|
import eu.etaxonomy.dataportal.elements.TaxonNodeStatusElement;
|
20
|
import eu.etaxonomy.dataportal.elements.TaxonNodeStatusElement.TaxonNodeStatusData;
|
21
|
import eu.etaxonomy.dataportal.junit.CdmDataPortalTestBase;
|
22
|
import eu.etaxonomy.dataportal.junit.DataPortalContextSuite.DataPortalContexts;
|
23
|
import eu.etaxonomy.dataportal.pages.TaxonPage;
|
24
|
import eu.etaxonomy.dataportal.pages.TaxonSynonymyPage;
|
25
|
|
26
|
/**
|
27
|
* Issues to be covered by this TestClass:
|
28
|
*
|
29
|
* Test for feature request https://dev.e-taxonomy.eu/redmine/issues/3616
|
30
|
*
|
31
|
* @author a.kohlbecker
|
32
|
*
|
33
|
*/
|
34
|
|
35
|
@DataPortalContexts( { DataPortalSite.reference })
|
36
|
public class TaxonNodeStatusTest extends CdmDataPortalTestBase{
|
37
|
|
38
|
static final UUID casus_dubius_uuid = UUID.fromString("b6abcec5-d58e-4bf1-87c4-f7926525d1a6");
|
39
|
static final UUID casus_noninsolor_uuid = UUID.fromString("6e6cc783-f0b6-49e4-b186-ed66bbda4d2a");
|
40
|
static final UUID casus_admirabilis_uuid = UUID.fromString("1412a6af-c005-4a8a-a07a-036ea4255824");
|
41
|
static final UUID casus_exosrs_uuid = UUID.fromString("411f37e2-c583-44bb-a40d-21b1eeb92034");
|
42
|
|
43
|
@Before
|
44
|
public void setUp() throws Exception {
|
45
|
driver.get(getContext().getSiteUri().toString());
|
46
|
}
|
47
|
|
48
|
@Test
|
49
|
public void test_casus_dubius() throws MalformedURLException {
|
50
|
|
51
|
TaxonPage p = new TaxonPage(driver, getContext(), casus_dubius_uuid);
|
52
|
casus_dubius_assertions(p);
|
53
|
}
|
54
|
|
55
|
@Test
|
56
|
public void test_casus_dubius_synonymy() throws MalformedURLException {
|
57
|
|
58
|
TaxonPage p = new TaxonSynonymyPage(driver, getContext(), casus_dubius_uuid);
|
59
|
casus_dubius_assertions(p);
|
60
|
}
|
61
|
|
62
|
private void casus_dubius_assertions(TaxonPage p) {
|
63
|
|
64
|
assertTrue(p.getTaxonNodeStatusContainer().get(0).getText().startsWith("Placement status: "));
|
65
|
|
66
|
List<TaxonNodeStatusElement> statusElements = p.getTaxonNodeStates();
|
67
|
assertEquals(1, statusElements.size());
|
68
|
TaxonNodeStatusElement statusElement = statusElements.get(0);
|
69
|
assertEquals(2, statusElement.getTaxonNodeStatus().size());
|
70
|
|
71
|
TaxonNodeStatusData tnsData_0 = statusElement.getTaxonNodeStatus().get(0);
|
72
|
assertEquals("TaxonNodeDto", tnsData_0.getTaxonNodeRef().getCdmType());
|
73
|
assertEquals("402ea023-07be-4335-9274-1c3e30a7df3f", tnsData_0.getTaxonNodeRef().getUuid().toString());
|
74
|
assertEquals("doubtful (The placement has been made for software testing purposes only)", tnsData_0.getStatusText().trim());
|
75
|
|
76
|
assertEquals("Classification", tnsData_0.getClassificationRef().getCdmType());
|
77
|
assertEquals("2ab81d37-125d-47e6-8450-6aafd5f4b043", tnsData_0.getClassificationRef().getUuid().toString());
|
78
|
assertEquals("[My Classification]", tnsData_0.getClassficationText());
|
79
|
|
80
|
TaxonNodeStatusData tnsData_1 = statusElement.getTaxonNodeStatus().get(1);
|
81
|
assertEquals("excluded", tnsData_1.getStatusText().trim());
|
82
|
assertEquals("5b217667-d4f4-4ae7-8ab9-b2ceb599d7d0", tnsData_1.getTaxonNodeRef().getUuid().toString());
|
83
|
assertEquals("TaxonNodeDto", tnsData_1.getTaxonNodeRef().getCdmType());
|
84
|
|
85
|
assertEquals("Classification", tnsData_1.getClassificationRef().getCdmType());
|
86
|
assertEquals("41414d01-34f8-48de-9c2a-7c635167a23e", tnsData_1.getClassificationRef().getUuid().toString());
|
87
|
assertEquals("[Alternative Classification]", tnsData_1.getClassficationText());
|
88
|
}
|
89
|
|
90
|
@Test
|
91
|
public void test_casus_noninsolor() throws MalformedURLException {
|
92
|
|
93
|
TaxonPage p = new TaxonPage(driver, getContext(), casus_noninsolor_uuid);
|
94
|
|
95
|
assertTrue("Expecting sigular", p.getTaxonNodeStatusContainer().get(0).getText().startsWith("Placement status: "));
|
96
|
|
97
|
List<TaxonNodeStatusElement> statusElements = p.getTaxonNodeStates();
|
98
|
assertEquals(1, statusElements.size());
|
99
|
TaxonNodeStatusElement statusElement = statusElements.get(0);
|
100
|
assertEquals(1, statusElement.getTaxonNodeStatus().size());
|
101
|
|
102
|
TaxonNodeStatusData tnsData_0 = statusElement.getTaxonNodeStatus().get(0);
|
103
|
assertEquals("TaxonNodeDto", tnsData_0.getTaxonNodeRef().getCdmType());
|
104
|
assertEquals("1d7ce8ab-9335-492b-a079-9f7d84a50cd0", tnsData_0.getTaxonNodeRef().getUuid().toString());
|
105
|
assertEquals("unplaced", tnsData_0.getStatusText().trim());
|
106
|
|
107
|
assertNull(tnsData_0.getClassificationRef());
|
108
|
assertNull(tnsData_0.getClassficationText());
|
109
|
}
|
110
|
|
111
|
@Test
|
112
|
public void test_casus_admirabilis() throws MalformedURLException {
|
113
|
|
114
|
TaxonPage p = new TaxonPage(driver, getContext(), casus_admirabilis_uuid);
|
115
|
|
116
|
assertTrue(p.getTaxonNodeStatusContainer().get(0).getText().startsWith("Placement status: "));
|
117
|
|
118
|
List<TaxonNodeStatusElement> statusElements = p.getTaxonNodeStates();
|
119
|
assertEquals(1, statusElements.size());
|
120
|
TaxonNodeStatusElement statusElement = statusElements.get(0);
|
121
|
assertEquals(1, statusElement.getTaxonNodeStatus().size());
|
122
|
|
123
|
TaxonNodeStatusData tnsData_0 = statusElement.getTaxonNodeStatus().get(0);
|
124
|
assertEquals("excluded", tnsData_0.getStatusText().trim());
|
125
|
|
126
|
assertNull(tnsData_0.getClassificationRef());
|
127
|
assertNull(tnsData_0.getClassficationText());
|
128
|
}
|
129
|
|
130
|
@Test
|
131
|
public void test_casus_exsors() throws MalformedURLException {
|
132
|
|
133
|
TaxonPage p = new TaxonPage(driver, getContext(), casus_exosrs_uuid);
|
134
|
|
135
|
assertTrue("Expecting sigular", p.getTaxonNodeStatusContainer().get(0).getText().startsWith("Placement status: "));
|
136
|
|
137
|
List<TaxonNodeStatusElement> statusElements = p.getTaxonNodeStates();
|
138
|
assertEquals(1, statusElements.size());
|
139
|
TaxonNodeStatusElement statusElement = statusElements.get(0);
|
140
|
assertEquals(1, statusElement.getTaxonNodeStatus().size());
|
141
|
|
142
|
TaxonNodeStatusData tnsData_0 = statusElement.getTaxonNodeStatus().get(0);
|
143
|
assertEquals("TaxonNodeDto", tnsData_0.getTaxonNodeRef().getCdmType());
|
144
|
assertEquals("excluded", tnsData_0.getStatusText().trim());
|
145
|
|
146
|
assertNull(tnsData_0.getClassificationRef());
|
147
|
assertNull(tnsData_0.getClassficationText());
|
148
|
}
|
149
|
|
150
|
|
151
|
|
152
|
}
|