3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.lazyloading
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import org
.junit
.Ignore
;
18 import org
.junit
.Test
;
20 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
21 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
22 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
24 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationship
;
25 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
26 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
27 import eu
.etaxonomy
.taxeditor
.httpinvoker
.BaseRemotingTest
;
28 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
31 * This test class is primarily for performance testing.
32 * It should be used to make read-only calls to the target cdm-server.
38 //FIXME:Remoting ignoring until we can target integration servers
40 public class PropertyPathsTest
extends BaseRemotingTest
{
43 public void taxonLoadTest() {
44 // load taxon Crepis from cichorieae
45 UUID taxonBaseUuid
= UUID
.fromString("d0ae2121-1c32-4737-8c49-f871d429fd90");
46 List
<String
> taxonBasePropertyPaths
= Arrays
.asList(new String
[] {
47 "synonymRelations.synonym.name.status.type",
48 "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.relatedFrom.name.status"
50 TaxonBase taxonBase
= CdmStore
.getService(ITaxonService
.class).load(taxonBaseUuid
, taxonBasePropertyPaths
);
51 Taxon taxon
= CdmBase
.deproxy(taxonBase
, Taxon
.class);
52 Set
<SynonymRelationship
> synonymRelations
= taxon
.getSynonymRelations();
53 for(SynonymRelationship rel
: synonymRelations
) {
54 rel
.getSynonym().getName().getStatus().size();
56 Set
<TaxonNameBase
> typifiedNames
= taxon
.getName().getHomotypicalGroup().getTypifiedNames();
57 for(TaxonNameBase name
: typifiedNames
) {
58 Set
<TaxonBase
> taxonBases
= name
.getTaxonBases();
59 for(TaxonBase tb
: taxonBases
) {
60 if(tb
instanceof Synonym
) {
61 Synonym syn
= CdmBase
.deproxy(tb
, Synonym
.class);
62 Set
<SynonymRelationship
> rels
= syn
.getSynonymRelations();
63 for(SynonymRelationship rel
: rels
) {
64 rel
.getSynonym().getName().getStatus().size();
67 if(tb
instanceof Taxon
) {
68 Taxon syn
= CdmBase
.deproxy(tb
, Taxon
.class);
69 Set
<SynonymRelationship
> rels
= syn
.getSynonymRelations();
70 for(SynonymRelationship rel
: rels
) {
71 rel
.getSynonym().getName().getStatus().size();