2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.lazyloading
;
11 import java
.util
.Arrays
;
12 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.junit
.Ignore
;
17 import org
.junit
.Test
;
19 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
20 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
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
;
30 * This test class is primarily for performance testing.
31 * It should be used to make read-only calls to the target cdm-server.
37 //FIXME:Remoting ignoring until we can target integration servers
39 public class PropertyPathsTest
extends BaseRemotingTest
{
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"
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();
55 Set
<TaxonNameBase
> typifiedNames
= taxon
.getName().getHomotypicalGroup().getTypifiedNames();
56 for(TaxonNameBase 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();
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();