20 |
20 |
import org.unitils.dbunit.annotation.DataSet;
|
21 |
21 |
|
22 |
22 |
import com.vaadin.data.Item;
|
|
23 |
import com.vaadin.data.util.sqlcontainer.RowId;
|
23 |
24 |
|
24 |
25 |
import eu.etaxonomy.cdm.vaadin.CdmVaadinBaseTest;
|
25 |
26 |
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer;
|
... | ... | |
33 |
34 |
*
|
34 |
35 |
*/
|
35 |
36 |
@DataSet
|
|
37 |
|
36 |
38 |
public class StatusPresenterTest extends CdmVaadinBaseTest {
|
37 |
39 |
|
38 |
40 |
private static final Logger logger = Logger.getLogger(StatusPresenterTest.class);
|
... | ... | |
76 |
78 |
@Test
|
77 |
79 |
public void testLoadSynonyms() throws SQLException {
|
78 |
80 |
LeafNodeTaxonContainer container = sp.loadTaxa(11);
|
79 |
|
container.refresh();
|
|
81 |
|
80 |
82 |
Collection<?> rootItemIds = container.rootItemIds();
|
81 |
83 |
Assert.assertEquals(3,rootItemIds.size());
|
82 |
84 |
|
83 |
|
Collection<?> childIds = container.getChildren(10);
|
|
85 |
RowId taxonId10 = new RowId(10);
|
|
86 |
RowId taxonId11 = new RowId(11);
|
|
87 |
Collection<?> childIds = container.getChildren(taxonId10);
|
84 |
88 |
Assert.assertEquals(2, childIds.size());
|
85 |
89 |
|
86 |
|
// FIXME : Need to check why these calls thorw a NPE
|
87 |
|
// in the case of h2
|
88 |
|
//Assert.assertEquals(true, container.areChildrenAllowed(10));
|
89 |
|
//Assert.assertEquals(false, container.areChildrenAllowed(11));
|
|
90 |
Assert.assertEquals(true, container.areChildrenAllowed(taxonId10));
|
|
91 |
Assert.assertEquals(false, container.areChildrenAllowed(taxonId11));
|
|
92 |
}
|
|
93 |
|
|
94 |
@Test
|
|
95 |
public void updatePublishFlag() throws SQLException {
|
|
96 |
LeafNodeTaxonContainer container = sp.loadTaxa(11);
|
|
97 |
RowId taxonId = new RowId(10);
|
|
98 |
boolean pb = (Boolean) container.getItem(taxonId).getItemProperty(LeafNodeTaxonContainer.PB_ID).getValue();
|
|
99 |
Assert.assertTrue(pb);
|
|
100 |
sp.updatePublished(false, taxonId);
|
|
101 |
container.refresh();
|
|
102 |
pb = (Boolean) container.getItem(taxonId).getItemProperty(LeafNodeTaxonContainer.PB_ID).getValue();
|
|
103 |
Assert.assertFalse(pb);
|
90 |
104 |
}
|
91 |
105 |
|
92 |
106 |
@Ignore
|
CdmVaadinBaseTest : added disabling of constraints for ignoring foreign key constraints
StatusPresenterTest : added test for updating publish flag