1
|
/**
|
2
|
* Copyright (C) 2015 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.taxeditor.lazyloading;
|
10
|
|
11
|
import java.util.Arrays;
|
12
|
import java.util.List;
|
13
|
import java.util.Set;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.junit.Ignore;
|
17
|
import org.junit.Test;
|
18
|
|
19
|
import eu.etaxonomy.cdm.api.service.ITaxonService;
|
20
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
21
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
22
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
23
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
24
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
25
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
|
26
|
import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
|
27
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
28
|
|
29
|
/**
|
30
|
* This test class is primarily for performance testing.
|
31
|
* It should be used to make read-only calls to the target cdm-server.
|
32
|
*
|
33
|
* @author cmathew
|
34
|
* @date 26 Aug 2015
|
35
|
*
|
36
|
*/
|
37
|
//FIXME:Remoting ignoring until we can target integration servers
|
38
|
@Ignore
|
39
|
public class PropertyPathsTest extends BaseRemotingTest {
|
40
|
|
41
|
@Test
|
42
|
public void taxonLoadTest() {
|
43
|
// load taxon Crepis from cichorieae
|
44
|
UUID taxonBaseUuid = UUID.fromString("d0ae2121-1c32-4737-8c49-f871d429fd90");
|
45
|
List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
|
46
|
"synonymRelations.synonym.name.status.type",
|
47
|
"name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.relatedFrom.name.status"
|
48
|
});
|
49
|
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, taxonBasePropertyPaths);
|
50
|
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
|
51
|
Set<TaxonRelationship> taxonRelations = taxon.getTaxonRelations();
|
52
|
for(TaxonRelationship rel : taxonRelations) {
|
53
|
rel.getFromTaxon().getName().getStatus().size();
|
54
|
}
|
55
|
Set<TaxonName> typifiedNames = taxon.getName().getHomotypicalGroup().getTypifiedNames();
|
56
|
for(TaxonName name : typifiedNames) {
|
57
|
Set<TaxonBase> taxonBases = name.getTaxonBases();
|
58
|
for(TaxonBase tb : taxonBases) {
|
59
|
//TODO needs to be adapted after synonym relationship removal
|
60
|
// if(tb instanceof Synonym) {
|
61
|
// Synonym syn = CdmBase.deproxy(tb, Synonym.class);
|
62
|
// Set<TaxonRelationship> rels = syn.getTaxonRelations();
|
63
|
// for(TaxonRelationship rel : rels) {
|
64
|
// rel.getSynonym().getName().getStatus().size();
|
65
|
// }
|
66
|
// }
|
67
|
if(tb instanceof Taxon) {
|
68
|
Taxon tax = CdmBase.deproxy(tb, Taxon.class);
|
69
|
Set<TaxonRelationship> rels = tax.getTaxonRelations();
|
70
|
for(TaxonRelationship rel : rels) {
|
71
|
rel.getFromTaxon().getName().getStatus().size();
|
72
|
}
|
73
|
}
|
74
|
}
|
75
|
}
|
76
|
}
|
77
|
|
78
|
}
|